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

Hopper turtle

Started by immibis, 08 January 2013 - 07:22 PM
immibis #1
Posted 08 January 2013 - 08:22 PM
This program makes a turtle act like a BC hopper that has more slots and moves a stack at a time.
RP2 relays are better than BC hoppers, but they're harder to craft and still have smaller inventories.

Code on pastebin

Usage: Place turtle above machine, run 'pastebin get 3Wv6wZAK startup', connect turtle to pipes. You can of course change dropDown to dropUp or drop to change the side.
unobtanium #2
Posted 12 January 2013 - 12:41 PM
Neat! But i think the hopper are still better because of the fact that you have to restart your program manually after the Turtle gets into a unloaded chunk. The hopper will keep restart his work from alone :/
Orwell #3
Posted 12 January 2013 - 12:48 PM
Neat! But i think the hopper are still better because of the fact that you have to restart your program manually after the Turtle gets into a unloaded chunk. The hopper will keep restart his work from alone :/
When you set it as the startup program of the turtle, it will restart when the chunk gets loaded again, right?
unobtanium #4
Posted 12 January 2013 - 01:04 PM
Meeeh! But i am too dumb to do that ;D

edit: You can shutdown/pause the hopper by a redstone signal. Might be a new update worth? :P/>
Kingdaro #5
Posted 12 January 2013 - 01:07 PM
I would say this is useless, except for the fact that a turtle's inventory is way larger than that of a hopper's, and you can actually use it for more than just as a hopper. I might use this sometime.

Also, it'd be pretty cool if you could maybe specify the sides you want it to drop to (if one side is full) in the form of command arguments, or maybe some sort of GUI.
gknova61 #6
Posted 13 January 2013 - 11:06 AM
edit: You can shutdown/pause the hopper by a redstone signal. Might be a new update worth? :P/>/>/>
Be something like this
Spoiler

function pause(timer)
    if timer then
        os.startTimer(5)
    end
  while true do
      local event = {os.pullEvent()}
      if event[1] == "redstone" then
          if not rs.getInput("back") then
              return
          end
      elseif event[1] == "timer" then
          return
      end
 end
end

while true do
 local empty = true
 for k=1,16 do
  if turtle.getItemCount(k) > 0 then
   empty = false
   turtle.select(k)
   turtle.dropDown()
   local doIt = math.modf((i/2))
   if doIt[2] == 0 and if rs.getInput("back") then pause(false)
   end
   end     
 end
 if empty then pause(true)
end
end
xInDiGo #7
Posted 15 January 2013 - 05:34 PM
i'd like to see the turtle checking in boxes above it for more stuff. if i could put as much ore as i wanted in the chest above him, and it just keeps taking it out, filling its inventory, and then dumping it below. if the inventory is full then drop below, if false, sleep. if inventory is empty suckup, if false then sleep. somebody implement that!
Bubba #8
Posted 15 January 2013 - 05:56 PM
i'd like to see the turtle checking in boxes above it for more stuff. if i could put as much ore as i wanted in the chest above him, and it just keeps taking it out, filling its inventory, and then dumping it below. if the inventory is full then drop below, if false, sleep. if inventory is empty suckup, if false then sleep. somebody implement that!

Err… pardon me if I misunderstood what you are saying, but wouldn't it just be easier to directly put items into the chest? I know that I sometimes get too caught up in "automating" the process when in reality all I'm doing is over-complicating things. Unless the turtle is sorting the items that you put into the chest, there's little purpose in it just taking the items directly from a chest above it and putting them into one below other than expensive extra storage space.
xInDiGo #9
Posted 15 January 2013 - 07:48 PM
sorry if i wasn't very clear. lets say below the turtle is an actual hopper, above it a turtle, and above the turtle a chest. the turtle would try to load the hopper w/ its own inventory. if it can't, then it would wait. if it can dump its inventory, and has open space, it will try to get the item from the chest above it. i hope i was a bit more clearer this time around

::edit:: i just realized that maybe hoppers already pull things from a chest, which i haven't tried yet. :P/>