Advertisement
Guest User

startup

a guest
Aug 28th, 2015
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.97 KB | None | 0 0
  1. os.loadAPI("ocs/apis/sensor")
  2.   p1 = peripheral.wrap("right")
  3.   p2 = peripheral.wrap("left")
  4.     prox = sensor.wrap("back")
  5.  
  6.  
  7. while true do
  8.  local target = prox.getTargets()
  9. for tarName, _ in pairs(target) do
  10.     --fetch the detailed information table for the current target.
  11.     local details = prox.getTargetDetails(tarName)
  12.     if details ~= nil then
  13.     if details.Riding ~= nil then
  14.      if details.Riding.Name == "Creeper" then
  15.        while p2.testBundledInput("left", colors.green) == false do
  16.          --print("Wait")
  17.          p1.setBundledOutput("right", colors.white)
  18.          os.sleep(1)
  19.        end
  20.       p1.setBundledOutput("right",0)
  21.       --os.reboot()
  22.       break
  23.      elseif details.Riding.Name == "Spider" then
  24.        while p2.testBundledInput("left", colors.green) == false do
  25.          --print("Wait")
  26.          p1.setBundledOutput("right", colors.black)
  27.          os.sleep(1)
  28.        end
  29.       p1.setBundledOutput("right",0)
  30.       --os.reboot()
  31.       break
  32.      elseif details.Riding.Name == "Skeleton" then
  33.        while p2.testBundledInput("left", colors.green) == false do
  34.         -- print("Wait")
  35.          p1.setBundledOutput("right", colors.gray)
  36.           os.sleep(1)
  37.        end
  38.       p1.setBundledOutput("right",0)
  39.       --os.reboot()
  40.       break
  41.      elseif details.Riding.Name == "Zombie" then
  42.        while p2.testBundledInput("left", colors.green) == false do
  43.        --  print("Wait")
  44.          p1.setBundledOutput("right", colors.green)
  45.          --os.reboot()
  46.          os.sleep(1)
  47.        end
  48.       p1.setBundledOutput("right",0)
  49.       break
  50.      else
  51.        while p2.testBundledInput("left", colors.green) == false do
  52.        --  print("Wait")
  53.          p1.setBundledOutput("right", colors.brown)
  54.          --os.reboot()
  55.          os.sleep(1)
  56.        end
  57.       p1.setBundledOutput("right",0)
  58.       break
  59.      end
  60.     else
  61.      --os.reboot()
  62.      break    
  63.     end
  64.     else
  65.     break
  66.     end
  67.    
  68. end
  69. os.sleep(1.2)
  70. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement