This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
MeLike2D's profile picture

Garbage Disposal System

Started by MeLike2D, 01 January 2018 - 01:21 AM
MeLike2D #1
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
ardera #2
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 ;)/>
MeLike2D #3
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)