Monitor chat ... if event XYZ, then load WP/file

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Message
Author
User avatar
Edamh
Posts: 106
Joined: Tue May 24, 2011 11:56 pm

Re: Monitor chat ... if event XYZ, then load WP/file

#21 Post by Edamh » Sat Nov 17, 2012 12:21 am

rock5 wrote:Just because it keeps printing that message doesn't necessarily mean it's stuck in that loop. It might be stuck somewhere else and the timed event is doing it's thing every second. Where did you start monitoring the event? How did you start it? If you comment out the line that starts the monitor does it still get stuck?
Here's how it looks:

Code: Select all

   <!-- #  1 --><waypoint x="-1" z="-1" y="1" type="TRAVEL" tag="START">
--   startEVENTDetect()
   player:mount();
   player:target_NPC("NPCName");
   yrest(100);
   AcceptQuestByName("QuestName");
   yrest(100);
   </waypoint>
If I comment out the line that starts the monitor, the WP file runs as expected.

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

Re: Monitor chat ... if event XYZ, then load WP/file

#22 Post by lisa » Sat Nov 17, 2012 12:35 am

is there just 1 waypoint?
If so that would explain it, the startEVENTDetect is being called repeatedly, try putting that in the onload. The timer will take care of the rest, so only needs calling once.
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

User avatar
Edamh
Posts: 106
Joined: Tue May 24, 2011 11:56 pm

Re: Monitor chat ... if event XYZ, then load WP/file

#23 Post by Edamh » Sat Nov 17, 2012 1:55 am

There are 8 waypoints. #1-5 loop through area; #6-8 are for walking to rest/sleep area.

Moving the startEVENTDetect() to the onload produces same wall of yellow printscrns.

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

Re: Monitor chat ... if event XYZ, then load WP/file

#24 Post by lisa » Sat Nov 17, 2012 2:58 am

try changing it to

Code: Select all

until msg == nil
At some stage I started to use that instead of the until moretocome == false, can't remember why.
Edamh wrote:There are 8 waypoints. #1-5 loop through area; #6-8 are for walking to rest/sleep area.
so you also want to stop and start the event monitoring at different waypoints?

Also try adding in a little yrest inside the loop
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

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

Re: Monitor chat ... if event XYZ, then load WP/file

#25 Post by rock5 » Sat Nov 17, 2012 3:22 am

I think the problem is, even though moreToCome will be true if there are more to come, it won't necessarily be false if there isn't.

Try changing

Code: Select all

until moreToCome == false
to

Code: Select all

until moreToCome ~= true
  • 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
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Monitor chat ... if event XYZ, then load WP/file

#26 Post by lisa » Sat Nov 17, 2012 3:45 am

rock5 wrote:I think the problem is, even though moreToCome will be true if there are more to come, it won't necessarily be false if there isn't.
That is probably why I started to use until msg == nil
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

User avatar
Edamh
Posts: 106
Joined: Tue May 24, 2011 11:56 pm

Re: Monitor chat ... if event XYZ, then load WP/file

#27 Post by Edamh » Sat Nov 17, 2012 8:52 am

rock5 wrote:I think the problem is, even though moreToCome will be true if there are more to come, it won't necessarily be false if there isn't.

Try changing

Code: Select all

until moreToCome == false
to

Code: Select all

until moreToCome ~= true
Changing the code to

Code: Select all

until moreToCome ~= true
did the trick. Thank you for the help.


Here's the code that I'm using now:

Code: Select all

<onload>
function EVENTdetection()
	repeat
	cprintf(cli.yellow,"Inside EVENTdetection function; inside repeat ... until \n");
	yrest(300);
	local time, moreToCome, name, msg = EventMonitorCheck("EVENTdetect", "4,1") 
	if msg ~= nil then
		if string.find(msg,"EventSTART") then
			cprintf(cli.lightblue,"EventSTART received in PARTY chat. \n");
			__WPL:setWaypointIndex(__WPL:findWaypointTag("START"));
			partyCHATmsg = "EventSTART"
		end
		if string.find(msg,"EventSTOP") then
			cprintf(cli.lightblue,"EventSTOP received in PARTY chat. \n");
			__WPL:setWaypointIndex(__WPL:findWaypointTag("Home Base"));
			partyCHATmsg = "EventSTOP"
		end
	end
	until moreToCome ~= true
end
function startEVENTDetect()
      unregisterTimer("EVENTdetection");
      printf("EVENT detection started\n");
      EventMonitorStart("EVENTdetect", "CHAT_MSG_PARTY");
      registerTimer("EVENTdetection", secondsToTimer(1), EVENTdetection);
end
startEVENTDetect()
</onload>

Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests