Script to do a waypoint if the EOJ timer doesn't show?

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Message
Author
jrb913
Posts: 15
Joined: Sun Nov 13, 2011 8:56 pm

Script to do a waypoint if the EOJ timer doesn't show?

#1 Post by jrb913 » Sun Sep 09, 2012 12:35 am

I was just wondering.... Since sometimes the Timer for the EOJ events doesn't show (or disappears while waiting for an event), and you have to move to a different area to make it show again. Is there a way to have the bot monitor the event, and when the timer disappears, you can send your character to a certain waypoint and wait till the timer reappears and then go back to the original spot to continue waiting for the event to start? This would help me greatly, as it's quite annoying when the event timer disappears.

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

Re: Script to do a waypoint if the EOJ timer doesn't show?

#2 Post by rock5 » Sun Sep 09, 2012 1:16 am

If you are using any particular EOJ script, it would have helped if you had posted this question there.

Of course you can do what you asked. Like you said, if the timer isn't visible, move to a certain location and wait for it to appear. How you would include the code would depend on the script you used.
  • 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

jrb913
Posts: 15
Joined: Sun Nov 13, 2011 8:56 pm

Re: Script to do a waypoint if the EOJ timer doesn't show?

#3 Post by jrb913 » Mon Sep 10, 2012 4:38 pm

I was using the waypoint found in ( http://www.solarstrike.net/phpBB3/viewt ... =27&t=3890 ). I just found that at times the timer disappears, and wanted the bot to move to another spot not far away, to where the zone # changes and the timer reappears.

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

Re: Script to do a waypoint if the EOJ timer doesn't show?

#4 Post by rock5 » Tue Sep 11, 2012 1:46 am

There were a lot of scripts in that topic. Please in future, use a link to the actual post that you want to refer to. There is a little icon on the left of each posts title that has the link for that post.

Anyway, seeing as we are talking about timers, I'm assuming you are referring to this post, as I believe it's the only one using the timer.
http://www.solarstrike.net/phpBB3/viewt ... 019#p40019 Is that right?

First thing I want to ask you, though, is doesn't it work when the timer 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

Jandrana
Posts: 187
Joined: Thu Jul 05, 2012 5:53 am

Re: Script to do a waypoint if the EOJ timer doesn't show?

#5 Post by Jandrana » Tue Sep 11, 2012 3:57 am

First thing I want to ask you, though, is doesn't it work when the timer isn't visible?
I did some experiments with PE_GetInfo(1). PE_GetInfo(1) does return only nil's as soon as the timer disappears.

Code: Select all

   function waitForEventStart()
      repeat
         yrest(1000) -- check every second
         local namePE,messagePE,namePH,ScorePE,Count , IsScoreVisible= RoMScript("PE_GetInfo(1)")
         if Count == 2 and YourTargetScore > ScorePE then break end
      until false
   end
I didn't use this script, but I expect it to cause an error, when comparing

Code: Select all

YourTargetScore > ScorePE
and ScorePE is nil.

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

Re: Script to do a waypoint if the EOJ timer doesn't show?

#6 Post by rock5 » Tue Sep 11, 2012 4:38 am

Jandrana wrote:

Code: Select all

if Count == 2 and YourTargetScore > ScorePE then break end
I didn't use this script, but I expect it to cause an error, when comparing

Code: Select all

YourTargetScore > ScorePE
and ScorePE is nil.
Actually, if "PE_GetInfo(1) does return only nil's as soon as the timer disappears" then if ScorePE is nil, Count will also be nil. When "Count == 2" returns false, it wont bother doing the rest of that statement. The opposite is true with or statements. If the first part is true, it doesn't bother with the rest.

Lua is fun that way. You can do fun things with it. For example, instead of assigning an initial value of 0 to a counter variable you could do this, (Note: when dealing with values instead of comparisons, it returns the last value dealt with.)

Code: Select all

repeat
   count = (count or 0) + 1
   
   . . . Do stuff

until count == 10
What "count = (count or 0) + 1" does is, the first time it runs, count will equal nil so with "(count or 0)" count is nil which is considered false so it goes to the next part "0" which is considered true, so it returns 0. So it becomes "count = 0 + 1". On the second loop count will equal 1, which is considered true so it returns 1 and ignores the '0', so it becomes count = 1 + 1. And so on. BTW the only values considered false are false and nil. All other values are considered true when making comparisons.

End of lesson. Hope you found it useful.
  • 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

jrb913
Posts: 15
Joined: Sun Nov 13, 2011 8:56 pm

Re: Script to do a waypoint if the EOJ timer doesn't show?

#7 Post by jrb913 » Wed Sep 12, 2012 3:04 am

http://www.solarstrike.net/phpBB3/viewt ... 019#p40019 is the particular script I'm running. I just want it to check every once and a while to see if the timer is visible, and if it's not, to move to a nearby location to make the timer show again.

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

Re: Script to do a waypoint if the EOJ timer doesn't show?

#8 Post by rock5 » Wed Sep 12, 2012 5:00 am

That file was a bit messed up so I had to fix it a bit.
EoJ_Flame.xml
(1.57 KiB) Downloaded 348 times
Now to finish it off, use createpath to create a path from the home base to the waiting spot and then back. Copy the waypoints to the end of the file above (above the <waypoints> tag obviously). Add the following code to the waiting waypoint

Code: Select all

repeat
    yrest(5000)
until PEFisVisible()
And at the last waypoint add

Code: Select all

__WPL:setWaypointIndex(__WPL:findWaypointTag("Home Base"));
If you want me to explain any changes I made, just ask. Obviously this has not been tested as I don't have access to the new zone.
  • 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

User avatar
Ego95
Posts: 564
Joined: Tue Feb 28, 2012 12:38 pm
Contact:

Re: Script to do a waypoint if the EOJ timer doesn't show?

#9 Post by Ego95 » Wed Sep 12, 2012 6:45 am

if you get an error, it's only because rock made a little spell mistake:

Code: Select all

			return true
		else
			retuen false
		end
	end
retuen false has to be return false :)

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

