RyuuzakiJulio

Cave Spider Monitor

Aug 25th, 2013
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.51 KB | None | 0 0
  1. find = "Cave"
  2.  
  3. m = peripheral.wrap("bottom")
  4. os.loadAPI("ocs/apis/sensor")
  5.  
  6. local prox = sensor.wrap("right")
  7.  
  8. while true do
  9.  count=0
  10.  m.clear()
  11.  m.setCursorPos(1,1)
  12.  m.write("Count")
  13.  
  14.  local targets = prox.getTargets()
  15.  for name, details in pairs(targets) do
  16.  
  17.   if string.find(name,find) ~= nil then
  18.    --gc=details.Position
  19.    --print("y"..gc.Y)
  20.    --print("x"..gc.X)
  21.    --print("z"..gc.Z)
  22.    count=count+1
  23.   end
  24.  end  
  25.  m.setCursorPos(2,2)
  26.  m.write(count)
  27.  m.setCursorPos(2,3)  
  28.  sleep(0.2)
  29. end
Advertisement
Add Comment
Please, Sign In to add comment