looking to make the line below always active without just encapsulation my entire program inside of it
if rs.getInput ("top") = true then os.reboot
i realize that's not quite right, i am just trying to supply the simple example of what I've been trying to do.
I want to have a block on top of my computer with a button on the front, I want it to reboot my computer at any point in the program.
I was thinking something with parallel but I haven't gotten it to work yet.
always active 'reboot' button using bundle redstone input
Started by Andale, Jan 16 2013 05:34 PM
5 replies to this topic
#1
Posted 16 January 2013 - 05:34 PM
#2
Posted 16 January 2013 - 05:36 PM
function main()
-- other code here
end
function listener()
while true do
if rs.getInput("top") then
os.reboot()
end
sleep(0)
end
end
parallel.waitForAll( listener, main )
#3
Posted 16 January 2013 - 05:38 PM
Would have to see your code to help you implement it.
One way if you've got a os.pullEvent() driven menu is pretty much do just as you have in you're post.
Depending on the rest of the code the parallel may not be needed, it would be better to handle this within an if statement.
One way if you've got a os.pullEvent() driven menu is pretty much do just as you have in you're post.
local e,p1 = os.pullEvent()
if e == "redstone" then
if rs.getInput("top") then
os.reboot()
end
end
TheOriginalBIT, on 16 January 2013 - 05:36 PM, said:
function main()
-- other code here
end
function listener()
while true do
if rs.getInput("top") then
os.reboot()
end
sleep(0)
end
end
parallel.waitForAll( listener, main )
Depending on the rest of the code the parallel may not be needed, it would be better to handle this within an if statement.
#5
Posted 16 January 2013 - 05:54 PM
well, its far from finished and i wanted this for two other project ideas. This one is just an external reboot because I'm editing a startup on a disk from another computer so i can work from a view of the screen. Me being lazy, but only in this instance, I will actually need it for the others which will rely heavily on pullevents to do button presses. ie; press 'c' to continue. Thank you guys.
#6
Posted 16 January 2013 - 06:18 PM
Andale, on 16 January 2013 - 05:54 PM, said:
well, its far from finished and i wanted this for two other project ideas. This one is just an external reboot because I'm editing a startup on a disk from another computer so i can work from a view of the screen. Me being lazy, but only in this instance, I will actually need it for the others which will rely heavily on pullevents to do button presses. ie; press 'c' to continue. Thank you guys.
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users