Re: Script to do a waypoint if the EOJ timer doesn't show?

#10 Post by rock5 » Wed Sep 12, 2012 1:14 pm

AlterEgo95 wrote:if you get an error, it's only because rock made a little spell mistake:
I'm famous for them. LoL
  • 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

User avatar
Ego95
Posts: 564
Joined: Tue Feb 28, 2012 12:38 pm
Contact:

Re: Script to do a waypoint if the EOJ timer doesn't show?

#11 Post by Ego95 » Wed Sep 12, 2012 2:04 pm

rock5 wrote:I'm famous for them. LoL
Yeah, legendary mistakes ;)

Thankfully you do much more correct ;)

vo2male
Posts: 122
Joined: Mon Aug 27, 2012 6:41 am

Re: Script to do a waypoint if the EOJ timer doesn't show?

#12 Post by vo2male » Thu Sep 27, 2012 10:24 pm

rock5 wrote:That file was a bit messed up so I had to fix it a bit.
EoJ_Flame.xml
Now to finish it off, use createpath to create a path from the home base to the waiting spot and then back. Copy the waypoints to the end of the file above (above the <waypoints> tag obviously). Add the following code to the waiting waypoint

Code: Select all

repeat
    yrest(5000)
until PEFisVisible()
And at the last waypoint add

Code: Select all

__WPL:setWaypointIndex(__WPL:findWaypointTag("Home Base"));
If you want me to explain any changes I made, just ask. Obviously this has not been tested as I don't have access to the new zone.

Hi Rock! I'm sorry i got confused about this. Well i'd like to refer to this post. I had a timer-bug few days back but after the server maintenance the bug never happened again. What i want is similar to this..I wanted to add another waypoint that would take me far from this area as my Home Base (while waiting for the event to start again). However i don't want to include that Home-Base to my loop as that would just prolong the process. I tried to alter the waypoint 4 and changed it to another waypoint away from the Flame area but when i run the bot it also got included in the loop. I was reading the rom-wiki but i didn't read about making waypoint tags. I hope you could enlighten me.
Thanks!

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Script to do a waypoint if the EOJ timer doesn't show?

