PDA

View Full Version : UserSelect, menus and arrays


Gumbytie
May 30th, 2013, 10:57 AM
So this is a game system I working on using the training template game. I am stuck trying to get the 'array' portion to work. The game is very similar to Savage Worlds but the way skills are handled complicate it, they are more akin to Shadowrun and Savage World combined. This is what I have so far:

So what works (version 1):
<thing
id="skFire"
name="Firearms"
compset="Skill"
isunique="no"
description="{i}Specialized skill{/i}\n\nAcademics represents...."
summary="May choose a spcialization.">
<fieldval field="trtAbbrev" value="Fir"/>
<fieldval field="usrCandid1" value="(component.Skill)"/>
<tag group="DashTacCon" tag="NonCombat"/>
<tag group="ChooseSrc1" tag="Thing"/>
<link linkage="attribute" thing="attrDex"/>
</thing>

And on the Skill Tab we have:
<portal
id="menu1"
style="menuSmall">
<menu_things
field="usrChosen1"
component="none"
maxvisible="10"
usepicksfield="usrSource1"
candidatefield="usrCandid1">
</menu_things>
</portal>

Options for ChooseSrc1 are:
<tag group="ChooseSrc1" tag="Hero"/>
<tag group="ChooseSrc1" tag="Container"/>
<tag group="ChooseSrc1" tag="Thing"/>

Problem is, it needs to pull from an existing list of something. I have Skills and I have Sub-Skills (for lack of a better term). If I could figure out how to separate those two and pull from one into other, fine.

Now the Array version of skill (version 2):
<thing
id="skAcad"
name="Academics"
compset="Skill"
isunique="no"
description="{i}Specialized skill{/i}\n\nAcademics represents...."
summary="Choose a discipline.">
<fieldval field="usrLabelAr" value="Menu1"/>
<arrayval field="usrArray" index="0" value="Archaeology"/>
<arrayval field="usrArray" index="1" value="Anthropology"/>
<arrayval field="usrArray" index="2" value="Biology"/>
<arrayval field="usrArray" index="3" value="Chemistry"/>
<arrayval field="usrArray" index="4" value="Physics"/>
<link linkage="attribute" thing="attrInt"/>
</thing>
</document>

Seems to work in sense not kicking out any errors. Problem is I cannot get the selector to appear on Skill list like it does for version 1. I assume it has something to do with the portal for the Skill Tab, and here is where I run into problems. Can't get it to appear to see if code for version 2 is actually correct.

I tried:
<portal
id="array"
style="menuSmall">
<menu_things
field="usrSelect"
component="none"
maxvisible="10"
usepicksfield="usrArray"
candidatefield="usrCandid1">
</menu_things>
</portal>
That gets me an error:
Syntax error in 'position' script for Template 'skPick' on line 105
-> Attempt to access a field 'usrSelect' defined with an incompatible style. Expected 'menu'.

So down in my position script I have:
perform portal[array].centervert

~position the menus to the right of the name in the available space
perform portal[array].alignrel[ltor,name,10]
portal[array].width = (portal[info].left - portal[array].left - 20) / 2

~determine whether our arrays are visible
~Note: Remember that a non-empty tagexpr field indicates array selection is used.
if (field[usrCandid1].isempty <> 0) then
portal[array].visible = 0
endif

~if a array is visible, make sure it has a selection
if (portal[array].visible <> 0) then
if (field[usrSelect].ischosen = 0) then
perform portal[array].setstyle[menuErrSm]
endif
endif

I also changed this one part:
perform portal[array].setstyle[arrayErrSm]
And still same error.

Wish to heck I could crack open Shadowrun and look out how it handles skills :) In some ways I am trying to do sort of the same thing.

There are two types of Skills in the game:

Skill + Discipline
Skill + Specialization

Skill + Discipline:
Similar to Savage Worlds knowledge skills. A very broad skill that requires a discipline chosen everytime purchase the skill. So with Academics, very broad. Purchase Academics pick one of the choices from the Array and get:
Academics: Archaeology (Int 4 + Skill Level 4 = Skill Rating 8) Cost: 4 exp
Academics: Anthropology (Int 4 + Skill Level 2 = Skill Rating 6) Cost: 2 exp
etc.
Each one is now a unique skill that can be raised independently with experience points.

Skill + Specialization
You know a broad skill but have specialized in a subset that gives a bonus to the skill roll. Purchasing this Specialization will cost additional experience points. So we look at the Firearm skill:
Firearms (Dex 6 + Skill Level 2 = Skill Rating 8) Cost: 2 exp
Pistols (Firearms + Skill Level 2 = Skill Rating 10) Cost: 1 exp


So the functionality is very different between the two needs and why I am trying to figure out both methods for menus/arrays.

Of course, after the array portion, I still need to figure out how to create that 'specialized' skill list to be pulled into regular skills and charge points for that.

But one hurdle at a time :)

Cheers,
Gumbytie

Kairos
May 30th, 2013, 11:46 AM
I tried:
<portal
id="array"
style="menuSmall">
<menu_things
field="usrSelect"
component="none"
maxvisible="10"
usepicksfield="usrArray"
candidatefield="usrCandid1">
</menu_things>
</portal>
That gets me an error:


Replace the menu_things element with the menu_array (http://hlkitwiki.wolflair.com/index.php5/MenuArray_Element_(Data)) element. That should clear up that error message. As the code stands, the portal element is looking for a field of type menu, and you're supplying it a field of type array.

Gumbytie
May 30th, 2013, 04:06 PM
Thanks, that is getting me closer. I also had to remove the component field from the array, but still not quite there. Argh, if there was just a functional example of one I could look at :)

So now the portal code reads:
<portal
id="array"
style="menuSmall">
<menu_array
field="usrSelect"
maxvisible="10"
usepicksfield="usrArray"
candidatefield="usrCandid1">
</menu_array>
</portal>

The error now is:
File: tab_skills.dat (line 211) - Unrecognized attribute 'usepicksfield' in element 'menu_array'

I seem to recall something about 'picks' working with menus and something like choose working with arrays. But for the life of me cannot remember any syntax. Okay, I will keep digging and banging away. Thanks for help so far.

Cheers.

Mathias
May 30th, 2013, 04:10 PM
There's an example of a finished portal for usrSelect in the visual.dat file, line 421. I'd copy that, rather than recreating it by copying one of the usrChosen1 portals.

Gumbytie
May 30th, 2013, 04:23 PM
Gadzooks man, Mathias once again to the rescue. Man, I looked over those files so many times and never once registered that example into my pitiful brain, sigh...more coffee perhaps needed.

You rock!