Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- id = 15 --change to turtle id
- n=1
- options = {
- "Drop Payload",
- "Go Up",
- "Go Down",
- "Go Left",
- "Go Right",
- "Go Forward",
- "Go Backward",
- "Dig",
- "Turn Left",
- "Turn Right",
- }
- local function opt(m,mY)
- l=#m
- while true do
- for i=1, l, 1 do
- if i==n then
- local x, y = term.getSize()
- local b = string.len(">"..m[i].."<")/2
- local x = (x/2)-b
- term.setCursorPos(x,i+mY)
- term.clearLine()
- print(">"..m[i].."<")
- else
- local x, y = term.getSize()
- b = string.len(m[i])/2
- x = (x/2)-b
- term.setCursorPos(x,i+mY)
- term.clearLine()
- print(m[i]) end
- end
- a, b= os.pullEventRaw()
- if a == "key" then
- if b==200 and n>1 then n=n-1 end
- if b==208 and n<l then n=n+1 end
- if b==28 then break end
- end
- end
- term.clear() term.setCursorPos(1,1)
- return n
- end
- while true do
- term.clear()
- rednet.open("side") --Change to the side of your modem
- local input = opt(options,0)
- if input == 1 then
- rednet.send(id,"payload,1")
- elseif input == 2 then
- rednet.send(id,"up,1")
- elseif input == 3 then
- rednet.send(id,"down,1")
- elseif input == 4 then
- rednet.send(id,"left,1")
- elseif input == 5 then
- rednet.send(id,"right,1")
- elseif input == 6 then
- rednet.send(id,"forward,1")
- elseif input == 7 then
- rednet.send(id,"back,1")
- elseif input == 8 then
- rednet.send(id,"dig,1")
- elseif input == 9 then
- rednet.send(id,"lLeft,1")
- elseif input == 10 then
- rednet.send(id,"lRight,1")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement