• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Menu Arrays, do they work in Savage Worlds?

Gumbytie

Well-known member
So I have a similar question posted awhile back and a few others have asked something similar as well.

I have been unable to get "usrCandid1" and "ChooseSrc1" to work with a list of content not already defined in SW.

My example would be this edge, where I tired an Array instead:

Code:
  <thing 
	id="edgMilRank" 
	name="Military Rank" 
	description="" 
	compset="Edge" 
	summary="Select a rank" 
	uniqueness="unique">
    <fieldval field="usrLabelAr" value="Menu1"/>
    <arrayval field="usrArray" index="0" value="Ensign"/>
    <arrayval field="usrArray" index="1" value="Lieutenant"/>
    <arrayval field="usrArray" index="2" value="Lt. Commander"/>
    <arrayval field="usrArray" index="3" value="Commander"/>
    <arrayval field="usrArray" index="4" value="Captain"/>    
    <usesource source="Travel"/>
    <tag group="MinRank" tag="0"/>
    <tag group="User" tag="Activation"/>
    <tag group="EdgeType" tag="Background"/>
	<eval phase="PreTraits" priority="5000"><![CDATA[      if (field[abilActive].value <> 0) then
        perform #traitadjust[trCharisma,+,1,"Air NCO"]
        endif]]>
      <before name="Calc trtFinal"/>
      </eval>
    </thing>

The obvious intent is to purchase the Edge, then select the appropriate "rank". I know I could just use a domain and they could fill in the box, I just wanted to limit selection to pre-defined lists. If this is even possible. I have other use cases if I can get this to work :)

The above code spits out no errors, you just get the Edge and no menu to select choices from.
 
Looking at the code for the editor tab for edges, usrArray is commented out, so this is not currently available for Edges. If you want to use this, I'd recommend putting it in the enhancement request thread.
 
In order to get that sort of selection with a selection-based menu, I'd create items on the Simple tab to represent each of the selections. Manually create some tag (I think the User group looks like a good group to use), and assign it to all of them. Then, you can write a candidate expression that covers all the items you've created.
 
Well, with "usrCandid1" I had this:

Code:
  <thing 
	id="edgMiRank2" 
	name="Military Rank" 
	description="" 
	compset="Edge" 
	summary="Select a rank" 
	uniqueness="unique">
    <fieldval field="usrCandid1" value="Ensign | Lieutenant | Commander | Captain"/>
    <usesource source="Travel"/>
    <tag group="MinRank" tag="0"/>
    <tag group="User" tag="Activation"/>
    <tag group="EdgeType" tag="Background"/>
    <tag group="ChooseSrc1" tag="Hero"/>
    <eval phase="PreTraits" priority="5000"><![CDATA[      if (field[abilActive].value <> 0) then
        perform #traitadjust[trCharisma,+,1,"Air NCO"]
        endif]]>
      <before name="Calc trtFinal"/>
      </eval>
    </thing>

I tried ChooseSrc1 = Thing and Container but neither worked either.

I got lost beyond that trying to figure out how to write an expression that pulled the list into the selection box.
 
You rock Mathias!!

For everyone else, this is how I applied his suggestions:

Simple Items:

Code:
  <thing id="valTREnsig" name="O1 Ensign" compset="Simple">
    <usesource source="Travel"/>
    <tag group="User" tag="Rank" name="Rank" abbrev="Rank"/>
    </thing>
  <thing id="valTRLieut" name="O2 Lieutenant" compset="Simple">
    <usesource source="Travel"/>
    <tag group="User" tag="Rank" name="Rank" abbrev="Rank"/>
    </thing>
etc.

Now my Military Rank Edge:

Code:
  <thing id="edgMiRank" name="Military Rank" compset="Edge" summary="Select a rank" uniqueness="unique">
    <fieldval field="usrCandid1" value="component.Simple & User.Rank"/>
    <usesource source="Travel"/>
    <tag group="User" tag="Activation"/>
    <tag group="EdgeType" tag="Background"/>
    <tag group="ChooseSrc1" tag="Thing"/>
    <tag group="MinRank" tag="0"/>
    <eval phase="PreTraits" priority="5000"><![CDATA[      if (field[abilActive].value <> 0) then
        perform #traitadjust[trCharisma,+,1,"Military Rank"]
        endif]]>
      <before name="Calc trtFinal"/>
      </eval>
    </thing>
 
So basically what does that do? Just give a select list with the Edge that simply displays text (the rank chosen, in this case?) I could add it to the Common Codes thread if you like, but I want a good way to explain what it's doing to someone reading this for the first time and trying to decide if this code will help them do what they want to do.
 
Looking at the code for the editor tab for edges, usrArray is commented out, so this is not currently available for Edges. If you want to use this, I'd recommend putting it in the enhancement request thread.
I wonder if a Knowledge Array could be made so that we can have a list of predefined Knowledge skills.
 
To answer Zarlor.

I used this because I wanted an 'established' series of Military Ranks in place of a generic Domain-filled box.

Other examples might be:

Knowledge-based languages, you could create a list of the languages for your world, use this as the selection option when they pick new Knowledge (Language). I am actually going to use this for a setting of mine.

Heck, even for some of the Hindrances (Allergies, Quirks, Phobias, etc.). For some settings, the GM just might want a finite list for his characters to choose from.

I tried finding some threads with similar needs for something like this:

http://forums.wolflair.com/showthread.php?t=30863

http://forums.wolflair.com/showthread.php?t=21113

Which made me think of Skill Specializations or Preset Knowledge lists, seeming to get most use out of something like this.

Hope that helps you out with phrasing for Common Code examples. BTW, I love that immensely, thank you very much.
 
My pleasure. It's largely personal notes for myself from when I was first learning these things and I figured I'd share in case anyone else might find it useful.

One last question... I'm assuming that doing it this way forces the selection only to what is on the list. Is there a way to allow the selection from a list like this but then also allow a blank box for manual entry?
 
Back
Top