www.ClassicTW.com
http://classictw.com/

TWX 2.05 Issue
http://classictw.com/viewtopic.php?f=15&t=32509
Page 1 of 1

Author:  Promethius [ Thu Nov 10, 2011 7:57 pm ]
Post subject:  TWX 2.05 Issue

I have ran into an issue with TWX 2.05 with the getDistance command. I have been receiving bad data when plotting from an unexplored sector to an explored sector. The data should give -1 as far as I know, but I am receiving distances of 10-15. A cf from the unexplored to explored fixes the getDistance but for what I am working on it messes things up a bit. I can "see" the unexplored sector from the explored sector since it is adjacent, but I don't have any knowledge of the distance (could be a one-way out).

Am I mistaken in the -1 as what should be showing up when a route/distance is unknown? I have rebuilt my TWX database from scratch thinking I might have corrupted data.

EP, if you answered my PM, I haven't been where I can check it.

Author:  T0yman [ Thu Nov 10, 2011 8:37 pm ]
Post subject:  Re: TWX 2.05 Issue

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

Author:  Vid Kid [ Thu Nov 10, 2011 8:48 pm ]
Post subject:  Re: TWX 2.05 Issue

I have the same thing happen in a game , it gave me distances larger then they were supposed to be ... I had expected a -1 because I didn't have a ztm.

My TWX is 2.04 , so its been that way ..
What I did was have script check if the ztm record was made and complete .. or use the cf to plot to and from .. all in script .. now everything is all good.

Kinda defeats having a getdistance command , but the script function has to be done to calc the fuel cost for the trip in many scripts.

I just thought this was just in my version ..

Author:  ElderProphet [ Fri Nov 11, 2011 12:42 am ]
Post subject:  Re: TWX 2.05 Issue

I sounds like what you're saying is that TWX is returning an incorrect distance when your warp data is incomplete. TWX will return the shortest distance between two sectors using the warp data it knows about. So if your warp data is incomplete, then the calculated distance may not match a CF plot. If TWX can't plot from one sector to another, then it will return -1.

Just because a sector is unexplored doesn't mean it has no warp data. Check it using the TWX database, SECTOR.WARPCOUNT[sector]. If that number is zero, then any plot from that sector to any other sector should yield -1.

Don't hesitate to ask for further clarification if this still doesn't make sense, or if I've misunderstood.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/