SHOW:
|
|
- or go back to the newest paste.
1 | --made by TEC_NO | |
2 | --Fuel goes to slot 16 | |
3 | --TEC_NO's Remote Control Script! | |
4 | --Version 0.4 release, build/test 14 | |
5 | ||
6 | - | rednet.open("right") --open the wifi port |
6 | + | shell.run('clear') -- Clears Screen For Start |
7 | os.setComputerLabel("TEC_NO's Remote Control Script!") | |
8 | label = ("TEC_NO's Turtle Remote Control Script!") | |
9 | sleep(1) | |
10 | print("Starting program...") | |
11 | sleep(1) | |
12 | print("--------------------------") | |
13 | print("Version 0.4 release, build/test 14") | |
14 | print("--------------------------") | |
15 | print("Welcome To TEC_NO's Turtle Remote Control Script") | |
16 | print("--------------------------") | |
17 | print("Hello I'm Ready To Start!") | |
18 | print("--------------------------") | |
19 | print("Fuel goes to slot 16") | |
20 | print("--------------------------") | |
21 | print("What will my name be?") | |
22 | local setname = read() | |
23 | print("--------------------------") | |
24 | print("Please wait a sec!") | |
25 | sleep(1) | |
26 | os.setComputerLabel(setname) | |
27 | label = (setname) | |
28 | print("--------------------------") | |
29 | print("This Turtle ID: " .. os.getComputerID() .. ".") | |
30 | print(" ") | |
31 | write('Host ID: ') | |
32 | sender = read() | |
33 | os.setComputerLabel("Turtle Controler, ID: ".. sender .."!") | |
34 | print("--------------------------") | |
35 | sleep(1) | |
36 | print("Alright, Starting...") | |
37 | sleep(4) | |
38 | os.setComputerLabel(setname) | |
39 | label = (setname) | |
40 | print("Done!") | |
41 | print(" ") | |
42 | print("Turtle Stats:") | |
43 | print("Host ID: " .. sender .. " | Turtle ID: " .. os.getComputerID() .. "!") | |
44 | print("Fuel Level: " .. turtle.getFuelLevel() .. " | Turtle Name: " .. setname .. " ") | |
45 | write('Press Any Key To Start!') | |
46 | - | if text == 'rs' then -- if the ctrl button is pressed |
46 | + | local anykey = read() |
47 | print("Alright, I'm Ready!") | |
48 | --ask for host id | |
49 | ||
50 | sleep(1) | |
51 | ||
52 | function fuelling() | |
53 | if turtle.getFuelLevel() <= 10 then | |
54 | print("Adding Fuel...") | |
55 | os.setComputerLabel("Adding Fuel...") | |
56 | label = ("Adding Fuel...") | |
57 | turtle.select(16) | |
58 | turtle.refuel(1) | |
59 | turtle.select(1) | |
60 | print("Done.") | |
61 | os.setComputerLabel(setname) | |
62 | label = (setname) | |
63 | end | |
64 | end | |
65 | ||
66 | function fuelling2() | |
67 | print("Adding Fuel...") | |
68 | os.setComputerLabel("Adding Fuel...") | |
69 | label = ("Adding Fuel...") | |
70 | turtle.select(16) | |
71 | turtle.refuel(1) | |
72 | turtle.select(1) | |
73 | print("Done.") | |
74 | os.setComputerLabel(setname) | |
75 | label = (setname) | |
76 | end | |
77 | ||
78 | shell.run('clear') --clear the screen | |
79 | rednet.open("left") --open the wifi port | |
80 | x=1 | |
81 | while x == 1 do --start loop | |
82 | action, senderID, text = os.pullEvent() --wait for input | |
83 | if action == "rednet_message" then --if its a wireless message do | |
84 | if text == 'forward' then -- if the up button is pressed | |
85 | fuelling() | |
86 | turtle.forward() -- go forward | |
87 | end | |
88 | if text == 'backward' then --you know... | |
89 | turtle.back() | |
90 | end | |
91 | if text == 'refuel' then | |
92 | fuelling2() | |
93 | end | |
94 | ||
95 | if text == 'left' then | |
96 | turtle.turnLeft() | |
97 | end | |
98 | if text == 'right' then | |
99 | turtle.turnRight() | |
100 | end | |
101 | if text == 'up' then | |
102 | if turtle.detectUp() then | |
103 | turtle.digUp() | |
104 | else | |
105 | turtle.up() | |
106 | end | |
107 | end | |
108 | if text == 'down' then | |
109 | if turtle.detectDown() then | |
110 | turtle.digDown() | |
111 | else | |
112 | turtle.down() | |
113 | end | |
114 | end | |
115 | if text == 'chat' then | |
116 | sender, localchatnumbertosay, protocol = rednet.receive() | |
117 | os.setComputerLabel("Chat: "..localchatnumbertosay.."") | |
118 | sleep(4) | |
119 | os.setComputerLabel(setname) | |
120 | end | |
121 | ||
122 | if text == 'chatclear' then | |
123 | os.setComputerLabel(setname) | |
124 | end | |
125 | ||
126 | if text == 'dig' then -- if the space button is pressed on dig mode | |
127 | turtle.dig() -- dig forward | |
128 | end | |
129 | if text == 'place' then -- if the space button is pressed on place mode | |
130 | turtle.place() --place the selected block in front | |
131 | end | |
132 | if text == 'rs' then -- if the key is pressed | |
133 | redstone.setOutput('front', true) -- set redstone in front to true | |
134 | if action=="key" and senderID == sender then -- check sender id | |
135 | x=0 | |
136 | end | |
137 | end | |
138 | end | |
139 | end |