#13 Post by lisa » Thu Sep 27, 2012 11:22 pm

a little off topic.

Code: Select all

<!-- #  3 --><waypoint x="4016" z="3172" tag="merchant"></waypoint>
<!-- #  4 --><waypoint x="3948" z="3107" tag="Main"></waypoint>
if you want to go to merchant tag then

Code: Select all

__WPL:setWaypointIndex(__WPL:findWaypointTag("merchant"));
the tags themselves can be named anything you want.

So if you want it to go to the merchant tag when you reach the Main tag spot then do

Code: Select all

<!-- #  3 --><waypoint x="4016" z="3172" tag="merchant"></waypoint>
<!-- #  4 --><waypoint x="3948" z="3107" tag="Main">
__WPL:setWaypointIndex(__WPL:findWaypointTag("merchant"))
</waypoint>
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

vo2male
Posts: 122
Joined: Mon Aug 27, 2012 6:41 am

Re: Script to do a waypoint if the EOJ timer doesn't show?

#14 Post by vo2male » Fri Sep 28, 2012 2:12 am

lisa wrote:a little off topic.

Code: Select all

<!-- #  3 --><waypoint x="4016" z="3172" tag="merchant"></waypoint>
<!-- #  4 --><waypoint x="3948" z="3107" tag="Main"></waypoint>
if you want to go to merchant tag then

Code: Select all

__WPL:setWaypointIndex(__WPL:findWaypointTag("merchant"));
the tags themselves can be named anything you want.

So if you want it to go to the merchant tag when you reach the Main tag spot then do

Code: Select all

<!-- #  3 --><waypoint x="4016" z="3172" tag="merchant"></waypoint>
<!-- #  4 --><waypoint x="3948" z="3107" tag="Main">
__WPL:setWaypointIndex(__WPL:findWaypointTag("merchant"))
</waypoint>
Hi Lisa! thanks for the response. Here is an example waypoint.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<onload>
        function waitForEventStart()
		repeat
			yrest(1000) -- check every second
			local namePE,messagePE,namePH,ScorePE,Count , IsScoreVisible= RoMScript("PE_GetInfo(1)")
			if Count == 2 and YourTargetScore > ScorePE then break end
		until false
	end

	function isEventFinished()
		 local namePE,messagePE,namePH,ScorePE,Count , IsScoreVisible= RoMScript("PE_GetInfo(1)")
		 if Count ~= 2 or ScorePE >= YourTargetScore then
			__WPL:setWaypointIndex(__WPL:findWaypointTag("Home Base"));
		end
	end

</onload>

   <!-- #  1 --><waypoint x="-21868" z="-22936" y="588"> player:mount(); 
player:target_NPC("Diandon");
   CompleteQuestByName("Extinguish More Flames");
   </waypoint>
   <!-- #  2 --><waypoint x="-21654" z="-22933" y="592"> </waypoint>
   <!-- #  3 --><waypoint x="-21735" z="-23923" y="588"> 
queststate = getQuestStatus("Extinguish More Flames");
    while queststate == "incomplete" do
      yrest(1000);player:target_Object("Strange Flame Seedling");yrest(1000);
      queststate = getQuestStatus("Extinguish More Flames");
      end
   </waypoint>
  <!-- #  4 --><waypoint x="-21628" z="-22927" y="592" > 	</waypoint>
  <!-- #  5 --><waypoint x="-21517" z="-23111" y="587"  tag="Home Base">
       waitForEventStart()
		if (isEventFinished()) then
               __WPL:setWaypointIndex(__WPL:findWaypointTag("Home Base"));
            end
  </waypoint>
</waypoints>
I added waypoint 5 to be on the place where i wanted to be while event is not yet started. But when the event started, still my bot would run thru Waypoint 5.. I wanted to know how to make it happen that if

Code: Select all

function waitForEventStart()
is called, that would be the only time my bot would rest at waypoint 5. In short, not to be included in the quest loop...
Last edited by vo2male on Fri Sep 28, 2012 3:43 am, edited 1 time in total.

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

Re: Script to do a waypoint if the EOJ timer doesn't show?

#15 Post by rock5 » Fri Sep 28, 2012 2:53 am

First you close the loop by adding this to waypoint 4.

Code: Select all

__WPL:setWaypointIndex(1)
Now it will go from waypoint 4 to waypoint 1, excluding waypoint 5.

It looks like it's supposed to go to 5 from 1 so at waypoint one you have to make some sort of decision whether to go to waypoint 5. I'm not sure what that decision is. Maybe if the event is finished or if the PEF frame isn't visible?

So you would add something like this to waypoint 1.

Code: Select all

if isEventFinished() or RoMScript("PEFs:isVisible()") == false then -- under what conditions you want to go to waypoint 5.
    __WPL:setWaypoint(__WPL:findWaypointTag("Home Base"))
end
Probably after you have turned in the quest (BTW you haven't added an accept quest command. I'd just add it after the CompletQuestByName command). If those conditions aren't meet ie. you are still doing the quest, then it will keep going around the loop.

Then at waypoint 5 you want to wait for the event to start and then go back to waypoint 1. If I understand correctly, the PEF frame should reappear when you go to wp 5 so we might not need to add a check for it. So at waypoint 5 I'd just add

Code: Select all

waitForEventStart()
Because waypoint 1 comes after 5, because it's the last, we don't need to add a setWaypointIndex here.

I hope that's clear.
  • 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

vo2male
Posts: 122
Joined: Mon Aug 27, 2012 6:41 am

Re: Script to do a waypoint if the EOJ timer doesn't show?

#16 Post by vo2male » Fri Sep 28, 2012 2:58 am

rock5 wrote:First you close the loop by adding this to waypoint 4.

Code: Select all

__WPL:setWaypointIndex(1)
Now it will go from waypoint 4 to waypoint 1, excluding waypoint 5.

It looks like it's supposed to go to 5 from 1 so at waypoint one you have to make some sort of decision whether to go to waypoint 5. I'm not sure what that decision is. Maybe if the event is finished or if the PEF frame isn't visible?

So you would add something like this to waypoint 1.

Code: Select all

if isEventFinished() or RoMScript("PEFs:isVisible()") == false then -- under what conditions you want to go to waypoint 5.
    __WPL:setWaypoint(__WPL:findWaypointTag("Home Base"))
end
Probably after you have turned in the quest (BTW you haven't added an accept quest command. I'd just add it after the CompletQuestByName command). If those conditions aren't meet ie. you are still doing the quest, then it will keep going around the loop.

Then at waypoint 5 you want to wait for the event to start and then go back to waypoint 1. If I understand correctly, the PEF frame should reappear when you go to wp 5 so we might not need to add a check for it. So at waypoint 5 I'd just add

Code: Select all

waitForEventStart()
Because waypoint 1 comes after 5, because it's the last, we don't need to add a setWaypointIndex here.

I hope that's clear.
Thankyou Rock! this is exactly what i needed :P
BTW you haven't added an accept quest command. I'd just add it after the CompletQuestByName command
That is because i am using an addon auto accept and auto complete, forgot the name though.

ima try this out and keep you posted.. thanks again



EDIT:
btw what is

Code: Select all

__WPL:setWaypointIndex(1)
?
Set the waypoint # 'number' as next waypoint to reach
i'm not sure if i understood this correctly but is it possible that there would be index(2), index(3), etc..etc.. if i would want to incorporate multiple loops on my wp file?

UPDATE: Thanks Rock! now it works fine so far.. you are right, i don't need a PEF Check on WP_5 because that is also one of the reason i wanted to have that waypoint 5. Pretty sure that this far, the timer will reappear whenever its bugged. And i also don't want to be staying and waiting there for the event to restart along with other botters. Lol it's just like a 1 big family picture! :lol:

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

Re: Script to do a waypoint if the EOJ timer doesn't show?

#17 Post by rock5 » Fri Sep 28, 2012 6:03 am

