this might be an odd question, but how many times can os.pullEvent() can be called?
20 times in a second, based on the minecraft game ticks?
Basically, i am having an os.startTimer(0.1) running all the time, catching and freshing it with os.pullEvent every time.
local delay = os.startTimer(0.1)
while true do
local e = { os.pullEvent() }
if e[1] == "timer" and e[2] == delay then
delay = os.startTimer(0.1)
end
sleep(0)
end
That works!
Furthermore, i am receiving rednet messages (up to 4 per second in the final program i think) and catch them with the same os.pullEvent()
local delay = os.startTimer(0.1)
while true do
local e = { os.pullEvent() }
if e[1] == "timer" and e[2] == delay then
delay = os.startTimer(0.1)
elseif e[1] == "rednet_message" then
-- checking if the message is correct, saving information in an array as well as saving it into a file if the chunk gets unloaded
end
sleep(0)
end
It allmost every time stops my timer now when i am receiving a rednet message.
If there can only be every 0.05 seconds an os.pullEvent() activated then i am only having 20 actions per seconds to work with.
If this is true a solution would be pulling the timer every 0.05 seconds and refreshing the timer when a rednet message gets received as well. This would take a while to implement so i ask first here.
Let me know if someone knows more about it.
Thanks
unobtanium