Hi, I'm recently new to OC and am working on porting some of my older programs from CC. I have this simple reactor program that has a few pull events. Issue I'm having is that the pull event freezes the loop until an event happens. I tried to get around this using a timer, but it doesn't seem to work the same as CC. How can I use pull events without freezing my loop?
local name, _, x, y = event.pull("touch")
if y == 1 and x < 30 and x > 18 and reactorOnline then
r.setActive(false)
elseif y == 1 and x < 30 and x > 21 then
r.setActive(true)
elseif y == 8 and x == 21 or x == 22 then
r.setAllControlRodLevels(rodLevel - 10)
elseif y == 8 and x == 28 or x == 29 then
r.setAllControlRodLevels(rodLevel + 10)
end
os.sleep(0.1)
end
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Hi, I'm recently new to OC and am working on porting some of my older programs from CC. I have this simple reactor program that has a few pull events. Issue I'm having is that the pull event freezes the loop until an event happens. I tried to get around this using a timer, but it doesn't seem to work the same as CC. How can I use pull events without freezing my loop?
Full Code (Events at bottom)
Pull Event
local name, _, x, y = event.pull("touch") if y == 1 and x < 30 and x > 18 and reactorOnline then r.setActive(false) elseif y == 1 and x < 30 and x > 21 then r.setActive(true) elseif y == 8 and x == 21 or x == 22 then r.setAllControlRodLevels(rodLevel - 10) elseif y == 8 and x == 28 or x == 29 then r.setAllControlRodLevels(rodLevel + 10) end os.sleep(0.1) end
Any help and/or OC advice is appreciated! Thanks!
Link to post
Share on other sites