lumixe

Untitled

Nov 1st, 2013
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. side = "bottom"
  2.  
  3. argv = { ... }
  4.  
  5. if #argv ~= 1 then
  6. print("Usage: scan <radius>")
  7. return
  8. end
  9.  
  10. radius = tonumber(argv[1])
  11.  
  12. if radius < 1 or radius > 9999 then
  13. print("Radius must be between 1 and 9999")
  14. return
  15. end
  16.  
  17. radar = peripheral.wrap(side)
  18.  
  19. if radar.getEnergyLevel() < radius * radius then
  20. print("Low energy level. Sasaj")
  21. return
  22. end
  23. radar.scanRadius(radius)
  24. sleep(2)
  25.  
  26. print("Scanning...")
  27.  
  28. seconds = 2
  29. repeat
  30. count = radar.getResultsCount()
  31. sleep(1)
  32. seconds = seconds + 1
  33. until count ~= 0 or seconds > 31
  34. print("took "..seconds.." seconds")
  35.  
  36. if count > 0 then
  37. for i=0, count-1 do
  38. freq, x, y, z = radar.getResult(i)
  39. print("Shit: "..freq.." ("..x.. " " .. y .. " " .. z .. ")")
  40. end
  41. else
  42. print("Nothing is found =(")
  43. end
Advertisement
Add Comment
Please, Sign In to add comment