View unanswered posts | View active topics It is currently Mon Apr 20, 2026 6:22 am



Reply to topic  [ 7 posts ] 
 Using Terminal Menu's in a script 
Author Message
Ensign

Joined: Wed Nov 06, 2002 3:00 am
Posts: 270
Unread post Using Terminal Menu's in a script
Decided recently to try to get back into the game, and scripting, and I am trying to write a simple script to plot a course. I was told to use the TWX database whenever possible for speed, and I found a Terminal Menu command that seems like it might work just need to know how you incorporate it into scripts.

The command is TWX_PLOTCOURSE

I tried it out through TWX itself, using the data menu, and it came up and asked for a 'from sector' and a 'to sector'. Is there a way to use it in a script so that you can getInput from the user and then have TWX_PLOTCOURSE either echo the course or save it as a variable that can be worked on?

Say for example to use the script as an include and then have it save the course as a variable, which you could then call up from the main script and process the variable as needed to grab the data out.

I know if you don't have a big database, like you haven't run your ZTM yet, you will run into situations when you can't get the course from the database. So I am going to go ahead and work on the code section to get the data straight from the game's computer menu. Just wanted to put this in for speed whenever it could get the data from the database.

Thanks


Mon May 30, 2011 5:19 pm
Profile
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: Using Terminal Menu's in a script
Yea, you can either use the in-game CIM and computer calculations, or you can use getCourse to plot a course internally and output the results.

_________________
May the unholy fires of corbomite ignite deep within the depths of your soul...

1. TWGS server @ twgs.navhaz.com
2. The NavHaz Junction - Tradewars 2002 Scripts, Resources and Downloads
3. Open IRC chat @ irc.freenode.net:6667 #twchan
4. Parrothead wrote: Jesus wouldn't Subspace Crawl.

*** SG memorial donations via paypal to: dpocky68@booinc.com
Image


Mon May 30, 2011 5:31 pm
Profile ICQ WWW
Ensign

Joined: Wed Nov 06, 2002 3:00 am
Posts: 270
Unread post Re: Using Terminal Menu's in a script
Thanks Singularity. When I use getCourse in a script, it just returns the length of the course, what I wanted was the actual sectors along the route.

So I was going to have the script go to the Computer Prompt in the game, plot a course and capture the lines as they came out, then strip out the > and ( ) and be left with the numbers (after I used mergeText to combine the lines). Thanks for reminding me about CIM, the CIM would probably be faster I'm guessing.

I was just thinking that TWX_PLOTCOURSE might work if it saved the course as one variable and then dumped that to the screen when you used the menu's in TWX under 'data' and selected 'plot course' or whatever it was.

My idea if TWX_PLOTCOURSE worked like that was to pluck out each sector in the route, and use them to populate an array, then you could use it for various things - such as keeping track of your route so like if you are moving and don't want to run up on an enemy sector you could have your script run scans and check the next sector in your route to see if there's anything in there.

I know there are scripts out there that already have that in there, like world trade and world SSM scripts with protection, was just using it as a simple scripting exercise to try to get back into the swing of things, my skills are a *bit* rusty :lol:


Mon May 30, 2011 6:16 pm
Profile
Veteran Op
User avatar

Joined: Thu Jun 02, 2005 2:00 am
Posts: 5558
Location: USA
Unread post Re: Using Terminal Menu's in a script
getDistance returns the distance, getCourse returns the entire course as an array.

http://www.navhaz.com/files/script.html#CMD_16

_________________
May the unholy fires of corbomite ignite deep within the depths of your soul...

1. TWGS server @ twgs.navhaz.com
2. The NavHaz Junction - Tradewars 2002 Scripts, Resources and Downloads
3. Open IRC chat @ irc.freenode.net:6667 #twchan
4. Parrothead wrote: Jesus wouldn't Subspace Crawl.

*** SG memorial donations via paypal to: dpocky68@booinc.com
Image


Mon May 30, 2011 6:53 pm
Profile ICQ WWW
Ensign

Joined: Wed Nov 06, 2002 3:00 am
Posts: 270
Unread post Re: Using Terminal Menu's in a script
Thanks Sing! I was using TWX IDE to write the script, because it has short descriptions of the commands in it. The part about getCourse populating an Array wasn't in the IDE short description though. I guess I better keep the twx script help file open for reference while I'm writing scripts, until I get the commands refreshed in my mind better :oops: Actually, probably be better to keep that open all the time since my memory isn't what it used to be :lol:


Mon May 30, 2011 8:19 pm
Profile
Commander
User avatar

Joined: Tue Oct 07, 2003 2:00 am
Posts: 1134
Location: Augusta, GA
Unread post Re: Using Terminal Menu's in a script
That's a good point about TWX IDE. It includes the command syntax, but not the notes or examples. For those, refer to the script reference.

And of course, the scripters here are usually eager to offer advice and examples.

_________________
Claim to Fame: only guy to ever crack the TW haggle algorithm, and fig/shield/hold price formula, twice.


Tue May 31, 2011 6:27 pm
Profile WWW
Ensign

Joined: Wed Nov 06, 2002 3:00 am
Posts: 270
Unread post Re: Using Terminal Menu's in a script
yes EP I can't count (well my counting isn't that good but I'm sure I could make a count, it's a lot :lol: ) how many times you or Sing or other scripters have helped out just with my newb questions alone. I would be lost without this place! And I can't speak for the other amateur scripters out there but I really appreciate the time and effort that you, Sing and the other skilled scripters that come here have given to help amateurs like me :D Thanks for that time and effort you all put into helping out.


Wed Jun 01, 2011 12:26 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by wSTSoftware.