Page 1 of 1

Event Monitoring

Posted: Fri May 17, 2013 9:07 pm
by ZZZZZ
Hey, I have never worked with event monitoring before and looking over past threads I have put what I thought was correct into my goblins waypoint, but all it does is return false and runs endlessly between the 2 waypoint direction changes.

Code: Select all

	<!-- #  5 --><waypoint x="3662" z="3163" y="248">		getTreasureChest()
	__WPL:setForcedWaypointType("NORMAL");
	EventMonitorStart("Earth Chest", "CHAT_MSG_SYSTEM");
	</waypoint>
	<!-- #  6 --><waypoint x="3682" z="3116" y="248">	changeProfileOption("MAX_TARGET_DIST", 150);
	__WPL:setDirection(WPT_FORWARD);
	</waypoint>
	<!-- #  7 --><waypoint x="3733" z="2993" y="248">	</waypoint>
	<!-- #  8 --><waypoint x="3765" z="2898" y="248">	</waypoint>
	<!-- #  9 --><waypoint x="3753" z="2821" y="248">	</waypoint>
	<!-- # 10 --><waypoint x="3709" z="2740" y="248">	</waypoint>
	<!-- # 11 --><waypoint x="3631" z="2664" y="248">	local time, moreToCome, msg = EventMonitorCheck("Earth Chest", "1")
	if string.find(msg, "earth furnace") then
	EventMonitorStop("Earth Chest");
	changeProfileOption("MAX_TARGET_DIST", 50);
			else
	__WPL:setDirection(WPT_BACKWARD);
	end
	</waypoint>
Any help would be great because i wouldnt have a clue lol.

Re: Event Monitoring

Posted: Fri May 17, 2013 11:33 pm
by kenzu38
Add a print on what msg it catches.

Code: Select all

if msg ~= nil then
print(msg.."\n")
end
And then make sure you got the capital letters right, as far as I remember string.find is case-sensitive.

And thirdly, your gettreasurechest() function, is it also monitoring something? Might be the one conflicting with your other event monitor.

Re: Event Monitoring

Posted: Fri May 17, 2013 11:52 pm
by rock5
If your close enough to see the chest, why not just check if the chest exists?

Code: Select all

if player:findNearestNameOrId(chestIdOrName) then
   changeProfileOption("MAX_TARGET_DIST", 50);
else
   __WPL:setDirection(WPT_BACKWARD);
end