Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- List of actions
- -- button & function
- local action = {
- r = turtle.refuel,
- w = turtle.forward,
- s = turtle.back,
- a = turtle.turnLeft,
- d = turtle.turnRight,
- q = turtle.down,
- e = turtle.up,
- z = turtle.digDown,
- x = turtle.dig,
- c = turtle.digUp,
- v = turtle.placeDown,
- b = turtle.place,
- n = turtle.placeUp,
- }
- while true do
- ev,key = os.pullEvent()
- -- Run the function assigned to the variable inside "action"
- if ev == "char" then
- action[key] then action[key]()
- -- Selection, supports slots 1 to 10
- elseif ev == "key" then
- if key >= 2 or key <= 11 then
- turtle.select(key-1)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment