| www.ClassicTW.com https://mail.black-squirrel.com/ |
|
| Swath Script Question https://mail.black-squirrel.com/viewtopic.php?f=15&t=33436 |
Page 1 of 1 |
| Author: | deer_buster [ Sat Aug 25, 2012 10:32 am ] |
| Post subject: | Swath Script Question |
Is it possible to act on a choice during the script initScript method? For instance, I want options to change based on what is selected in a choice. I haven't yet found an example of that happening anywhere, and wanted to know if anyone knew if it was possible and how if it is... TIA db |
|
| Author: | deer_buster [ Sat Aug 25, 2012 10:29 pm ] |
| Post subject: | Re: Swath Script Question |
anyone? |
|
| Author: | Helix [ Sat Aug 25, 2012 10:36 pm ] |
| Post subject: | Re: Swath Script Question |
Your best bet is to email stein, I dont know anyone who uses swath for java scripts. H |
|
| Author: | Mongoose [ Sun Aug 26, 2012 2:51 am ] |
| Post subject: | Re: Swath Script Question |
Edit: Oh, I think I get what you're saying. Like, if you have three different modes for a script, and you want to ask the user for different parameters in each mode? No, I doubt it. In situations like that, I've just registered all the params for every choice and ignored the ones that don't apply to the selected choice. It's not pretty, but it works. Here's a tip, though: I like to store my script settings in static fields. In Java, static fields are associated with the class instead of the object, so they retain their value between script invocations. Copy the static values into Parameters in your initScript, and then copy the values back out of the Parameters and into the static fields in your runScript. |
|
| Author: | deer_buster [ Sun Aug 26, 2012 3:03 pm ] |
| Post subject: | Re: Swath Script Question |
Mongoose wrote: Edit: Oh, I think I get what you're saying. Like, if you have three different modes for a script, and you want to ask the user for different parameters in each mode? No, I doubt it. In situations like that, I've just registered all the params for every choice and ignored the ones that don't apply to the selected choice. It's not pretty, but it works. Here's a tip, though: I like to store my script settings in static fields. In Java, static fields are associated with the class instead of the object, so they retain their value between script invocations. Copy the static values into Parameters in your initScript, and then copy the values back out of the Parameters and into the static fields in your runScript. Interesting...could do something like a re-init the script, using the values from the Static vars between initializations... I did get a response from Stein...it's not possible in the init script portion...however, he suggested I just write my java interface using the support in swath...and have it handle everything that I want it to do...which is probably the route I am going to take. For now my next task is to attempt to capture the Game Config settings (from the "v" key), so that I can use it in my scripts as well... |
|
| Author: | Mongoose [ Sun Aug 26, 2012 6:01 pm ] |
| Post subject: | Re: Swath Script Question |
SWATH stores the * info and makes it available as Swath.main.gameSettings(). If it hasn't been viewed or you want to make sure it's fresh, it might be possible to exit the game and view it from your initScript. I haven't tried. |
|
| Author: | deer_buster [ Sun Aug 26, 2012 7:35 pm ] |
| Post subject: | Re: Swath Script Question |
I don't think that is the same thing I am after, to be honest..."v" and "*" are two different things, aren't they? |
|
| Author: | Mongoose [ Sun Aug 26, 2012 8:22 pm ] |
| Post subject: | Re: Swath Script Question |
I don't think there's anything on the V screen that isn't in the * list, except the location of Stardock, which you can get from SWATH in other ways. |
|
| Author: | deer_buster [ Sun Aug 26, 2012 10:18 pm ] |
| Post subject: | Re: Swath Script Question |
Are you talking about when you press * at the command prompt???? |
|
| Author: | Helix [ Sun Aug 26, 2012 10:33 pm ] |
| Post subject: | Re: Swath Script Question |
From the Game Menu (after choosing the game, where you press 'T') type '*' H |
|
| Author: | deer_buster [ Mon Aug 27, 2012 12:06 am ] |
| Post subject: | Re: Swath Script Question |
oh, heh, I rarely see that anymore |
|
| Page 1 of 1 | All times are UTC - 5 hours |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|