Jump to content




Garbage Disposal System

utility

  • You cannot reply to this topic
2 replies to this topic

#1 MeLike2D

  • Members
  • 3 posts

Posted 01 January 2018 - 02:21 AM

Garbage Disposal

https://www.youtube....h?v=oj59I_gXWm8

This is a fun Program

Watch The vid or setup

https://pastebin.com/nDzPCRn0

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 by MeLike2D, 15 January 2018 - 10:12 PM.


#2 ardera

  • Members
  • 503 posts
  • LocationGermany

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 MeLike2D

  • Members
  • 3 posts

Posted 15 January 2018 - 10:09 PM

View Postardera, on 05 January 2018 - 07:24 PM, said:

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)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users