Okay, so I posted this in another thread
http://www.solarstrike.net/phpBB3/viewt ... 811#p41811 but it really has more applicability to EOJ events so I want it here.
Was mincing between Lisa's "LOL" eventmonitortest and an attempt to --make it work-- with monitoring system chat and then I stumbled on this post.
This works fine but I want to try something else, further down
Code: Select all
<!-- # 1 --><waypoint x="-18556" z="-18129" y="999"> EventMonitorStart("Test", "CHAT_MSG_SAY");
sendMacro("SendChatMessage('LOL','SAY');")
yrest(1000)
local time, moreToCome, msg = EventMonitorCheck("Test", "1") if string.find(msg, "LOL") then printf("Event monitoring works fine.\n")
player:sleep()
end
</waypoint>
</waypoints>
The code below gives a string error. Studied a bit and learned string.find is looking for the text. Unfortunately it doesn't seem like the system chat gets logged the same OR (more likely) I'm assigning the event monitor incorrectly. I read about EventMonitorCheck saving to a log... is this a real-time log or is it saved somewhere I can view?
Code: Select all
<!-- # 1 --><waypoint x="-18556" z="-18129" y="999"> EventMonitorStart("Test", "CHAT_MSG_SYSTEM");
sendMacro("SendSystemChat(PE_GetPOBInfo( 1 , 0 ),'SYSTEM');")
yrest(1000)
local time, moreToCome, msg = EventMonitorCheck("Test", "1")
if string.find(msg, "Time remaining") then
printf("Event monitoring works fine.\n")
player:sleep()
end
</waypoint>
</waypoints>
Another swing and a miss as I tried to make the code look more like yours LOL
Code: Select all
<!-- # 1 --><waypoint x="-18556" z="-18129" y="999"> EventMonitorStart("Test", "CHAT_MSG_SYSTEM");
sendMacro("SendSystemChat(PE_GetPOBInfo( 1 , 0 ),'SYSTEM');")
yrest(1000)
local time, moreToCome, msg = EventMonitorCheck("Test", "1") if string.find(msg, "PE_GetPOBInfo( 1 , 0 )") then printf("Event monitoring works fine.\n")
player:sleep()
end
</waypoint>
</waypoints>
So now, after reading this
http://www.solarstrike.net/phpBB3/viewt ... 811#p41811 thread it looks like my solution is this?
Code: Select all
</onLoad>
function EVENTdetection()
repeat
local time, moreToCome, name, msg = EventMonitorCheck("EVENTdetect", "4,1")
if msg ~= nil then
if string.find(msg,"Positive Effect") then
__WPL:setWaypointIndex(__WPL:findWaypointTag("START"));
end
if string.find(msg,"Time remaining") then
__WPL:setWaypointIndex(__WPL:findWaypointTag("GOTOSLEEP"));
end
end
until moreToCome == false
end
function startEVENTDetect()
unregisterTimer("EVENTdetection");
printf("EVENT detection started\n");
EventMonitorStart("EVENTdetect", "CHAT_MSG_SYSTEM");
registerTimer("EVENTdetection", secondsToTimer(5), EVENTdetection);
end
startEVENTDetect()
</onLoad>
And then at a WP
Code: Select all
<!-- # 1 --><waypoint x="-18556" z="-18129" y="999">
sendMacro("SendSystemChat(PE_GetPOBInfo( 1 , 0 ),'SYSTEM');")
yrest(100)
EVENTdetection()
</waypoint>
</waypoints>
So I changed the system message to look for above to "Positive Effect" and "Time remaining" based on what I know "sendMacro("SendSystemChat(PE_GetPOBInfo( 1 , 0 ),'SYSTEM');")" will return in the system chat window.
Once startEVENTDetect() is initiated in the /onLoad section do I need to call it again at a specific WP or does it just run continually as long as the WP is running?
Problem has been with actually getting the response I want out of system chat messages. The isEventFinished and IsScoreVisible stuff isn't working like I expected it to so I moved into trying the above.
The waitforevent function works great though. Probably my lack of understanding what's going on with the math... ~=1 or... ==2 or... ~=nil... or what those numbers even mean or how they are calculated.
Thx again and again