Advertisement
Guest User

killer

a guest
Feb 26th, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.66 KB | None | 0 0
  1. rednet.open("right")
  2. local place = 0  
  3. local function moveTo()
  4.   turtle.down()
  5.   turtle.forward()
  6. end
  7.  
  8. local function moveFrom()
  9.   turtle.back()
  10.   turtle.up()
  11. end
  12.  
  13. local function check()
  14.   while true do
  15.     event, id, text = os.pullEvent()
  16.     if event == "rednet_message" then
  17.       if text == "KILL" then
  18.         if place == 0 then
  19.           moveTo()
  20.           place = 1
  21.         end
  22.       else if text == "BACK OFF" then
  23.         if place == 1 then
  24.           moveFrom()
  25.           place = 0
  26.         end
  27.       end
  28.     end
  29.   end  
  30. end
  31.  
  32.  
  33. local function attack()
  34.   while true do
  35.   turtle.attack()
  36.   end
  37. end
  38.  
  39. parrallel.waitforAny(attack, check)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement