Hi everyone,
I have borrowed from my industrial experience and created a control loop to control one of my bots. I can probably just put this into a loop but I chose to make it a tail call since there's no penalty for that in Lua.
I have also asked this question on http://stackoverflow.com/q/33161999/759749 but in the event that it is not Lua, but an interaction with Mushclient that is causing the problem I thought I'd post here.
In essence the idea is that on login I call my control function and it runs continuously until the character logs out. In between I can manually run commands or other triggers may be processed. I want it to run about every 10 seconds but unlike just calling this from an alarm I get a guarantee that I will not have multiple simultaneous instances running if some command hangs.
What happens now is that the system becomes utterly unresponsive and no output is produced. I'm looking for a blocking/non-busy wait for the sleep function and also an io flush for world.send or world.note
Thanks
I have borrowed from my industrial experience and created a control loop to control one of my bots. I can probably just put this into a loop but I chose to make it a tail call since there's no penalty for that in Lua.
I have also asked this question on http://stackoverflow.com/q/33161999/759749 but in the event that it is not Lua, but an interaction with Mushclient that is causing the problem I thought I'd post here.
In essence the idea is that on login I call my control function and it runs continuously until the character logs out. In between I can manually run commands or other triggers may be processed. I want it to run about every 10 seconds but unlike just calling this from an alarm I get a guarantee that I will not have multiple simultaneous instances running if some command hangs.
function myFunc ()
-- do some stuff
-- lots of snazzy logic and function calls
-- heck, throw in a few prints
print "Going to sleep"
-- sleep for a bit
os.execute("sleep 10")
print "Waking up"
-- tail call
return myFunc()
end
What happens now is that the system becomes utterly unresponsive and no output is produced. I'm looking for a blocking/non-busy wait for the sleep function and also an io flush for world.send or world.note
Thanks