| Author |
Message |
|
Hotblack Desiato
Ensign
Joined: Tue Jul 21, 2009 2:37 pm Posts: 241 Location: Ottawa, Canada
|
 MetaScripting
So, I'm trying to write some meta scripts that control other scripts, but I'm running into a problem with triggers.
The subscripts often KillAllTriggers... which I guess kills my meta script triggers as well.
This will happen no matter how I call the subscripts, right? At the moment I'm calling a subscript via command to Mombot... but whether it's an include, a load, or whatever, killAllTriggers really kills all of em, right?
So my question is... is there some way to do this without messing with the subscripts? Because the only solution I can see is to go through the subscripts replacing killAllTriggers with specific trigger-killing.
|
| Sat Sep 19, 2009 9:36 am |
|
 |
|
Hotblack Desiato
Ensign
Joined: Tue Jul 21, 2009 2:37 pm Posts: 241 Location: Ottawa, Canada
|
 Re: MetaScripting
I guess the best way is to go with Zoc meta-scripts?
|
| Sat Sep 19, 2009 10:36 am |
|
 |
|
Singularity
Veteran Op
Joined: Thu Jun 02, 2005 2:00 am Posts: 5558 Location: USA
|
 Re: MetaScripting
killAllTriggers only kills the triggers associated with a particular script. So if you have a controller script and killAllTriggers, it will only kill the triggers within the controller.
KillAllTriggers will kill all triggers within includes. Of course you can just kill the specific triggers you need to kill, it's better coding practice anyway.
You can hit $st to see what triggers are active at the moment. Try these various things and see how they work, best way to learn.
_________________ 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
|
| Sat Sep 19, 2009 10:52 am |
|
 |
|
Hotblack Desiato
Ensign
Joined: Tue Jul 21, 2009 2:37 pm Posts: 241 Location: Ottawa, Canada
|
 Re: MetaScripting
Singularity wrote: killAllTriggers only kills the triggers associated with a particular script. So if you have a controller script and killAllTriggers, it will only kill the triggers within the controller.
Thanks, good to know it does work that way... I thought maybe triggers of all running scripts were killed, which would suck. Must be some other problem ... my controller is terminating unexpectedly when it should be waiting for an end-trigger from a subscript.
|
| Sat Sep 19, 2009 11:20 am |
|
 |
|
Singularity
Veteran Op
Joined: Thu Jun 02, 2005 2:00 am Posts: 5558 Location: USA
|
 Re: MetaScripting
One script doesn't pass triggers to another. If the controller is terminating then you can use watchpoints to determine what it's firing on, then figure out why.
_________________ 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
|
| Sat Sep 19, 2009 1:38 pm |
|
 |
|
Hotblack Desiato
Ensign
Joined: Tue Jul 21, 2009 2:37 pm Posts: 241 Location: Ottawa, Canada
|
 Re: MetaScripting
Zoc seems very cool for some types of meta scripting... I can pass preset params to script menus via terminal. Only problem is passing variables between zoc and twx...
|
| Sat Sep 26, 2009 2:55 pm |
|
 |
|
Singularity
Veteran Op
Joined: Thu Jun 02, 2005 2:00 am Posts: 5558 Location: USA
|
 Re: MetaScripting
Only way you really can, via file. You can either use saveVar and parse the .cfg file, or read/write to an external config file.
_________________ 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
|
| Sat Sep 26, 2009 4:43 pm |
|
 |
|
Hotblack Desiato
Ensign
Joined: Tue Jul 21, 2009 2:37 pm Posts: 241 Location: Ottawa, Canada
|
 Re: MetaScripting
Yeah, that's what i'm doing at the moment but I keep thinking there must be some way to use the terminal to query twx
|
| Sat Sep 26, 2009 6:04 pm |
|
 |
|
Phead
Private 1st Class
Joined: Sat Sep 26, 2009 8:25 pm Posts: 2
|
 Re: MetaScripting
Processin can be used to set off triggers in other running scripts but there is no way to parse direct into the menus from a script.
|
| Sat Sep 26, 2009 10:06 pm |
|
 |
|
Vid Kid
Commander
Joined: Sun Feb 25, 2001 3:00 am Posts: 1838 Location: Guam USA
|
 Re: MetaScripting
you might try to write to a file in c: and that way you only have the info you want to pull to other script regardless of what language.
The .cfg has alot of info and would make getting the var info your looking for harder to get.
_________________ TWGS V2 Vids World on Guam Port 2002 Telnet://vkworld.ddns.net:2002 Discord @ DiverDave#8374 Vid's World Discord
Founding Member -=[Team Kraaken]=- Ka Pla
 Winners of Gridwars 2010 MBN Fall Tournament 2011 winners Team Kraaken Undisputed Champions of 2019 HHT Just for showing up!
The Oldist , Longist Running , Orginal Registered Owner of a TWGS server : Vids World On Guam
|
| Sat Sep 26, 2009 10:53 pm |
|
 |
|
Singularity
Veteran Op
Joined: Thu Jun 02, 2005 2:00 am Posts: 5558 Location: USA
|
 Re: MetaScripting
Quote: The .cfg has alot of info and would make getting the var info your looking for harder to get. Certainly true... BUT... think about it, if you do a lot of this kind of cross-platform scripting then a zoc library to read/write twxproxy .CFG files and pull the loadVar/saveVar stuff out would be really useful. Regex could pull it off pretty easily, too.
_________________ 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
|
| Sat Sep 26, 2009 11:43 pm |
|
 |
|
Hotblack Desiato
Ensign
Joined: Tue Jul 21, 2009 2:37 pm Posts: 241 Location: Ottawa, Canada
|
 Re: MetaScripting
Singularity wrote: Quote: The .cfg has alot of info and would make getting the var info your looking for harder to get. Certainly true... BUT... think about it, if you do a lot of this kind of cross-platform scripting then a zoc library to read/write twxproxy .CFG files and pull the loadVar/saveVar stuff out would be really useful. Regex could pull it off pretty easily, too. Yes, RegEx. Vid's solution is easier to implement but less useful in the long run. Still thinking about ways around the filesystem though. I can read twx menus and choose options using zoc... maybe I could write a twx script that uses processOut to pass vars to the zoc script (for example, size of fig wave), and then the zoc script could send that to the twx menu of the other twx script it is opening. I'm gonna play with the idea, anyway.
|
| Sun Sep 27, 2009 11:45 am |
|
 |
|
Singularity
Veteran Op
Joined: Thu Jun 02, 2005 2:00 am Posts: 5558 Location: USA
|
 Re: MetaScripting
Quote: Still thinking about ways around the filesystem though. I can read twx menus and choose options using zoc... maybe I could write a twx script that uses processOut to pass vars to the zoc script (for example, size of fig wave), and then the zoc script could send that to the twx menu of the other twx script it is opening. I'm gonna play with the idea, anyway. Yes, if all you have a single action and a variable connected to it, that will work. If you're talking about a background process, you'd end up flooding yourself. If a single action=variable combo is all you need... You could pass info from twxproxy to zoc easily. Echo "Var: blah" and just zoc trigger off that. Passing it back is tricky. You'd have to buffer it on a prompt that lets you send info, and trigger on that. An SS msg could do it, just send an SS msg, the var, and a bunch of backspaces all in a burst. You might be able to get twxproxy to trigger on that (processout won't work, but a textlinetrigger might). If all you need is to handle menus, well, that's easily done tho, sure. You could just trigger off the loading of the script and have zoc send the settings and go.
_________________ 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
|
| Sun Sep 27, 2009 3:29 pm |
|
 |
|
Hotblack Desiato
Ensign
Joined: Tue Jul 21, 2009 2:37 pm Posts: 241 Location: Ottawa, Canada
|
 Re: MetaScripting
Singularity wrote: If all you need is to handle menus, well, that's easily done tho, sure. You could just trigger off the loading of the script and have zoc send the settings and go. Yep... and so far I've found zoc to be the best option for easy access to scripts. At first I was 'Mommifying" scripts, when I had access to the source code, but then I realized that for most of them it was a lot easier to just set up a swath trigger to a zoc menu script (Vid originally introduced me to zoc menus). For complex scripts such as LS' Oz Pdrop, there can be a zoc submenu for the entire script, each menu option calling the script and sending whatever parameters to the menu. Best of all, this can be done without access to the .ts. I guess that describes a little better what I'm doing. The current problem then is basically that since the zoc menus don't have direct access to game variables and such, I'm trying to find the best way of accesing those. So far, savevar and reading the .cfg file seems like the best solution, except for the file access hit... and I also noticed what look like some inconsistencies in the way the file is formatted, but of course twx is open now so I guess I could figure that out. Of course there are also Swath macro strings, but those have to be set manually (using swath's cumbersome UI) for every game, because the info is not stored in plaintext (right?)... and they aren't accessible from zoc as far as I can tell.
|
| Sun Sep 27, 2009 4:09 pm |
|
 |
|
Hotblack Desiato
Ensign
Joined: Tue Jul 21, 2009 2:37 pm Posts: 241 Location: Ottawa, Canada
|
 Re: MetaScripting
Anyone tried hexing swath game file for the macro strings?
(edit:) I guess it's easier to just do what Vid said than bother with macro strings... or maybe a combination of the two solutions. Read the twxgame.cfg file, but save to a new file in my own format.
|
| Sun Sep 27, 2009 4:17 pm |
|
 |
|