Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- side = "bottom"
- argv = { ... }
- if #argv ~= 1 then
- print("Usage: scan <radius>")
- return
- end
- radius = tonumber(argv[1])
- if radius < 1 or radius > 9999 then
- print("Radius must be between 1 and 9999")
- return
- end
- radar = peripheral.wrap(side)
- if radar.getEnergyLevel() < radius * radius then
- print("Low energy level. Sasaj")
- return
- end
- radar.scanRadiusW(radius)
- sleep(2)
- print("Scanning...")
- seconds = 2
- repeat
- count = radar.getResultsCountW()
- sleep(1)
- seconds = seconds + 1
- until count ~= 0 or seconds > 31
- print("took "..seconds.." seconds")
- if count > 0 then
- for i=0, count-1 do
- freq, x, y, z = radar.getResultW(i)
- print("Shit: "..freq.." ("..x.. " " .. y .. " " .. z .. ")")
- end
- else
- print("Nothing is found =(")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement