3 posts
Posted 01 January 2018 - 02:21 AM
Garbage Disposal
This is a fun Program
Watch The vid or setup
pastebin get nDzPCRn0 GarbageDisposal
term.clear()
term.setCursorPos(1,1)
TimerSide = "left"
HopperLockSide = "top"
ComparatorInSide = "bottom"
while true do
if rs.getInput(ComparatorInSide, true) then
rs.setOutput(HopperLockSide, true)
rs.setOutput(TimerSide, true)
sleep(6)
rs.setOutput(HopperLockSide, false)
rs.setOutput(TimerSide, false)
else
print("No Input")
sleep(2)
end
end
Edited on 15 January 2018 - 09:12 PM
463 posts
Location
Germany
Posted 05 January 2018 - 07:24 PM
It's probably not a good idea to have the program execute itself when there's no input. This recursion will eventually lead to a stack overflow exception.
You can only have 250 functions running at the same time (per coroutine). So when your program runs itself, it will eventually "fill up" these 250 functions and there will be an ArrayIndexOutOfBounds exception.
An easy fix would be to just delete the line where it says 'shell.run("GarbageDisposal")'
Apart from that, it's not bad for a first program ;)/>
3 posts
Posted 15 January 2018 - 10:09 PM
It's probably not a good idea to have the program execute itself when there's no input. This recursion will eventually lead to a stack overflow exception.
You can only have 250 functions running at the same time (per coroutine). So when your program runs itself, it will eventually "fill up" these 250 functions and there will be an ArrayIndexOutOfBounds exception.
An easy fix would be to just delete the line where it says 'shell.run("GarbageDisposal")'
Apart from that, it's not bad for a first program ;)/>
Thanks for the tip, I will fix it in a while, PS: Not my first program ( just a nick picky thing)