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

Using CIMM data in TWX scripts
https://mail.black-squirrel.com/viewtopic.php?f=15&t=13111
Page 1 of 1

Author:  Gemini [ Mon Mar 21, 2005 10:40 am ]
Post subject: 

I'm trying to write a few scripts that will grab cim data, for example:

141 6040 100% - 2590 100% -21690 100%

now if I could get it to stop at each line, I could use getword to grab percentages, find amounts, get the sector # and save it to file to compare against the next cim. But I'm not sure what to use as a trigger, do I set it up so that every sector in game is a trigger? And then it check that the # is in the first word? It seems like it would be crazy to set up. Can anybody recomend a better way to do this?

Author:  Psion [ Mon Mar 21, 2005 3:09 pm ]
Post subject: 

Well, like most scripting tasks, theres a number of ways you could go about it. They way I would do it is to have the script use a WaitFor ": " right after you enter CIM mode, that will halt execution and have the script waiting right at point where the next lines coming across the screen will be the info you are looking for, i.e. the port listings. Then set a TextLineTrigger to look for the % sign, since that is something that EVERY line you want will have, and finally a last trigger to detect when the CIM is over. So that snippet of code might look something like:

WaitFor ": "

:portlist
SetTextLineTrigger getport :getport "% "
SetTextLineTrigger done :done ": "
pause

:getport
killTrigger done
setVar $cline CURRENTLINE
##get port info from $cline here
goto :portlist

:done
killTrigger getport

Hope that helps, I left the part where you would actually get the port info pretty vague since I don't know what information you are looking for or how you plan on storing it. If I didnt make that clear enough or you have other questions, either reply here or drop me an ICQ at 211279673.

Author:  Harley Nuss [ Mon Mar 21, 2005 3:20 pm ]
Post subject: 

Why are you wanting to grab the raw data? TWX will record it for you then you can access it via PORT.PERCENTFUEL[sector], etc

Author:  Gemini [ Mon Mar 21, 2005 4:30 pm ]
Post subject: 

thank you both for your help.

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