www.ClassicTW.com
https://mail.black-squirrel.com/

TWX command question
https://mail.black-squirrel.com/viewtopic.php?f=15&t=21599
Page 1 of 1

Author:  mob [ Tue Feb 24, 2009 7:27 am ]
Post subject:  TWX command question

"getCourse" does it use ZTM for data or what? Would it be more accurate pulling from computer?

Author:  Vid Kid [ Tue Feb 24, 2009 8:27 am ]
Post subject:  Re: TWX command question

GetCourse does not always work 100% of time.
Its nice when the ztm is complete and it works right.

But in a pinch I will just use the
cf* destination* q

and trigger or waiton the course you want to check.

Author:  mob [ Tue Feb 24, 2009 8:46 am ]
Post subject:  Re: TWX command question

Yes thank you, that was always a choice also...accurate course plot is important.
Thanks Vid.

Author:  Singularity [ Tue Feb 24, 2009 8:54 am ]
Post subject:  Re: TWX command question

getCourse uses a ztm, yea. I've not had any problems w/ it, provided I've got a good one.

A computer plot works too, but that'll add some lag to the process. Also remember a CF factors in avoids, so you'll need to clear your avoids.

Author:  LoneStar [ Tue Feb 24, 2009 9:38 am ]
Post subject:  Re: TWX command question

Favorite routine of mine
Code:
setVar $FROM 1
setVar $TO 100
GetCourse $COURSE $FROM $TO
if ($COURSE = "-1")
  send "^F"&$FROM&"*"&$TO&"**Q"
  waiton ": ENDINTERROG"
  GetCourse $COURSE $FROM $TO
  if ($COURSE = "-1")
     # SEE Note Below (Bottom of this post)
     Echo "**Unable to Plot Course**"
     Halt
  end
end


Note: If you're feelign really adventurous, instead of plotting the course and using GetCourse again, you can use the courseplot code, found in a few of MD's scripts, to parse the course yourself.
On rare occasion I've had problems with getcourse, but i believe it was a data corruption in the Dbase, not the cmd itself.

Author:  Promethius [ Tue Feb 24, 2009 10:00 am ]
Post subject:  Re: TWX command question

Is there a speed advantage or data send advantage in using: send "^F"&$FROM&"*"&$TO&"**Q" over send "^F" $FROM "*" $TO "**Q"

I know the "&" concatinates the information being sent and wondering if that helps prevent fragmentation and gains a speed or reliability advantage.

Author:  LoneStar [ Tue Feb 24, 2009 10:15 am ]
Post subject:  Re: TWX command question

Promethius wrote:
Is there a speed advantage or data send advantage in using: send "^F"&$FROM&"*"&$TO&"**Q" over send "^F" $FROM "*" $TO "**Q"

I know the "&" concatinates the information being sent and wondering if that helps prevent fragmentation and gains a speed or reliability advantage.


I use the ampersand as a habbit, I've noticed that alot of the older scripts rarely use the ampersand.. however. There are instances where you not only *need* to use it, but you can't have any spaces either, ie:

"blah" & "blah" vs "blah"&"blah"

If you want to know what I'm refering too, look at MD's routine for Citkill and how it handles ANSI. If you put spaces between the ' " ' and ' & ' it will break the routine 8)

Author:  ElderProphet [ Wed Feb 25, 2009 11:55 pm ]
Post subject:  Re: TWX command question

getCourse uses warp data that TWX has gained from ZTM, probing, moving around, and data imports. Assuming the warp data is accurate, then getCourse will emulate the course plots in TradeWars. Remember that TW course plots take avoids into account like Sing said, and TWX's getCourse takes into account any avoids that the script has set via the setAvoid command.

A course plot is nothing more than a breadth-first search. Here is what getCourse looks like, as a TWX script:
Code:
clearAllAvoids
:begin
getInput $from "Enter From sector"
echo "*From = " $from
getInput $to "Enter To sector"
echo "*To = " $to
gosub :plot
goto :begin

:plot
echo "*From: " $from ", To: " $to "*"
setArray $que SECTORS
setVar $que[1] $from
setVar $path[$from] $from
setVar $distance[$from] 0
setVar $top 1
setVar $bottom 1
while ($bottom <= $top)
   setVar $focus $que[$bottom]
   if ($focus = $to)
      echo $path[$focus] " (Dist=" $distance[$focus] ")"
      return
   end
   setVar $a 1
   while ($a <= SECTOR.WARPCOUNT[$focus])
      setVar $adjacent SECTOR.WARPS[$focus][$a]
      if ($checked[$adjacent] = 0)
         add $top 1
         setVar $que[$top] $adjacent
         setVar $path[$adjacent] $path[$focus] & " > " & $adjacent
         setVar $distance[$adjacent] ($distance[$focus] + 1)
         setVar $checked[$adjacent] 1
      end
      add $a 1
   end
   add $bottom 1
end
echo "*No Path Found"
return

The getCourse command works perfectly, but it is only as good as the data that it has to work with.

Regards,
+EP+

Author:  mob [ Thu Feb 26, 2009 7:13 am ]
Post subject:  Re: TWX command question

EP, great example....yes I figured that it relied on ZTM and explored data just had to ask. Thanks for the input glad to see ya still around:)

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