Page 1 of 1

check if player is online?

Posted: Fri May 17, 2013 1:50 am
by acrata
hello, I want to know if there is a function or any way to check if bot is online, because when I am using bot and my connection fails player is disconnected to the main screen and bot doesn't give any error.
Please excuse my poor English.

Re: check if player is online?

Posted: Fri May 17, 2013 10:44 am
by kenzu38
Don't know if there's a built-in function for this or if there are other simpler codes to do this but the code below is what I use for my script and it works.

Code: Select all

				
EventMonitorStart("CharDetect", "CHAT_MSG_SYSTEM");
RoMScript("AskPlayerInfo('put the name of the char you want to check here');")
yrest(1500)
local time, moreToCome, msg = EventMonitorCheck("CharDetect", "1")
EventMonitorStop("CharDetect")
if string.find(msg,"offline") then
-- char is offline put what you want to do here
end

Re: check if player is online?

Posted: Fri May 17, 2013 6:14 pm
by lisa
When the bot gets disconnected it would usually cause an error, for it not to error that means it is probably in a loop at the time.

What waypoint file are you using at the time?

Re: check if player is online?

Posted: Fri May 17, 2013 6:59 pm
by acrata

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
	<!-- #  1 --><waypoint x="-10064" z="-7273" y="888">	</waypoint>
	<!-- #  2 --><waypoint x="-9908" z="-7132" y="842">	</waypoint>
	<!-- #  3 --><waypoint x="-9710" z="-7318" y="836">	</waypoint>
	<!-- #  4 --><waypoint x="-9570" z="-7488" y="867">	</waypoint>
	<!-- #  5 --><waypoint x="-9465" z="-7741" y="858">	</waypoint>
	<!-- #  6 --><waypoint x="-9669" z="-7364" y="848">	</waypoint>
	<!-- #  7 --><waypoint x="-9844" z="-7145" y="824">	</waypoint>
</waypoints>
that is the waypoint, im just use it for farm activation runes