View unanswered posts | View active topics It is currently Fri Apr 17, 2026 11:41 am



Reply to topic  [ 11 posts ] 
 Swath Script Question 
Author Message
Sergeant Major
User avatar

Joined: Thu Aug 09, 2012 12:39 am
Posts: 54
Unread post 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

_________________
Happiness is a mature buck lined up in the crosshairs!


Sat Aug 25, 2012 10:32 am
Profile
Sergeant Major
User avatar

Joined: Thu Aug 09, 2012 12:39 am
Posts: 54
Unread post Re: Swath Script Question
anyone?

_________________
Happiness is a mature buck lined up in the crosshairs!


Sat Aug 25, 2012 10:29 pm
Profile
Ambassador
User avatar

Joined: Wed Nov 12, 2008 8:57 am
Posts: 3554
Location: Long Beach, CA
Unread post Re: Swath Script Question
Your best bet is to email stein, I dont know anyone who uses swath for java scripts.

H

_________________
Helix
Do I really look like a guy with a plan? You know what I am? I'm a dog chasing cars.
Lest we forget
I had to ask myself WWSGD?


Sat Aug 25, 2012 10:36 pm
Profile WWW
Commander
User avatar

Joined: Mon Oct 29, 2001 3:00 am
Posts: 1096
Location: Tucson, AZ
Unread post 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.

_________________
Suddenly you're Busted!


Sun Aug 26, 2012 2:51 am
Profile WWW
Sergeant Major
User avatar

Joined: Thu Aug 09, 2012 12:39 am
Posts: 54
Unread post 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...

_________________
Happiness is a mature buck lined up in the crosshairs!


Sun Aug 26, 2012 3:03 pm
Profile
Commander
User avatar

Joined: Mon Oct 29, 2001 3:00 am
Posts: 1096
Location: Tucson, AZ
Unread post 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.

_________________
Suddenly you're Busted!


Sun Aug 26, 2012 6:01 pm
Profile WWW
Sergeant Major
User avatar

Joined: Thu Aug 09, 2012 12:39 am
Posts: 54
Unread post 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?

_________________
Happiness is a mature buck lined up in the crosshairs!


Sun Aug 26, 2012 7:35 pm
Profile
Commander
User avatar

Joined: Mon Oct 29, 2001 3:00 am
Posts: 1096
Location: Tucson, AZ
Unread post 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.

_________________
Suddenly you're Busted!


Sun Aug 26, 2012 8:22 pm
Profile WWW
Sergeant Major
User avatar

Joined: Thu Aug 09, 2012 12:39 am
Posts: 54
Unread post Re: Swath Script Question
Are you talking about when you press * at the command prompt????

_________________
Happiness is a mature buck lined up in the crosshairs!


Sun Aug 26, 2012 10:18 pm
Profile
Ambassador
User avatar

Joined: Wed Nov 12, 2008 8:57 am
Posts: 3554
Location: Long Beach, CA
Unread post Re: Swath Script Question
From the Game Menu (after choosing the game, where you press 'T') type '*'

H

_________________
Helix
Do I really look like a guy with a plan? You know what I am? I'm a dog chasing cars.
Lest we forget
I had to ask myself WWSGD?


Sun Aug 26, 2012 10:33 pm
Profile WWW
Sergeant Major
User avatar

Joined: Thu Aug 09, 2012 12:39 am
Posts: 54
Unread post Re: Swath Script Question
oh, heh, I rarely see that anymore :D

_________________
Happiness is a mature buck lined up in the crosshairs!


Mon Aug 27, 2012 12:06 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 11 posts ] 

Who is online

Users browsing this forum: No registered users and 6 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.