Steve Jackson Games - Site Navigation
Home General Info Follow Us Search Illuminator Store Forums What's New Other Games Ogre GURPS Munchkin Our Games: Home

Go Back   Steve Jackson Games Forums > Roleplaying > GURPS > GURPS Character Assistant

Reply
 
Thread Tools Display Modes
Old 06-05-2009, 09:07 AM   #1
Stormcrow
 
Join Date: Aug 2004
Location: Ronkonkoma, NY
Default #Choice syntax

I want to give the user a choice of Military Ranks 1–4. I think the #Choice directive is the one I want, but I'm not sure where to put it. The wiki says "the output generated by this directive will be inserted in place of the result variables, instead of in place of this directive." I don't understand what this means. I tried something along the lines of

adds(#Choice(AD:Military Rank=1, AD:Military Rank=2, AD:Military Rank=3, AD:Military Rank=4))

but that doesn't seem to work. I get the choice when applying the template, but Military Rank doesn't show up in the character.
Stormcrow is offline   Reply With Quote
Old 06-05-2009, 02:09 PM   #2
ericbsmith
 
ericbsmith's Avatar
 
Join Date: Aug 2004
Location: Binghamton, NY, USA. Near the river Styx in the 5th Circle.
Default Re: #Choice syntax

Your best bet is to look in the existing data files for examples and copy from there - that's almost invariably what I end up doing all the time when I'm writing the official files.

All #Directives go within an x() tag; this tag is parsed then emptied once added to the character. The output can be in any other part of the trait.
Code:
adds(AD:Rank = %examplealiaslist%),
	x(#ChoiceList(_
			  name(example),
			  title(Rank Choice),
			  text(Choose the level of Rank you'd lie to have:),
			  picksallowed(atleast 1),
			  method(bynumber),
			  list(_
				 "Rank 1",
				 "Rank 2",
				 "Rank 3",
				 "Rank 4" _
				 ),
			  aliaslist(_
				 "1",
				 "2",
				 "3",
				 "4" _
				 )_
			)_
	)
__________________
Eric B. Smith GURPS Data File Coordinator
GURPSLand
I shall pull the pin from this healing grenade and...
Kaboom-baya.
ericbsmith is offline   Reply With Quote
Old 06-05-2009, 04:34 PM   #3
Stormcrow
 
Join Date: Aug 2004
Location: Ronkonkoma, NY
Default Re: #Choice syntax

Quote:
Originally Posted by ericbsmith View Post
Your best bet is to look in the existing data files for examples and copy from there - that's almost invariably what I end up doing all the time when I'm writing the official files.
Yeah, I do that. I didn't find any with the #Choice directive, though.

Quote:
All #Directives go within an x() tag; this tag is parsed then emptied once added to the character. The output can be in any other part of the trait.
What does that mean, "the output can be in any other part of the trait"? The output doesn't just live by itself in the x() tag, so where does it go?

Quote:
adds(AD:Rank = %examplealiaslist%),
How exactly does %examplealiaslist% work, and what other variables are there? Is this where the #Choice output goes?
Stormcrow is offline   Reply With Quote
Old 06-05-2009, 09:51 PM   #4
tmedwards
 
tmedwards's Avatar
 
Join Date: Feb 2006
Location: Krotz Springs, LA US
Default Re: #Choice syntax

Quote:
Originally Posted by Stormcrow View Post
How exactly does %examplealiaslist% work ... ? Is this where the #Choice output goes?
AFAIK: The replacement token %examplealiaslist% is generated by the #ChoiceList. Its name is derived from the name() tag of the #ChoiceList, which was "example" in Eric's example, and the name of the aliaslist() tag. Its value, as you've probably already surmised, is the selected item's alias as defined by the aliaslist() tag (i.e. if the user selects "Rank 3", %examplealiaslist% is replaced with 3).

That's about the extent of my knowledge here, unfortunately.
__________________
Thomas M. EDWARDS <tmedwards@motoslave.net>

GCA4 resources: GCA Repository, Phoenix (r66), GMCS (2.17), Bookish (r12)
tmedwards is offline   Reply With Quote
Old 06-06-2009, 06:28 AM   #5
Stormcrow
 
Join Date: Aug 2004
Location: Ronkonkoma, NY
Default Re: #Choice syntax

Ah, okay. So I put the concatenation of name() + "aliaslist" (surrounded by %s) somewhere in the item. The #ChoiceList will display the list() to the user and return his choice as the corresponding item from aliaslist() to wherever the variable is in the item.

I see that the Mechanic skill uses %examplelist% instead of %examplealiaslist%, and it has a list() but no aliaslist(). Thus, you can use %namelist% as well, if you don't need an aliaslist().

I suppose the aliaslist() corresponds to the list() in a one-to-one manner?

The name() tag, therefore, lets you use more than one #ChoiceList in an item, by naming your variable.

I'll bet all this would work for just plain old #Choice too...

Thanks! That helps a lot!
Stormcrow is offline   Reply With Quote
Old 06-06-2009, 08:57 AM   #6
ericbsmith
 
ericbsmith's Avatar
 
Join Date: Aug 2004
Location: Binghamton, NY, USA. Near the river Styx in the 5th Circle.
Default Re: #Choice syntax

Quote:
Originally Posted by Stormcrow View Post
I see that the Mechanic skill uses %examplelist% instead of %examplealiaslist%, and it has a list() but no aliaslist(). Thus, you can use %namelist% as well, if you don't need an aliaslist().
Correct. In fact, if need be you can use both %namelist% and %namealiaslist% to output two different strings to two different locations in the trait, e.g. to output the %namelist% to the nameext() for displaying on the printout and %namealiaslist% to the needs() tag.

Quote:
Originally Posted by Stormcrow View Post
I suppose the aliaslist() corresponds to the list() in a one-to-one manner?

The name() tag, therefore, lets you use more than one #ChoiceList in an item, by naming your variable.
Correct on both counts.

There's more information here and here as well.
__________________
Eric B. Smith GURPS Data File Coordinator
GURPSLand
I shall pull the pin from this healing grenade and...
Kaboom-baya.
ericbsmith is offline   Reply With Quote
Old 06-06-2009, 05:59 PM   #7
Stormcrow
 
Join Date: Aug 2004
Location: Ronkonkoma, NY
Default Re: #Choice syntax

Ah! I hadn't seen those before. Thanks!
Stormcrow is offline   Reply With Quote
Reply

Tags
gca


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Fnords are Off
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 10:46 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2024, vBulletin Solutions, Inc.