View difference between Paste ID: ucM872Ck and XTVJZzbM
SHOW: | | - or go back to the newest paste.
1
rednet.open("right")
2
while true do
3
  evnt = {os.pullEvent("rednet_message")}
4
  --[[for i = 1,#evnt do
5
    print(i..". "..evnt[i])
6
  end]]--
7
  args = {}
8
  for word in evnt[3]:gmatch("%w+") do
9
    table.insert(args,word)
10
    --print("Arg:"..word)
11
  end
12
  if #args == 1 then
13
    cmd = string.lower(args[1])
14
    if cmd == "up" then
15
      turtle.up()
16
    elseif cmd == "down" then
17
      turtle.down()
18
    elseif cmd == "left" then
19
      turtle.turnLeft()
20
    elseif cmd == "right" then
21
      turtle.turnRight()
22
    elseif cmd == "go" then
23
      turtle.forward()
24
    elseif cmd == "back" then
25
      turtle.back()
26
    end
27
  elseif #args == 2 then
28
    cmd = string.lower(args[1])
29
    action = " "
30
    if cmd == "up" then
31
      action = "turtle.up()"
32
    elseif cmd == "down" then
33
      action = "turtle.down()"
34
    elseif cmd == "left" then
35
      action = "turtle.turnLeft()"
36
    elseif cmd == "right" then
37
      action = "turtle.turnRight()"
38
    elseif cmd == "go" then
39
      action = "turtle.forward()"
40
    elseif cmd == "back" then
41
      action = "turtle.back()"
42
    end
43
    if action ~= " " then
44
      if tonumber(args[2]) then
45
        for n = 1,tonumber(args[2]) do
46
          loadstring(action)()
47
        end
48
      end
49
    end
50
  end
51
end