Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - --GoldKart (c) GoldProgramming 2014
 - --PDA Version 1.0
 - --Csstform
 - --CONFIG
 - --===================
 - --TURTLE ID
 - local tNum = 1
 - --===================
 - --KEY BINDINGS
 - --===================
 - --FORWARD
 - local forward = 17 --(default: 17)
 - --BACKWARD
 - local backward = 31 --(default: 31)
 - --LEFT
 - local left = 30 --(default: 30)
 - --RIGHT
 - local right = 32 --(default: 32)
 - --PICK UP ITEM
 - local getItem = 16 --(default: 16)
 - --USE ITEM
 - local useItem = 18 --(default: 18)
 - --ESC KEY
 - local exitKey = 19 --(default: 19)
 - --===================
 - --Program initialzation
 - rednet.open("back")
 - local exit = false
 - local x,y = term.getSize()
 - term.clear()
 - --Draw instruction box
 - for i=1, y do
 - term.setCursorPos(1, i)
 - write("|")
 - term.setCursorPos(x, i)
 - write("|")
 - end
 - for i=1, x do
 - term.setCursorPos(i, y)
 - write("-")
 - term.setCursorPos(i, 1)
 - write("-")
 - end
 - term.setCursorPos(2, 2)
 - write("Use WASD to move")
 - term.setCursorPos(2, 3)
 - write("your turtle.")
 - term.setCursorPos(2, 4)
 - write("Q = Get item")
 - term.setCursorPos(2, 5)
 - write("E = Use item")
 - term.setCursorPos(2, 6)
 - write("R = Quit")
 - --This will grab input from the user
 - function getInput()
 - local _,input = os.pullEvent("key")
 - return input
 - end
 - --This will send a command to the turtle
 - function sendCommand(command)
 - rednet.send(tNum, command)
 - end
 - --this will translate the user's input into a string to be sent over rednet
 - function readCommand(input)
 - if input == forward then
 - return "forward"
 - elseif input == left then
 - return "left"
 - elseif input == backward then
 - return "down"
 - elseif input == right then
 - return "right"
 - elseif input == getItem then
 - return "getItem"
 - elseif input == useItem then
 - return "useItem"
 - elseif input == exitKey then
 - exit = true
 - return "exit"
 - end
 - end
 - --Main program loop
 - while exit == false do
 - input = getInput()
 - command = readCommand(input)
 - sendCommand(command)
 - end
 - --Closing code
 - term.clear()
 - term.setCursorPos(1, 1)
 - rednet.close("back")
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment