View difference between Paste ID: XYz7ibcx and E287bCni
SHOW: | | - or go back to the newest paste.
1
side = "bottom"
2
3
local argv = { ... }
4
if #argv ~= 1 then
5
  print("Usage: scan <radius>")
6
  return
7
end
8
9
local radius = tonumber(argv[1])
10
11
if radius < 1 or radius > 9999 then
12
  print("Radius must be between 1 and 9999")
13
  return
14
end
15
16
radar = peripheral.wrap(side)
17
18
if radar.getEnergyLevel() < radius * radius then
19
  print("Low energy level. Sasaj")
20
  return
21
end
22-
radar.scanRadiusW(radius)
22+
radar.scanRadius(radius)
23
sleep(2)
24
25
print("Scanning...")
26
27
local seconds = 2
28
repeat
29-
 local count = radar.getResultsCountW()
29+
 count = radar.getResultsCount()
30
 sleep(1)
31
 seconds = seconds + 1
32
until count ~= 0 or seconds > 31
33
print("took "..seconds.." seconds")
34
35
if count > 0 then
36
  for i=0, count-1 do
37-
    freq, x, y, z = radar.getResultW(i)
37+
    freq, x, y, z = radar.getResult(i)
38
    print("Shit: "..freq.." ("..x.. " " .. y .. " " .. z .. ")")
39
  end
40
else
41
  print("Nothing is found =(")
42
end