vo2male wrote:btw what is

Code: Select all

__WPL:setWaypointIndex(1)
?
The loaded waypoints are stored in the table __WPL.

__WPL:setWaypointIndex(index) is a function that sets the next waypoint it will go to as soon as it's finished with the current waypoint. If there are many waypoints then it's hard to tell which is which as the numbers might not match the index number. That's when we use tags.

__WPL:findWaypointTag("tag name") is a function that returns the index of the waypoint with a specific tag, that's one that is has a

Code: Select all

tag="tag name"
So

Code: Select all

__WPL:setWaypointIndex(__WPL:findWaypointTag("tag name"))
will set the next waypoint to the waypoint with the tag name "tag name".
  • 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

Hidden
Posts: 101
Joined: Tue May 08, 2012 6:10 pm

Re: Script to do a waypoint if the EOJ timer doesn't show?

#18 Post by Hidden » Thu Nov 01, 2012 8:20 pm

Thanks Rock,

Was going to ask the same thing only difference being I wanted the script to start if the timer wasn't visible. (have found doing manually that timer appears after clicking the flame again but then it runs straight to wp 1 and gets stuck) I think I have managed to work it out unfortunately I cant test it yet (that quest very busy lately)

Hidden
Posts: 101
Joined: Tue May 08, 2012 6:10 pm

Re: Script to do a waypoint if the EOJ timer doesn't show?

#19 Post by Hidden » Sat Nov 03, 2012 11:15 am

Been trying to implement Rocks code but now get scripts\rom/bot.lua:824: Failed to compile and run Lua code for waypoint #2
Waypoint #2 code works using my other script that doesn't have this new function added.

Trying (with limited success) to get the bot to run the script if the timer isn't visible, i can get it to go for a walk elsewhere till the timer appears but i don't want to do that lol.

Code: Select all

<onload>
    --USER OPTIONS--
    YourTargetScore = 6000
	
	function waitForEventStart()
		repeat
			yrest(1000) -- check every second
			local namePE,messagePE,namePH,ScorePE,Count , IsScoreVisible= RoMScript("PE_GetInfo(1)")
			if Count == 2 and YourTargetScore > ScorePE then break end
		until false
	end

	function isEventFinished()
		local namePE,messagePE,namePH,ScorePE,Count , IsScoreVisible= RoMScript("PE_GetInfo(1)")
		if Count ~= 2 or ScorePE >= YourTargetScore or not PEFisVisible() then
			return true
		else
			return false
		end
	end

	function PEFisVisible()
		return RoMScript("PEFs:isVisible()")
	end
</onload>

    <!-- #  1 --><waypoint x="-21555" z="-22947" y="584" tag="Start">   
	waitForEventStart()
       queststate = getQuestStatus("Extinguish More Flames");
       if queststate == "complete" then
          player:target_NPC("Diandon");
          CompleteQuestByName("Extinguish More Flames");
         yrest(300);
         __WPL:setWaypointIndex(__WPL:findWaypointTag("Main"));
        else
          player:target_NPC("Diandon");
          AcceptQuestByName("Extinguish More Flames","Diandon");
         yrest(300);
    if isEventFinished() or RoMScript("PEFs:isVisible()") == false then 
               __WPL:setWaypointIndex(__WPL:findWaypointTag("Start"));
    end
    </waypoint>
        <!-- #  2 --><waypoint x="-21684" z="-23224" y="581">   
                queststate = getQuestStatus("Extinguish More Flames");
                while queststate == "incomplete" then
                yrest(50);player:target_Object("Strange Flame Seedling");yrest(50);
                queststate = getQuestStatus("Extinguish More Flames");
      end 
      </waypoint>
</waypoints>

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

Re: Script to do a waypoint if the EOJ timer doesn't show?

#20 Post by rock5 » Sat Nov 03, 2012 12:00 pm

The numbering can be off sometimes. I think it counts the onload as a waypoint. So when it says "waypoint #2" it might mean waypoint 1. And I can see waypoint 1 has 2 'if' statements but only 1 'end'.
  • 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 0 guests