Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --------------------------------------------------------------------------------------------------
- -- ___ ___ __ ____________ __ ___ ___ __ --
- -- |:| /:/ /::\ |::::::::::| /::\ |::\ /::| /::\ --
- -- |:| /:/ /::::\ |::/¨¨¨¨¨¨¨¨ /::::\ |:::\ /:::| /::::\ --
- -- |:| /:/ /::/\::\ |::| /::/\::\ |::::\/::::| /::/\::\ --
- -- |:|/:/ /::/__\::\ |::\________ /::/__\::\ |::|\::/|::| /::/__\::\ --
- -- |:|\:\ /::/::::\::\ |::::::::::| /::/::::\::\ |::| \/ |::| /::/::::\::\ --
- -- |:| \:\ /::/¨¨¨¨¨¨\::\ ¨¨¨¨¨¨¨¨\::| /::/¨¨¨¨¨¨\::\ |::| |::| /::/¨¨¨¨¨¨\::\ --
- -- |:| \:\ /::/ \::\ /::| /::/ \::\ |::| |::| /::/ \::\ --
- -- |:| \:\ /::/ \::\ |::::::::::| /::/ \::\ |::| |::| /::/ \::\ --
- -- ¨¨¨ ¨¨¨ ¨¨¨ ¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨ ¨¨¨ ¨¨¨¨ ¨¨¨¨ ¨¨¨ ¨¨¨ --
- ----------------------------------------------------------------------------------------Scripts---
- -- joypad turtle
- local forward = 200 --/\
- local back = 208 -- \/
- local left = 203 -- <
- local right = 205 -- >
- local up = 57 -- Space
- local down = 42 -- Left Shift
- local dig = 36 -- J
- local digUp = 22 -- U
- local digDown = 49 -- N
- local place = 37 -- K
- local placeUp = 23 -- I
- local placeDown = 50 -- M
- local refuel = 19 -- R
- local select = 31 -- S
- local swap = 17 -- W
- local esc = 1 -- Esc
- local current = 1 -- Keep track of the selected slot
- turtle.select(1)
- --lots of ifs
- while true do
- event, scancode = os.pullEvent("key")
- if scancode == forward then
- x = turtle.forward()
- if x then
- print "Moved Forward"
- else
- print "Couldn't Move"
- if turtle.getFuelLevel() == 0 then
- print "Out of Fuel"
- end
- end
- elseif scancode == back then
- x = turtle.back()
- if x then
- print "Moved Backward"
- else
- print "Couldn't Move"
- if turtle.getFuelLevel() == 0 then
- print "Out of Fuel"
- end
- end
- elseif scancode == up then
- x = turtle.up()
- if x then
- print "Moved Upward"
- else
- print "Couldn't Move"
- if turtle.getFuelLevel() == 0 then
- print "Out of Fuel"
- end
- end
- elseif scancode == down then
- x = turtle.down()
- if x then
- print "Moved Downward"
- else
- print "Couldn't Move"
- if turtle.getFuelLevel() == 0 then
- print "Out of Fuel"
- end
- end
- elseif scancode == left then
- x = turtle.turnLeft()
- if x then
- print "Turned Left"
- else
- print "Couldn't Turn"
- if turtle.getFuelLevel() == 0 then
- print "Out of Fuel"
- end
- end
- elseif scancode == right then
- x = turtle.turnRight()
- if x then
- print "Turned Right"
- else
- print "Couldn't Turn"
- if turtle.getFuelLevel() == 0 then
- print "Out of Fuel"
- end
- end
- elseif scancode == dig then
- x = turtle.dig()
- if x then
- print "Dug"
- else
- print "Couldn't Dig"
- if turtle.getFuelLevel() == 0 then
- print "Out of Fuel"
- end
- end
- elseif scancode == digUp then
- x = turtle.digUp()
- if x then
- print "Dug"
- else
- print "Couldn't Dig"
- if turtle.getFuelLevel() == 0 then
- print "Out of Fuel"
- end
- end
- elseif scancode == digDown then
- x = turtle.digDown()
- if x then
- print "Dug"
- else
- print "Couldn't Dig"
- if turtle.getFuelLevel() == 0 then
- print "Out of Fuel"
- end
- end
- elseif scancode == place then
- x = turtle.place()
- if x then
- print "Placed"
- else
- print "Couldn't Place"
- if turtle.getFuelLevel() == 0 then
- print "Out of Fuel"
- end
- end
- elseif scancode == placeDown then
- x = turtle.placeDown()
- if x then
- print "Placed"
- else
- print "Couldn't Place"
- if turtle.getFuelLevel() == 0 then
- print "Out of Fuel"
- end
- end
- elseif scancode == placeUp then
- x = turtle.placeUp()
- if x then
- print "Placed"
- else
- print "Couldn't Place"
- if turtle.getFuelLevel() == 0 then
- print "Out of Fuel"
- end
- end
- elseif scancode == refuel then
- x = turtle.refuel()
- if x then
- print "Refilled"
- else
- print "Couldn't Refuel"
- end
- print ("Current fuel at "..tostring(turtle.getFuelLevel()))
- elseif scancode == select then
- print "Number of the slot:"
- x = read()
- x = string.sub(x,2)
- x = tonumber(x)
- if tonumber(x)>16 then
- print "Invalid slot"
- else
- turtle.select(x)
- current = tonumber(x)
- current = tonumber(current)
- end
- elseif scancode == swap then
- print "Number of the slot to swap to:"
- x = read()
- x = string.sub(x,2)
- x = tonumber(x)
- print "Quantity of the item to swap:"
- y = read()
- y = string.sub(y,1)
- y = tonumber(y)
- if tonumber(x)>16 then
- print "Invalid Slot"
- else
- if y>turtle.getItemCount(tonumber(current)) then
- y = turtle.getItemCount(tonumber(current))
- end
- turtle.transferTo(x,y)
- end
- elseif scancode == esc then
- term.clear()
- term.setCursorPos(1,1)
- print "Thanks, Exiting program"
- break
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment