Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Log making machine CC script by Scott Hather (Satscape)
- -- Obviously you need to build the machine and wire it up the
- -- same as mine, otherwise this program won't work, I've shared it
- -- simply as an example of how to use CC to control RP2 machines.
- -- See my video tutorials on youtube.com/SatscapeMinecraft
- -- 1=sapling (white) 2=bonemeal (orange) 4=igniter (magenta)
- -- 8=sand deploy (L blue) 16=break tree (yellow)
- -- 32=empty chest(lime) 64=piston (pink)
- -- we send signals down the bundled cable a lot, so
- -- here's a helper function
- function send(bin, delay)
- rs.setBundledOutput("back",bin) --cable is on the back of computer
- os.sleep(delay)
- rs.setBundledOutput("back",0)
- os.sleep(delay)
- end
- --another helper to display what's happening
- function status(t)
- term.clear()
- term.setCursorPos(3,3)
- term.write(t)
- end
- -- the big infinite loop (control t to exit)
- while true do
- status("Planting tree")
- send(1,0.5) -- plant sapling
- send(2,0.5) -- apply bonemeal
- status("Harvesting tree")
- for x=1,9 do
- send(16,0.5) -- break bottom of tree
- send(8,0.5) -- deploy sand
- send(64,0.5) -- push down sand with piston
- end
- status("Cleaning up")
- for x=1,10 do
- send(16,0.5) -- clear away remaining sand
- end
- status("Dispatching logs")
- for x=1,30 do
- send(32,0.1) -- empty chest of logs and sand
- end
- status("Burning leafs")
- rs.setBundledOutput("back",4) -- ignite the leafs
- os.sleep(40)
- send(0,1.0)
- status("Resetting")
- os.sleep(40)
- -- ask the turtle to tidy up the saplings (see turtleTidy script)
- status("Turtle tidying")
- rednet.open("left")
- os.sleep(1)
- rednet.broadcast("turtle tidy")
- os.sleep(1)
- rednet.close("left")
- os.sleep(10) --give the turtle enough time to tidy up
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement