Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function menu(id, text)
- if sid == id then
- print("["..text.."]")
- else
- print(" "..text)
- end
- end
- function RCmaster()
- sid = 0
- fuel = ""
- coords = ""
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- menu(0, "Movement")
- menu(1, "Block Placing")
- menu(2, "Others")
- menu(3, "Exit")
- local sEvent, param = os.pullEvent("key")
- if(sEvent == "key") then
- if(param == 200) then
- if sid > 0 then
- sid = sid - 1
- elseif sid == 0 then
- sid = 3
- end
- elseif (param == 208) then
- if sid < 3 then
- sid = sid + 1
- elseif sid == 3 then
- sid = 0
- end
- elseif (param == 28) then
- if (sid == 0) then
- sid = 0
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- menu(0, "Forward")
- menu(1, "Backward")
- menu(2, "Turn Left")
- menu(3, "Turn Right")
- menu(4, "Up")
- menu(5, "Down")
- menu(6, "Attack")
- menu(7, "Mine")
- menu(8, "Return to main menu")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- local sEvent, param = os.pullEvent("key")
- if(sEvent == "key") then
- if(param == 200) then
- if sid > 0 then
- sid = sid - 1
- elseif sid == 0 then
- sid = 8
- end
- elseif (param == 208) then
- if sid < 8 then
- sid = sid + 1
- elseif sid == 8 then
- sid = 0
- end
- elseif (param == 28) then
- if sid == 0 then
- rednet.broadcast("TS Forward")
- data()
- elseif sid == 1 then
- rednet.broadcast("TS Backward")
- data()
- elseif sid == 2 then
- rednet.broadcast("TS TurnLeft")
- elseif sid == 3 then
- rednet.broadcast("TS TurnRight")
- elseif sid == 4 then
- rednet.broadcast("TS Up")
- data()
- elseif sid == 5 then
- rednet.broadcast("TS Down")
- data()
- elseif sid == 6 then
- rednet.broadcast("TS Attack")
- elseif sid == 7 then
- rednet.broadcast("TS Mine")
- elseif sid == 8 then
- RCmaster()
- end
- end
- end
- end
- elseif sid == 1 then
- sid = 0
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- menu(0, "Place in front")
- menu(1, "Place Up")
- menu(2, "Place Down")
- menu(3, "Return to main menu")
- local sEvent, param = os.pullEvent("key")
- if(sEvent == "key") then
- if(param == 200) then
- if sid > 0 then
- sid = sid - 1
- elseif sid == 0 then
- sid = 3
- end
- elseif (param == 208) then
- if sid < 3 then
- sid = sid + 1
- elseif sid == 3 then
- sid = 0
- end
- elseif (param == 28) then
- if sid == 0 then
- rednet.broadcast("TS PlaceBlock")
- elseif sid == 1 then
- rednet.broadcast("TS PlaceBlockUp")
- elseif sid == 2 then
- rednet.broadcast("TS PlaceBlockDown")
- elseif sid == 3 then
- RCmaster()
- end
- end
- end
- end
- elseif sid == 2 then
- sid = 0
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- menu(0, "Redstone Current")
- menu(1, "Refuel (Use coal only)")
- menu(2, "Slot Forward")
- menu(3, "Slot Backward")
- menu(4, "Use *Send* instead of *Broadcast*")
- menu(5, "Key based control")
- menu(6, "Cursor based control")
- menu(7, "Remote program")
- menu(8, "Return to main menu")
- print("")
- print("Current Slot: "..s)
- local sEvent, param = os.pullEvent("key")
- if(sEvent == "key") then
- if(param == 200) then
- if sid > 0 then
- sid = sid - 1
- elseif sid == 0 then
- sid = 8
- end
- elseif (param == 208) then
- if sid < 8 then
- sid = sid + 1
- elseif sid == 8 then
- sid = 0
- end
- elseif (param == 28) then
- if sid == 0 then
- rednet.broadcast("TS Redstone")
- elseif sid == 1 then
- rednet.broadcast("TS Refuel")
- elseif sid == 2 then
- if s >= 16 then
- else
- rednet.broadcast("TS NextSlot")
- s=s+1
- rednet.broadcast(tostring(s))
- end
- elseif sid == 3 then
- if s <= 1 then
- else
- rednet.broadcast("TS PreviousSlot")
- s=s-1
- rednet.broadcast(tostring(s))
- end
- elseif sid == 4 then
- RCmaster_send()
- elseif sid == 5 then
- RCmaster_keys()
- elseif sid == 6 then
- RCmaster_mouse()
- elseif sid == 7 then
- rednet.broadcast("TS Program")
- term.clear()
- term.setCursorPos(1,1)
- print("What program do you want to run?")
- program = io.read()
- rednet.broadcast(program)
- elseif sid == 8 then
- RCmaster()
- end
- end
- end
- end
- elseif sid == 3 then
- os.reboot()
- end
- end
- end
- end
- end
- function RCmaster_send()
- sid = 0
- fuel = ""
- coords = ""
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- menu(0, "Movement")
- menu(1, "Block Placing")
- menu(2, "Others")
- menu(3, "Exit")
- local sEvent, param = os.pullEvent("key")
- if(sEvent == "key") then
- if(param == 200) then
- if sid > 0 then
- sid = sid - 1
- elseif sid == 0 then
- sid = 3
- end
- elseif (param == 208) then
- if sid < 3 then
- sid = sid + 1
- elseif sid == 3 then
- sid = 0
- end
- elseif (param == 28) then
- if sid == 0 then
- sid = 0
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- menu(0, "Forward")
- menu(1, "Backward")
- menu(2, "Turn Left")
- menu(3, "Turn Right")
- menu(4, "Up")
- menu(5, "Down")
- menu(6, "Attack")
- menu(7, "Mine")
- menu(8, "Return to main menu")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- local sEvent, param = os.pullEvent("key")
- if(sEvent == "key") then
- if(param == 200) then
- if sid > 0 then
- sid = sid - 1
- elseif sid == 0 then
- sid = 8
- end
- elseif (param == 208) then
- if sid < 8 then
- sid = sid + 1
- elseif sid == 8 then
- sid = 0
- end
- elseif (param == 28) then
- if sid == 0 then
- rednet.send(tid, "TS Forward")
- data_send()
- elseif sid == 1 then
- rednet.send(tid, "TS Backward")
- data_send()
- elseif sid == 2 then
- rednet.send(tid, "TS TurnLeft")
- elseif sid == 3 then
- rednet.send(tid, "TS TurnRight")
- elseif sid == 4 then
- rednet.send(tid, "TS Up")
- data_send()
- elseif sid == 5 then
- rednet.send(tid, "TS Down")
- data_send()
- elseif sid == 6 then
- rednet.send(tid, "TS Attack")
- elseif sid == 7 then
- rednet.send(tid, "TS Mine")
- elseif sid == 8 then
- RCmaster_send()
- end
- end
- end
- end
- elseif sid == 1 then
- sid = 0
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- menu(0, "Place in front")
- menu(1, "Place Up")
- menu(2, "Place Down")
- menu(3, "Return to main menu")
- local sEvent, param = os.pullEvent("key")
- if(sEvent == "key") then
- if(param == 200) then
- if sid > 0 then
- sid = sid - 1
- elseif sid == 0 then
- sid = 3
- end
- elseif (param == 208) then
- if sid < 3 then
- sid = sid + 1
- elseif sid == 3 then
- sid = 0
- end
- elseif (param == 28) then
- if sid == 0 then
- rednet.send(tid, "TS PlaceBlock")
- elseif sid == 1 then
- rednet.send(tid, "TS PlaceBlockUp")
- elseif sid == 2 then
- rednet.send(tid, "TS PlaceBlockDown")
- elseif sid == 3 then
- RCmaster_send()
- end
- end
- end
- end
- elseif sid == 2 then
- sid = 0
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- menu(0, "Redstone Current")
- menu(1, "Refuel (Use coal only)")
- menu(2, "Slot Forward")
- menu(3, "Slot Backward")
- menu(4, "Use *Broadcast* instead of *Send*")
- menu(5, "Send ID Forward")
- menu(6, "Send ID Backward")
- menu(7, "Key based control")
- menu(8, "Cursor based control")
- menu(9, "Remote program")
- menu(10, "Return to main menu")
- print("")
- print("Current Slot: "..s)
- print("Selected ID: "..tid)
- local sEvent, param = os.pullEvent("key")
- if(sEvent == "key") then
- if(param == 200) then
- if sid > 0 then
- sid = sid - 1
- elseif sid == 0 then
- sid = 10
- end
- elseif (param == 208) then
- if sid < 10 then
- sid = sid + 1
- elseif sid == 10 then
- sid = 0
- end
- elseif (param == 28) then
- if sid == 0 then
- rednet.send(tid, "TS Redstone")
- elseif sid == 1 then
- rednet.send(tid, "TS Refuel")
- elseif sid == 2 then
- if s >= 16 then
- else
- rednet.send(tid, "TS NextSlot")
- s=s+1
- rednet.send(tid, tostring(s))
- end
- elseif sid == 3 then
- if s <= 1 then
- else
- rednet.send(tid, "TS PreviousSlot")
- s=s-1
- rednet.send(tid, tostring(s))
- end
- elseif sid == 4 then
- RCmaster()
- elseif sid == 5 then
- if tid >= 100000000 then
- else
- tid=tid+1
- end
- elseif sid == 6 then
- if tid <= 1 then
- else
- tid=tid-1
- end
- elseif sid == 7 then
- RCmaster_keys_send()
- elseif sid == 8 then
- RCmaster_mouse_send()
- elseif sid == 9 then
- rednet.send(tid, "TS Program")
- term.clear()
- term.setCursorPos(1,1)
- print("What program do you want to run?")
- program = io.read()
- rednet.send(tid, program)
- elseif sid == 10 then
- RCmaster_send()
- end
- end
- end
- end
- elseif sid == 3 then
- os.reboot()
- end
- end
- end
- end
- end
- function RCmaster_keys()
- fuel = ""
- coords = ""
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- print("W/A/S/D: Movement\nQ/E: Up and Down\nZ/X/C: Place blocks Down, In Front and Up\nR/F: Change slots\nT: Output redstone signal\nG: Attack\nV: Mine Down, In Front and Up\nH: Display help\nO: Change mode\nB: Back to menu based control\nN: Refuel\n(Press any key to continue...)")
- local sEvent, param = os.pullEvent("key")
- if(sEvent == "key") then
- end
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- print("")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- while true do
- local sEvent, param = os.pullEvent("key")
- if(sEvent == "key") then
- if(param == 17) then
- rednet.broadcast("TS Forward")
- data()
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- print("Forward")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- elseif (param == 31) then
- rednet.broadcast("TS Backward")
- data()
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- print("Backward")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- elseif (param == 30) then
- rednet.broadcast("TS TurnLeft")
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- print("Turn Left")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- elseif (param == 32) then
- rednet.broadcast("TS TurnRight")
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- print("Turn Right")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- elseif (param == 18) then
- rednet.broadcast("TS Up")
- data()
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- print("Up")
- elseif (param == 16) then
- rednet.broadcast("TS Down")
- data()
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- print("Down")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- elseif (param == 45) then
- rednet.broadcast("TS PlaceBlock")
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- print("Place Block")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- elseif (param == 46) then
- rednet.broadcast("TS PlaceBlockUp")
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- print("Place Block Up")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- elseif (param == 44) then
- rednet.broadcast("TS PlaceBlockDown")
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- print("Place Block Down")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- elseif (param == 19) then
- if s >= 16 then
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- print("No more slots left")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- else
- rednet.broadcast("TS NextSlot")
- s=s+1
- rednet.broadcast(tostring(s))
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- print("Now using slot " ..s)
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- end
- elseif (param == 33) then
- if s <= 1 then
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- print("No more slots left")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- else
- rednet.broadcast("TS PreviousSlot")
- s=s-1
- rednet.broadcast(tostring(s))
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- print("Now using slot " ..s)
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- end
- elseif (param == 20) then
- rednet.broadcast("TS Redstone")
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- print("Redstone")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- elseif (param == 34) then
- rednet.broadcast("TS Attack")
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- print("Attack")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- elseif (param == 47) then
- rednet.broadcast("TS Mine")
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- print("Mine")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- elseif (param == 35) then
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- print("W/A/S/D: Movement\nQ/E: Up and Down\nZ/X/C: Place blocks Down, In Front and Up\nR/F: Change slots\nT: Output redstone signal\nG: Attack\nV: Mine Down, In Front and Up\nH: Display help\nO: Change mode\nB: Back to menu based control\nN: Refuel\n(Press any key to continue...)")
- local sEvent, param = os.pullEvent("key")
- if(sEvent == "key") then
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- print("")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- end
- elseif (param == 24) then
- RCmaster_keys_send()
- elseif (param == 48) then
- RCmaster()
- elseif (param == 49) then
- rednet.broadcast("TS Refuel")
- print("Refuel")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- end
- end
- end
- end
- function RCmaster_keys_send()
- fuel = ""
- coords = ""
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("W/A/S/D: Movement\nQ/E: Up and Down\nZ/X/C: Place blocks Down, In Front and Up\nR/F: Change slots\nT: Output redstone signal\nG: Attack\nV: Mine Down, In Front and Up\nH: Display help\nUp/Down arrows: Change sending ID\nO: Change mode\nB: Back to menu based control\nN: Refuel\n(Press any key to continue...)")
- local sEvent, param = os.pullEvent("key")
- if(sEvent == "key") then
- end
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- while true do
- local sEvent, param = os.pullEvent("key")
- if(sEvent == "key") then
- if(param == 17) then
- rednet.send(tid, "TS Forward")
- data_send()
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("Forward")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- elseif (param == 31) then
- rednet.send(tid, "TS Backward")
- data_send()
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("Backward")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- elseif (param == 30) then
- rednet.send(tid, "TS TurnLeft")
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("Turn Left")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- elseif (param == 32) then
- rednet.send(tid, "TS TurnRight")
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("Turn Right")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- elseif (param == 18) then
- rednet.send(tid, "TS Up")
- data_send()
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("Up")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- elseif (param == 16) then
- rednet.send(tid, "TS Down")
- data_send()
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("Down")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- elseif (param == 45) then
- rednet.send(tid, "TS PlaceBlock")
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("Place Block")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- elseif (param == 46) then
- rednet.send(tid, "TS PlaceBlockUp")
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("Place Block Up")
- elseif (param == 44) then
- rednet.send(tid, "TS PlaceBlockDown")
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("Place Block Down")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- elseif (param == 19) then
- if s >= 16 then
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("No more slots left")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- else
- rednet.send(tid, "TS NextSlot")
- s=s+1
- rednet.send(tid, tostring(s))
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("Now using slot " ..s)
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- end
- elseif (param == 33) then
- if s <= 1 then
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("No more slots left")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- else
- rednet.send(tid, "TS PreviousSlot")
- s=s-1
- rednet.send(tid, tostring(s))
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("Now using slot " ..s)
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- end
- elseif (param == 20) then
- rednet.send(tid, "TS Redstone")
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("Redstone")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- elseif (param == 34) then
- rednet.send(tid, "TS Attack")
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("Attack")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- elseif (param == 47) then
- rednet.send(tid, "TS Mine")
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("Mine")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- elseif (param == 35) then
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("W/A/S/D: Movement\nQ/E: Up and Down\nZ/X/C: Place blocks Down, In Front and Up\nR/F: Change slots\nT: Output redstone signal\nG: Attack\nV: Mine Down, In Front and Up\nH: Display help\nUp/Down arrows: Change sending ID\nO: Change mode\nB: Back to menu based control\nN: Refuel\n(Press any key to continue...)")
- local sEvent, param = os.pullEvent("key")
- if(sEvent == "key") then
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- end
- elseif (param == 200) then
- if tid >= 100000000 then
- else
- tid=tid+1
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("Now sending to " ..tid)
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- end
- elseif (param == 208) then
- if tid <= 1 then
- else
- tid=tid-1
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("Now sending to " ..tid)
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- end
- elseif (param == 24) then
- RCmaster_keys()
- elseif (param == 48) then
- RCmaster_send()
- elseif (param == 49) then
- rednet.send(tid, "TS Refuel")
- print("Refuel")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- end
- end
- end
- end
- function RCmaster_mouse()
- fuel = ""
- coords = ""
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- print("- Movement")
- print("- Block Placing")
- print("- Others")
- print("- Exit")
- local sEvent, param, xMousePos, yMousePos = os.pullEvent("mouse_click")
- if(sEvent == "mouse_click") then
- if (param == 1) then
- if (xMousePos <= 10 and yMousePos == 2 and xMousePos >= 1) then
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- print("- Forward")
- print("- Backward")
- print("- Turn Left")
- print("- Turn Right")
- print("- Up")
- print("- Down")
- print("- Attack")
- print("- Mine")
- print("- Return to main menu")
- print("")
- print("Coordinates: "..coords)
- print("Fuel level: "..fuel)
- local sEvent, param, xMousePos, yMousePos = os.pullEvent("mouse_click")
- if(sEvent == "mouse_click") then
- if (param == 1) then
- if (xMousePos <= 9 and yMousePos == 2 and xMousePos >= 1) then
- rednet.broadcast("TS Forward")
- data()
- elseif (xMousePos <= 10 and yMousePos == 3 and xMousePos >= 1) then
- rednet.broadcast("TS Backward")
- data()
- elseif (xMousePos <= 11 and yMousePos == 4 and xMousePos >= 1) then
- rednet.broadcast("TS TurnLeft")
- elseif (xMousePos <= 12 and yMousePos == 5 and xMousePos >= 1) then
- rednet.broadcast("TS TurnRight")
- elseif (xMousePos <= 4 and yMousePos == 6 and xMousePos >= 1) then
- rednet.broadcast("TS Up")
- data()
- elseif (xMousePos <= 6 and yMousePos == 7 and xMousePos >= 1) then
- rednet.broadcast("TS Down")
- data()
- elseif (xMousePos <= 8 and yMousePos == 8 and xMousePos >= 1) then
- rednet.broadcast("TS Attack")
- elseif (xMousePos <= 12 and yMousePos == 9 and xMousePos >= 1) then
- rednet.broadcast("TS Mine")
- elseif (xMousePos <= 21 and yMousePos == 10 and xMousePos >= 1) then
- RCmaster_mouse()
- end
- end
- end
- end
- elseif (xMousePos <= 15 and yMousePos == 3 and xMousePos >= 1) then
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- print("- Place in front")
- print("- Place Up")
- print("- Place Down")
- print("- Return to main menu")
- local sEvent, param, xMousePos, yMousePos = os.pullEvent("mouse_click")
- if(sEvent == "mouse_click") then
- if (param == 1) then
- if (xMousePos <= 16 and yMousePos == 2 and xMousePos >= 1) then
- rednet.broadcast("TS PlaceBlock")
- elseif (xMousePos <= 10 and yMousePos == 3 and xMousePos >= 1)then
- rednet.broadcast("TS PlaceBlockUp")
- elseif (xMousePos <= 12 and yMousePos == 4 and xMousePos >= 1) then
- rednet.broadcast("TS PlaceBlockDown")
- elseif (xMousePos <= 21 and yMousePos == 5 and xMousePos >= 1) then
- RCmaster_mouse()
- end
- end
- end
- end
- elseif (xMousePos <= 8 and yMousePos == 4 and xMousePos >= 1) then
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Broadcast")
- print("- Redstone Current")
- print("- Refuel (Use coal only)")
- print("- Slot Forward")
- print("- Slot Backward")
- print("- Use *Send* instead of *Broadcast*")
- print("- Key based control")
- print("- Menu based control")
- print("- Remote program")
- print("- Return to main menu")
- print("")
- print("Current Slot: "..s)
- local sEvent, param, xMousePos, yMousePos = os.pullEvent("mouse_click")
- if(sEvent == "mouse_click") then
- if (param == 1) then
- if (xMousePos <= 18 and yMousePos == 2 and xMousePos >= 1) then
- rednet.broadcast("TS Redstone")
- elseif (xMousePos <= 24 and yMousePos == 3 and xMousePos >= 1) then
- rednet.broadcast("TS Refuel")
- elseif (xMousePos <= 14 and yMousePos == 4 and xMousePos >= 1) then
- if s >= 16 then
- else
- rednet.broadcast("TS NextSlot")
- s=s+1
- rednet.broadcast(tostring(s))
- end
- elseif (xMousePos <= 15 and yMousePos == 5 and xMousePos >= 1) then
- if s <= 1 then
- else
- rednet.broadcast("TS PreviousSlot")
- s=s-1
- rednet.broadcast(tostring(s))
- end
- elseif (xMousePos <= 35 and yMousePos == 6 and xMousePos >= 1) then
- RCmaster_mouse_send()
- elseif (xMousePos <= 19 and yMousePos == 7 and xMousePos >= 1) then
- RCmaster_keys()
- elseif (xMousePos <= 20 and yMousePos == 8 and xMousePos >= 1) then
- RCmaster()
- elseif (xMousePos <= 16 and yMousePos == 9 and xMousePos >= 1) then
- rednet.broadcast("TS Program")
- term.clear()
- term.setCursorPos(1,1)
- print("What program do you want to run?")
- program = io.read()
- rednet.broadcast(program)
- elseif (xMousePos <= 21 and yMousePos == 10 and xMousePos >= 1) then
- RCmaster_mouse()
- end
- end
- end
- end
- elseif (xMousePos <= 6 and yMousePos == 5 and xMousePos >= 1) then
- os.reboot()
- end
- end
- end
- end
- end
- function RCmaster_mouse_send()
- fuel = ""
- coords = ""
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("- Movement")
- print("- Block Placing")
- print("- Others")
- print("- Exit")
- local sEvent, param, xMousePos, yMousePos = os.pullEvent("mouse_click")
- if(sEvent == "mouse_click") then
- if (param == 1) then
- if (xMousePos <= 10 and yMousePos == 2 and xMousePos >= 1) then
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("- Forward")
- print("- Backward")
- print("- Turn Left")
- print("- Turn Right")
- print("- Up")
- print("- Down")
- print("- Attack")
- print("- Mine")
- print("- Return to main menu")
- local sEvent, param, xMousePos, yMousePos = os.pullEvent("mouse_click")
- if(sEvent == "mouse_click") then
- if (param == 1) then
- if (xMousePos <= 9 and yMousePos == 2 and xMousePos >= 1) then
- rednet.send(tid, "TS Forward")
- data_send()
- elseif (xMousePos <= 10 and yMousePos == 3 and xMousePos >= 1) then
- rednet.send(tid, "TS Backward")
- data_send()
- elseif (xMousePos <= 11 and yMousePos == 4 and xMousePos >= 1) then
- rednet.send(tid, "TS TurnLeft")
- elseif (xMousePos <= 12 and yMousePos == 5 and xMousePos >= 1) then
- rednet.send(tid, "TS TurnRight")
- elseif (xMousePos <= 4 and yMousePos == 6 and xMousePos >= 1) then
- rednet.send(tid, "TS Up")
- data_send()
- elseif (xMousePos <= 6 and yMousePos == 7 and xMousePos >= 1) then
- rednet.send(tid, "TS Down")
- data_send()
- elseif (xMousePos <= 8 and yMousePos == 8 and xMousePos >= 1) then
- rednet.send(tid, "TS Attack")
- elseif (xMousePos <= 12 and yMousePos == 9 and xMousePos >= 1) then
- rednet.send(tid, "TS Mine")
- elseif (xMousePos <= 21 and yMousePos == 10 and xMousePos >= 1) then
- RCmaster_mouse_send()
- end
- end
- end
- end
- elseif (xMousePos <= 15 and yMousePos == 3 and xMousePos >= 1) then
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("- Place in front")
- print("- Place Up")
- print("- Place Down")
- print("- Return to main menu")
- local sEvent, param, xMousePos, yMousePos = os.pullEvent("mouse_click")
- if(sEvent == "mouse_click") then
- if (param == 1) then
- if (xMousePos <= 16 and yMousePos == 2 and xMousePos >= 1) then
- rednet.send(tid, "TS PlaceBlock")
- elseif (xMousePos <= 10 and yMousePos == 3 and xMousePos >= 1)then
- rednet.send(tid, "TS PlaceBlockUp")
- elseif (xMousePos <= 12 and yMousePos == 4 and xMousePos >= 1) then
- rednet.send(tid, "TS PlaceBlockDown")
- elseif (xMousePos <= 21 and yMousePos == 5 and xMousePos >= 1) then
- RCmaster_mouse_send()
- end
- end
- end
- end
- elseif (xMousePos <= 8 and yMousePos == 4 and xMousePos >= 1) then
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("TurtleControl V "..version..". Mode: Send. Sending to ID: "..tid)
- print("- Redstone Current")
- print("- Refuel (Use coal only)")
- print("- Slot Forward")
- print("- Slot Backward")
- print("- Use *Broadcast* instead of *Send*")
- print("- Send ID Forward")
- print("- Send ID Backward")
- print("- Key based control")
- print("- Menu based control")
- print("- Remote program")
- print("- Return to main menu")
- print("")
- print("Current Slot: "..s)
- print("Selected ID: "..tid)
- local sEvent, param, xMousePos, yMousePos = os.pullEvent("mouse_click")
- if(sEvent == "mouse_click") then
- if (param == 1) then
- if (xMousePos <= 18 and yMousePos == 2 and xMousePos >= 1) then
- rednet.send(tid, "TS Redstone")
- elseif (xMousePos <= 24 and yMousePos == 3 and xMousePos >= 1) then
- rednet.send(tid, "TS Refuel")
- elseif (xMousePos <= 14 and yMousePos == 4 and xMousePos >= 1) then
- if s >= 16 then
- else
- rednet.send(tid, "TS NextSlot")
- s=s+1
- rednet.send(tid, tostring(s))
- end
- elseif (xMousePos <= 15 and yMousePos == 5 and xMousePos >= 1) then
- if s <= 1 then
- else
- rednet.send(tid, "TS PreviousSlot")
- s=s-1
- rednet.send(tid, tostring(s))
- end
- elseif (xMousePos <= 35 and yMousePos == 6 and xMousePos >= 1) then
- RCmaster_mouse()
- elseif (xMousePos <= 19 and yMousePos == 7 and xMousePos >= 1) then
- if tid >= 100000000 then
- else
- tid=tid+1
- end
- elseif (xMousePos <= 17 and yMousePos == 8 and xMousePos >= 1) then
- if tid <= 1 then
- else
- tid=tid-1
- end
- elseif (xMousePos <= 19 and yMousePos == 9 and xMousePos >= 1) then
- RCmaster_keys_send()
- elseif (xMousePos <= 20 and yMousePos == 10 and xMousePos >= 1) then
- RCmaster_send()
- elseif (xMousePos <= 16 and yMousePos == 11 and xMousePos >= 1) then
- rednet.send(tid, "TS Program")
- term.clear()
- term.setCursorPos(1,1)
- print("What program do you want to run?")
- program = io.read()
- rednet.send(tid, program)
- elseif (xMousePos <= 21 and yMousePos == 12 and xMousePos >= 1) then
- RCmaster_mouse_send()
- end
- end
- end
- end
- elseif (xMousePos <= 6 and yMousePos == 5 and xMousePos >= 1) then
- os.reboot()
- end
- end
- end
- end
- end
- function startup()
- local bOpen, sFreeSide = false, nil
- for n,sSide in pairs(rs.getSides()) do
- if peripheral.getType( sSide ) == "modem" then
- sFreeSide = sSide
- if rednet.isOpen( sSide ) then
- bOpen = true
- end
- end
- end
- if not bOpen then
- if sFreeSide then
- rednet.open( sFreeSide )
- else
- print("No modem attached")
- print("Press any key to continue")
- local sEvent, param = os.pullEvent("key")
- if(sEvent == "key") then
- os.reboot()
- end
- end
- end
- term.clear()
- term.setCursorPos(1,1)
- textutils.slowPrint("TurtleControl V "..version.." Initiated.")
- sleep(2)
- sid=0
- fuel = ""
- coords = ""
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("What mode do you want to use?")
- menu(0, "Menu Mode")
- menu(1, "Key Mode")
- menu(2, "Cursor Mode")
- local sEvent, param = os.pullEvent("key")
- if(sEvent == "key") then
- if(param == 200) then
- if sid > 0 then
- sid = sid - 1
- elseif sid == 0 then
- sid = 2
- end
- elseif (param == 208) then
- if sid < 2 then
- sid = sid + 1
- elseif sid == 2 then
- sid = 0
- end
- elseif (param == 28) then
- if sid == 0 then
- RCmaster()
- elseif sid == 1 then
- RCmaster_keys()
- elseif sid == 2 then
- RCmaster_mouse()
- end
- end
- end
- end
- end
- function data()
- sleep(.2)
- rednet.broadcast("TS GetPos")
- sleep(.1)
- scrap, message = rednet.receive(.2)
- if message ~= nil then
- coords = message
- else
- coords = "Couldn't contact turtle"
- end
- sleep(.2)
- rednet.broadcast("TS GetFuel")
- sleep(.1)
- scrap, message = rednet.receive(.2)
- if message ~= nil then
- fuel = message
- else
- fuel = "Couldn't contact turtle"
- end
- end
- function data_send()
- sleep(.2)
- rednet.send(tid, "TS GetPos")
- sleep(.1)
- scrap, message = rednet.receive(.2)
- if message ~= nil then
- coords = message
- else
- coords = "Couldn't contact turtle"
- end
- sleep(.2)
- rednet.send(tid, "TS GetFuel")
- sleep(.1)
- scrap, message = rednet.receive(.2)
- if message ~= nil then
- fuel = message
- else
- fuel = "Couldn't contact turtle"
- end
- end
- tid=1
- s=1
- version=1.0
- startup()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement