| www.ClassicTW.com https://mail.black-squirrel.com/ |
|
| MetaScripting https://mail.black-squirrel.com/viewtopic.php?f=15&t=23349 |
Page 1 of 3 |
| Author: | Hotblack Desiato [ Sat Sep 19, 2009 9:36 am ] |
| Post subject: | 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. |
|
| Author: | Hotblack Desiato [ Sat Sep 19, 2009 10:36 am ] |
| Post subject: | Re: MetaScripting |
I guess the best way is to go with Zoc meta-scripts? |
|
| Author: | Singularity [ Sat Sep 19, 2009 10:52 am ] |
| Post subject: | 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. |
|
| Author: | Hotblack Desiato [ Sat Sep 19, 2009 11:20 am ] |
| Post subject: | 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. |
|
| Author: | Singularity [ Sat Sep 19, 2009 1:38 pm ] |
| Post subject: | 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. |
|
| Author: | Hotblack Desiato [ Sat Sep 26, 2009 2:55 pm ] |
| Post subject: | 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... |
|
| Author: | Singularity [ Sat Sep 26, 2009 4:43 pm ] |
| Post subject: | 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. |
|
| Author: | Hotblack Desiato [ Sat Sep 26, 2009 6:04 pm ] |
| Post subject: | 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 |
|
| Author: | Phead [ Sat Sep 26, 2009 10:06 pm ] |
| Post subject: | 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. |
|
| Author: | Vid Kid [ Sat Sep 26, 2009 10:53 pm ] |
| Post subject: | 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. |
|
| Author: | Singularity [ Sat Sep 26, 2009 11:43 pm ] |
| Post subject: | 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. |
|
| Author: | Hotblack Desiato [ Sun Sep 27, 2009 11:45 am ] |
| Post subject: | 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. |
|
| Author: | Singularity [ Sun Sep 27, 2009 3:29 pm ] |
| Post subject: | 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. |
|
| Author: | Hotblack Desiato [ Sun Sep 27, 2009 4:09 pm ] |
| Post subject: | 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. |
|
| Author: | Hotblack Desiato [ Sun Sep 27, 2009 4:17 pm ] |
| Post subject: | 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. |
|
| Page 1 of 3 | All times are UTC - 5 hours |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|