Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- p = peripheral.wrap("back")
- m = peripheral.wrap("top")
- s = peripheral.wrap("right")
- m.open(15121)
- m.open(15122)
- m.open(15123)
- m.open(15124)
- m.open(15125)
- m.open(15126)
- p1 = false
- p2 = false
- p3 = false
- l1 = false
- l2 = false
- e1 = false
- while true do
- local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
- if senderChannel == 15121 then
- p1 = message
- print("Received move X coordinate (" .. p1 .. ").")
- end
- if senderChannel == 15122 then
- p2 = message
- print("Received move Y coordinate (" .. p2 .. ").")
- end
- if senderChannel == 15123 then
- p3 = message
- print("Received move Z coordinate (" .. p3 .. ").")
- end
- if senderChannel == 15124 then
- l1 = message
- print("Received look yaw (" .. l1 .. ").")
- end
- if senderChannel == 15125 then
- l2 = message
- print("Received look pitch (" .. l2 .. ").")
- end
- if senderChannel == 15126 then
- e1 = message
- print("WARNING - RECEIVED EXPLODE COMMAND")
- end
- if p1 ~= false then
- if p2 ~= false then
- if p3 ~= false then
- x, y, z = gps.locate()
- mx = 0
- my = 0
- mz = 0
- mx = p1 - x
- my = p2 - y
- mz = p3 - z
- if mx > 32 then
- mx = 32
- elseif mx < -32 then
- mx = -32
- end
- if my > 32 then
- my = 32
- elseif my < -32 then
- my = -32
- end
- if mz > 32 then
- mz = 32
- elseif mz < -32 then
- mz = -32
- end
- p.walk(mx, my, mz)
- print("MOVING TO (" .. p1 .. ", " .. p2 .. ", " .. p3 .. ").")
- s.playNote("bell",0.1)
- p1 = false
- p2 = false
- p3 = false
- end
- end
- end
- if l1 ~= false then
- if l2 ~= false then
- p.look(l1, l2)
- print("LOOKING AT (" .. l1 .. ", " .. l2 .. ")")
- s.playNote("flute",0.1)
- l1 = false
- l2 = false
- end
- end
- if e1 ~= false then
- --p.explode()
- e1 = false
- print("WARNING - EXPLODING!")
- while true do
- s.playNote("pling",3)
- sleep(0.1)
- s.playNote("pling",3,6)
- sleep(0.2)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement