function chksvr(sendchan,svrnum,gettmout)
send(sendchan,2,"ping")
get(2,gettmout)
if success==1 then
screen.setCursorPos(1,svrnum+2)
w("Server "..svrnum..": Online")
end
if success==0 then
screen.setCursorPos(1,svrnum+2)
w("Server "..svrnum..": DOWN")
end
--sleep(5)
end
It basically sends a ping to a server, and listens real quick for a return ping.
I modified it so that the timer can only run if key is 1 and it still seems to freaking run chksvr…
function main()
key=1
while true do
if key==1 then
timeout2 = os.startTimer(.5)
end
eventData = {os.pullEvent()}
if eventData[1] == "stop_main" then
key=0
return
elseif eventData[1] == "timer" and eventData[2] == timeout2 then
--Server Checks/Screen
chksvr(1,1,2)
chksvr(3,2,2)
chksvr(5,3,2)
--Power system checks/screen
--Screen choice chk
end
end
end
It's as if it never sees the stop_main event…
I've found the issue, but not the solution:
It seems increasing the timer to the amount of time it takes to shutdown, allows it to see the event. it's as if the timer event is overwriting the stop_main event.