Page 1 of 1

EventMonitorStart problem

Posted: Thu Jul 16, 2015 2:44 pm
by Stionowl1943
Hi, i have problem with EventMonitor.
Normally i use that in that way:

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<onLoad>

EventMonitorStart("Event", "CHAT_MSG_YELL");

function pingrom()
	ping = RoMScript("GetPing()")
	if ping == nil then
		yrest(60000)
		repeat
			yrest(5000)
			local pingserver = system("ping xxx.xxx.xxx.xxx -n 1")
		until string.find(pingserver, "Lost = 0")
		print("NET ON")
		reloginwin(CurrentLoginChar,CurrentLoginAcc)
		load_paths("thiswaypoint.xml")
	end
end

while (true) do
	pingrom()
	local time, moreToCome, charname, msg = EventMonitorCheck("Event", "4,1")
	if msg ~= nil then
		print(msg)
	end
end
</onLoad>
</waypoints>
but after client disconnecter and autologin to game i receive:
Image

How correctly fix that?

Re: EventMonitorStart problem

Posted: Thu Jul 16, 2015 4:10 pm
by BlubBlab
Yeah because the event isn't part of the ROM client anymore.
You have to write your waypoint file so that it make sure that it is there again.

Re: EventMonitorStart problem

Posted: Thu Jul 16, 2015 4:36 pm
by Stionowl1943
You mean when i use waypoint file it must work?
Now is correctly?

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<onLoad>

EventMonitorStart("Event", "CHAT_MSG_YELL");

function pingrom()
   ping = RoMScript("GetPing()")
   if ping == nil then
      yrest(60000)
      repeat
         yrest(5000)
         local pingserver = system("ping xxx.xxx.xxx.xxx -n 1")
      until string.find(pingserver, "Lost = 0")
      print("NET ON")
      reloginwin(CurrentLoginChar,CurrentLoginAcc)
      load_paths("thiswaypoint.xml")
   end
end
</onLoad>

<!-- #  1 --><waypoint x="-" z="-" y="">
   pingrom()
   local time, moreToCome, charname, msg = EventMonitorCheck("Event", "4,1")
   if msg ~= nil then
      print(msg)
   end
</waypoint>
</waypoints>

Re: EventMonitorStart problem

Posted: Fri Jul 17, 2015 4:42 pm
by BlubBlab
I think maybe you should use an player:update() , the first version seems more correct because an waypoint without coordinates can be pushed to the side by rombot now.

Re: EventMonitorStart problem

Posted: Fri Jul 17, 2015 8:04 pm
by Stionowl1943
1 # Method with waypoint file.
Doesnt work.
After disconnect i see only in console window:
[6] = "Moving to waypoint...",

2 # Method player:update()
Doesnt work.
I receive the same message like before.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints type="TRAVEL">
<onLoad>
player:update()
EventMonitorStart("Event", "CHAT_MSG_YELL");

function pingrom()
   ping = RoMScript("GetPing()")
   if ping == nil then
      yrest(60000)
      repeat
         yrest(5000)
         local pingserver = system("ping xxx.xxx.xxx.xxx -n 1")
      until string.find(pingserver, "Lost = 0")
      print("NET ON")
      reloginwin(CurrentLoginChar,CurrentLoginAcc)
      loadPaths("thiswaypoint.xml")
   end
end

while (true) do
	player:update()
   pingrom()
   local time, moreToCome, charname, msg = EventMonitorCheck("Event", "4,1")
   if msg ~= nil then
      print(msg)
   end
end
</onLoad>
</waypoints>

btw. when i try put EventMonitorStart("Event", "CHAT_MSG_YELL"); in while (true) do section, it work but catch only 30% of messages.


Ok, i think i found way!

Code: Select all

loadPaths("thiswaypoint.xml")
EventMonitorStart("Event", "CHAT_MSG_PARTY");

Re: EventMonitorStart problem

Posted: Sat Jul 18, 2015 7:57 pm
by lisa
The issue is that you are loading the same WP in an onload only WP, remove the loadpath and just keep using the same WP after changing char/reclogging.

Which of course means that you need to start monitoring again after the client has restarted.