I ran a test using the following script in TWX 2.05:
Code:
#Check Getdistance Command
echo "*Check how many random sectors!"
getconsoleinput $max
setvar $i 1
setvar $home CURRENTSECTOR
while ($i <= $max)
getrnd $dist[$i] 11 30000
getdistance $test[$i] $home $dist[$i]
add $i 1
end
setvar $i 1
send "*"
waitfor "Command [TL"
echo "*"
while ($i <= $max)
echo $i "." " Distance from " $home " to " $dist[$i] " = " $test[$i] "*"
add $i 1
end
halt
I got -1 for everything until I ran a ZTM.
1. Distance from 13477 to 21508 = 10
2. Distance from 13477 to 12860 = 23
3. Distance from 13477 to 3996 = 17
4. Distance from 13477 to 25537 = 19
5. Distance from 13477 to 29953 = 11
6. Distance from 13477 to 19233 = 18
7. Distance from 13477 to 8160 = 8
8. Distance from 13477 to 5875 = 13
9. Distance from 13477 to 9440 = 12
10. Distance from 13477 to 27163 = 21
I changed so both were random, ran a couple hundred.
Code:
#Check Getdistance Command
echo "*Check how many random sectors!"
getconsoleinput $max
setvar $i 1
#setvar $home[$i] CURRENTSECTOR
while ($i <= $max)
getrnd $home[$i] 11 30000
getrnd $dist[$i] 11 30000
getdistance $test[$i] $home[$i] $dist[$i]
add $i 1
end
setvar $i 1
send "*"
waitfor "Command [TL"
echo "*"
while ($i <= $max)
echo $i "." " Distance from " $home[$i] " to " $dist[$i] " = " $test[$i] "*"
add $i 1
end
halt
1. Distance from 27490 to 23962 = 23
2. Distance from 23492 to 8184 = 13
3. Distance from 10103 to 26118 = 14
4. Distance from 15802 to 16871 = 18
5. Distance from 27026 to 16676 = 14
6. Distance from 20756 to 5716 = 12
7. Distance from 17218 to 5903 = 24
8. Distance from 10120 to 27945 = 24
9. Distance from 11715 to 15654 = 14
10. Distance from 18853 to 29264 = 17