Fixed radar ping script

Fixed radar ping script when scanning more than 999 blocks radius
This commit is contained in:
LemADEC 2014-10-02 02:08:37 +02:00
parent 6af07ba4d4
commit 6a4713dc45

View file

@ -30,20 +30,20 @@ if radar.getEnergyLevel() < radius * radius then
return return
end end
radar.scanRadius(radius) radar.scanRadius(radius)
sleep(2) sleep(0.5)
print("Scanning...") print("Scanning...")
local seconds = 2 local seconds = 0
local count = nil local count = nil
repeat repeat
count = radar.getResultsCount() count = radar.getResultsCount()
sleep(1) sleep(1)
seconds = seconds + 1 seconds = seconds + 1
until count ~= nil or seconds > 10 until (count ~= nil and count ~= -1) or seconds > 10
print("took "..seconds.." seconds") print("took "..seconds.." seconds")
if count ~= nil then if count ~= nil and count > 0 then
for i=0, count-1 do for i=0, count-1 do
freq, x, y, z = radar.getResult(i) freq, x, y, z = radar.getResult(i)
print("Ship '"..freq.."' @ ("..x.. " " .. y .. " " .. z .. ")") print("Ship '"..freq.."' @ ("..x.. " " .. y .. " " .. z .. ")")