EOJ BOT

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Florafauna
Posts: 8
Joined: Tue Dec 17, 2013 8:12 pm

EOJ BOT

#1 Post by Florafauna » Sun Jan 12, 2014 3:04 pm

Code: Select all

YourTargetScore = 6000

function waitForEventStart()
   repeat
   yrest(1000) -- check every second
   local namePE,messagePE,namePH,ScorePE,Count , IsScoreVisible= RoMScript("PE_GetInfo(1)")
      if (ScorePE == nil) then
         printf("Score is nil, oh no!")
         __WPL:setWaypointIndex(__WPL:findWaypointTag("Timer"));
         return
      end
      if Count == 2 and YourTargetScore > ScorePE then break end
      until false
   local namePE,messagePE,namePH,ScorePE,Count , IsScoreVisible= RoMScript("PE_GetInfo(1)")
   if Count ~= 2 or ScorePE >= YourTargetScore then
      __WPL:setWaypointIndex(__WPL:findWaypointTag("Home"));
   end
end

function doquest()  
         local endmsg = getTEXT("|cffffff75Regional event has ended successfully!|r")

   repeat
           yrest(10)
            quest()
      GMdetectionname()
      people()
        until getLastWarning(endmsg, 10)

   EventMonitorStart("Tug of War Between Two Sides", "WARNING_MESSAGE");
   local time, moreToCome, msg = EventMonitorCheck("Tug of War Between two Sides",1) 
   if msg == endmsg then
            local currentchannel = RoMScript("GetCurrentParallelID()")
            local newChannel = currentchannel
            repeat
               newChannel = newChannel + 1
               if newChannel > RoMScript("GetNumParalleZones()") then
                     newChannel = 1
               end
            until RoMScript("IsZoneChannelOnLine("..newChannel..")") or newChannel == currentchannel
               if newChannel ~= currentchannel then
                  sendMacro("ChangeParallelID("..newChannel..");");
                  player:rest(30)
                  local id = RoMScript("GetCurrentParallelID()")
                  if id ~= newChannel then
                        RoMScript("ChangeChar(\"current\,nil,"..newChannel..")")
                        waitForLoadingScreen()
                        yrest(3000)
                  end
               end
   end
end

function doquest3()  
         local endmsg = getTEXT("|cffffff75Regional event has ended successfully!|r")

   repeat
           yrest(10)
            quest()
      GMdetectionname()
      people()
        until getLastWarning(endmsg, 10)
end

function quest()
          player:target_NPC("Papp Hesof");
   AcceptQuestByName(425597);
   AcceptQuestByName(425598);
   repeat
   queststate = getQuestStatus(425597);
          if queststate == "complete" then      
      CompleteQuestByName("425597");
      else
      CancelQuest(425598);yrest(500);
      end
   until getLastWarning(endmsg, 10)
end
function restTilEvent()
   repeat
   yrest(700)
   until os.date("*t").min%20 == 10
      
   yrest(10000)
      local curtime = os.date("*t")
      local curmins = curtime.min   
   local cursecs = curtime.sec
      if curmins > 48 then
            curmins = curmins - 47
      elseif curmins > 28 then
            curmins = curmins - 27
      elseif curmins > 8 then
           curmins = curmins - 7
      else
            curmins = curmins + 10
      end
      local resttime = ((20 - curmins) * 60) - cursecs
      print("resting for "..resttime.." seconds")
      yrest(resttime*1000)
end

function channel()
   sendMacro("ChangeParallelID("..newChannel..");");
        player:rest(30)
   local id = RoMScript("GetCurrentParallelID()")
        if id ~= newChannel then
           RoMScript("ChangeChar(\"current\",nil,"..newChannel..")")
               waitForLoadingScreen()
               yrest(3000)
   end
end

function people()
   if CountPlayers() > 8 then
         print("Waiting till it's less crowded")
         repeat
            yrest(15000)
         until 3 > CountPlayers(nil,true) 
   end
end

function DetectionnameAll()

      EventMonitorStart("detectMaster", "CHAT_MSG_SYSTEM");
         sendMacro("AskPlayerInfo(\'Nohdrael\');"); yrest(800);
         sendMacro("AskPlayerInfo(\'Kiareko\');"); yrest(800);
         sendMacro("AskPlayerInfo(\'Lonarhune\');"); yrest(800);
   
         repeat
               local time, moreToCome, msg = EventMonitorCheck("detectMaster", "1")
               if msg and string.find(msg, "Game Moderator") then
                  RoMScript("Logout();");
                  break
         elseif msg and not string.find(msg, "Search failed") then
                  channelAll()
                  break
               end
         until moreToCome == false

      EventMonitorStop("detectMaster")
   end

function Detectionname3()

      EventMonitorStart("detectMaster", "CHAT_MSG_SYSTEM");
         sendMacro("AskPlayerInfo(\'Nohdrael\');"); yrest(800);
         sendMacro("AskPlayerInfo(\'Kiareko\');"); yrest(800);
         sendMacro("AskPlayerInfo(\'Lonarhune\');"); yrest(800);
   
         repeat
               local time, moreToCome, msg = EventMonitorCheck("detectMaster", "1")
               if msg and string.find(msg, "Game Moderator") then
                  RoMScript("Logout();");
                  break
         elseif msg and not string.find(msg, "Search failed") then
                  restTilEvent()
            channel()
                  break
               end
         until moreToCome == false

      EventMonitorStop("detectMaster")
   end

   registerTimer("Detection", secondsToTimer(10), Detectionname3);function Detectionname3()
end

function unStick3()
   waitForLoadingScreen();
   if getZoneId() ~= number(a1) then
   RoMScript("Logout();");
      waitForLoadingScreen();
      if getZoneId() ~= number(a2) then
      RoMScript("Logout();");
         waitForLoadingScreen();
         if getZoneId() ~= number(a3) then
         RoMScript("Logout();");
         end
      end
   end
end  
i get an error
[string "..."]:3: attempt to call global 'number' <a nil value>

User avatar
Bill D Cat
Posts: 555
Joined: Sat Aug 10, 2013 8:13 pm
Location: Deep in the Heart of Texas

Re: EOJ BOT

#2 Post by Bill D Cat » Sun Jan 12, 2014 3:26 pm

I think number(a1) isn't a valid command. Try tonumber(a1) instead.

Florafauna
Posts: 8
Joined: Tue Dec 17, 2013 8:12 pm

Re: EOJ BOT

#3 Post by Florafauna » Sun Jan 12, 2014 3:31 pm

wow fast response okay testing it right now

Florafauna
Posts: 8
Joined: Tue Dec 17, 2013 8:12 pm

Re: EOJ BOT

#4 Post by Florafauna » Sun Jan 12, 2014 3:37 pm

okay it works
now i get
Oh no Score is nil and i loops Waypoint 1 over and over again.

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<waypoints>
<onload>
    include("myfile_onload.lua")
</onload>

<!-- #  1 --><waypoint x="-9276" z="-18431" y="907" tag="Home">
      waitForEventStart()
</waypoint>
<!-- #  2 --><waypoint x="-9414" z="-18353" y="932">
   yrest(2000)
   if getZoneId() == tonumber(a1) then
      doquest()
      Detectionname()
   end
   if getZoneId() == tonumber(a2) then
      doquest()
      Detectionname()
   end
   if getZoneId() == tonumber(a3) then
      doquest()
      Detectionname3()
   end
   __WPL:setWaypointIndex(__WPL:findWaypointTag("Home"));
</waypoint>
<!-- #  2 --><waypoint x="-9397" z="-18357" y="932" tag="Home">   
   __WPL:setForcedWaypointType("TRAVEL")   
</waypoint>
<!-- #  3 --><waypoint x="-9257" z="-18444" y="904">   </waypoint>
<!-- #  4 --><waypoint x="-9175" z="-18543" y="895">   </waypoint>
<!-- #  5 --><waypoint x="-9065" z="-18758" y="851">   </waypoint>
<!-- #  6 --><waypoint x="-8936" z="-18846" y="863">   </waypoint>
<!-- #  7 --><waypoint x="-8885" z="-18921" y="882">   </waypoint>
<!-- #  8 --><waypoint x="-8885" z="-18920" y="881">   </waypoint>
<!-- #  9 --><waypoint x="-8854" z="-18991" y="905">   </waypoint>
<!-- # 10 --><waypoint x="-8806" z="-19152" y="905">   </waypoint>
<!-- # 11 --><waypoint x="-8592" z="-19389" y="905">   </waypoint>
<!-- # 12 --><waypoint x="-8730" z="-19168" y="907">   </waypoint>
<!-- # 13 --><waypoint x="-8839" z="-19000" y="898">   </waypoint>
<!-- # 14 --><waypoint x="-8960" z="-18804" y="856">   </waypoint>
<!-- # 15 --><waypoint x="-9097" z="-18740" y="851">   </waypoint>
<!-- # 16 --><waypoint x="-9166" z="-18529" y="886">   </waypoint>
<!-- # 17 --><waypoint x="-9269" z="-18424" y="907">   </waypoint>
<!-- # 18 --><waypoint x="-9386" z="-18362" y="931">   </waypoint>
</waypoints>

User avatar
Bill D Cat
Posts: 555
Joined: Sat Aug 10, 2013 8:13 pm
Location: Deep in the Heart of Texas

Re: EOJ BOT

#5 Post by Bill D Cat » Sun Jan 12, 2014 3:46 pm

Something is going on with this command then:

Code: Select all

local namePE,messagePE,namePH,ScorePE,Count , IsScoreVisible= RoMScript("PE_GetInfo(1)")
Either the score isn't visible, and so the results are all nil, or the construct is incorrect. Unfortunately, the RoM wiki page for this command doesn't exist, so I can't really offer you too much help on it.

I'd suggest adding some print statements to check the other results returned by the command to see if they all are returning nil or some unexpected values.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: EOJ BOT

#6 Post by rock5 » Sun Jan 12, 2014 11:55 pm

Isn't PE_GetInfo one of those commands that doesn't work if the event frame is not visible? Maybe the event frame isn't visible.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests