Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function refuel()
- for i = 1, 16 do -- loop through the slots
- turtle.select(i) -- change to the slot
- if turtle.refuel(0) then -- if it's valid fuel
- turtle.refuel() -- consume half the stack as fuel
- end
- end
- turtle.select(1)
- end
- function wall()
- term.clear()
- print("Enter length of wall")
- wallLength = tonumber(read()) --Gets wall Length from user
- print("Enter height of wall")
- wallHeight = tonumber(read()) --Gets wall height from user
- switchCheck = false
- startCheck = true
- cobbleCount = 0
- invCount = 1
- for i = 1, 16 do -- loop through the slots and get cobblestone
- turtle.select(i)
- turtle.suckDown(64)
- end
- turtle.select(invCount)
- for a = 1,wallHeight do
- if startCheck == false then
- turtle.forward()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.up()
- else
- startCheck = false;
- end
- for b = 1,wallLength do
- if cobbleCount > 64 then
- invCount = invCount + 1
- turtle.select(invCount)
- cobbleCount = 0
- end
- turtle.forward()
- turtle.placeDown()
- cobbleCount = cobbleCount + 1
- end
- end
- turtle.forward()
- turtle.forward()
- for i = 1, wallHeight do
- turtle.down()
- end
- end
- function platform()
- --Platform Builder
- term.clear()
- print("Enter length (forward) of platform size.")
- Length = tonumber(read())
- print("Enter width (to right) of platform size.")
- Width = tonumber(read())
- switchCheck = false
- startCheck = true
- cobbleCount = 0
- invCount = 1
- for i = 1, 16 do -- loop through the slots and get cobblestone
- turtle.select(i)
- turtle.suckDown(64)
- end
- turtle.forward()
- turtle.down()
- --Width Loop
- for c = 1, Width do
- turtle.select(invCount) --Make sure the slot has cobble
- if startCheck == false then --Check Startup
- if switchCheck == false then
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- turtle.forward()
- switchCheck = true
- else if switchCheck == true then
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- switchCheck = false
- end
- end
- else
- startCheck = false;
- print("startCheck removed.")
- end
- --Length loop
- for d = 1, Length do
- turtle.placeDown()
- turtle.forward()
- cobbleCount = cobbleCount + 1
- if cobbleCount == 64 then --Makes sure it has cobble
- invCount = invCount + 1
- turtle.select(invCount)
- cobbleCount = 0
- end
- end
- end -- ends loop
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- print("Done!")
- -- ends program
- end
- print("Welcome to the RUSCOM MagicBuilder.") --BEGIN USER INPUT
- print("Commands: 'refuel' , 'platform' , 'wall'")
- command = read() --Gets user input
- if command == "refuel" then --Finds out what the user wants
- refuel()
- elseif command == "platform" then
- platform()
- elseif command == "wall" then
- wall()
- end
- shell.run("reboot") --Reboots computer back to menu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement