Difference between revisions of "Skeleton File Changes V3.1"
(→File: "advancement.core") |
(→Next) |
||
Line 38: | Line 38: | ||
done | done | ||
endif | endif | ||
+ | </pre> | ||
+ | |||
+ | ===File: "components.core"=== | ||
+ | |||
+ | Line 273: Change the reference to the "component.Ability" tag to "component.shortname". | ||
+ | |||
+ | Line 278: Change the reference to the "component.Ability" tag to "component.shortname". | ||
+ | |||
+ | Line 283: Insert the code below to use the standard name if no short name is defined. | ||
+ | |||
+ | <pre> | ||
+ | ~if we don't have a short name, just use the regular name | ||
+ | if (empty(short) <> 0) then | ||
+ | short = name | ||
+ | endif | ||
+ | </pre> | ||
+ | |||
+ | Line 337: Insert the new "UserSelect" component definition that is provided below. | ||
+ | |||
+ | <pre> | ||
+ | <component | ||
+ | id="UserSelect" | ||
+ | name="User Selection"> | ||
+ | |||
+ | <!-- Text to display with the checkbox | ||
+ | NOTE! If this field is empty, it means NO checkbox is shown for the pick. | ||
+ | --> | ||
+ | <field | ||
+ | id="usrChkText" | ||
+ | name="Checkbox Text" | ||
+ | type="derived" | ||
+ | maxlength="100"> | ||
+ | </field> | ||
+ | |||
+ | <!-- Indicates whether the checkbox is selected is not --> | ||
+ | <field | ||
+ | id="usrIsCheck" | ||
+ | name="Checked?" | ||
+ | type="user" | ||
+ | minvalue="0" | ||
+ | maxvalue="1"> | ||
+ | </field> | ||
+ | |||
+ | <!-- Label associated with the first thing-based menu --> | ||
+ | <field | ||
+ | id="usrLabel1" | ||
+ | name="Thing Menu Label #1" | ||
+ | type="static" | ||
+ | maxlength="50"> | ||
+ | </field> | ||
+ | |||
+ | <!-- Tracks the first selection made when a menu choice is required --> | ||
+ | <field | ||
+ | id="usrChosen1" | ||
+ | name="Chosen Thing / Pick #1" | ||
+ | type="user" | ||
+ | style="menu"> | ||
+ | </field> | ||
+ | |||
+ | <!-- Candidate tagexpr used to determine which picks/things are shown in menu #1 | ||
+ | NOTE! If this field is empty, it means NO first menu is shown for the pick. | ||
+ | --> | ||
+ | <field | ||
+ | id="usrCandid1" | ||
+ | name="Candidate TagExpr for Menu #1" | ||
+ | type="derived" | ||
+ | maxlength="1000" | ||
+ | defvalue=""> | ||
+ | </field> | ||
+ | |||
+ | <!-- Source to pull choices from within menu #1 --> | ||
+ | <field | ||
+ | id="usrSource1" | ||
+ | name="Source for Menu #1 Choices" | ||
+ | type="derived"> | ||
+ | <!-- Determine the source to choose from based on the tag, defaulting to "Hero" --> | ||
+ | <calculate phase="Render" priority="10000"><![CDATA[ | ||
+ | if (tagis[ChooseSrc1.Thing] <> 0) then | ||
+ | @value = 0 | ||
+ | elseif (tagis[ChooseSrc1.Container] <> 0) then | ||
+ | @value = 1 | ||
+ | elseif (tagis[ChooseSrc1.Hero] <> 0) then | ||
+ | @value = 2 | ||
+ | else | ||
+ | @value = 2 | ||
+ | endif | ||
+ | ]]></calculate> | ||
+ | </field> | ||
+ | |||
+ | <!-- Label associated with the second thing-based menu --> | ||
+ | <field | ||
+ | id="usrLabel2" | ||
+ | name="Thing Menu Label #2" | ||
+ | type="static" | ||
+ | maxlength="50"> | ||
+ | </field> | ||
+ | |||
+ | <!-- Tracks the second selection made when a menu choice is required --> | ||
+ | <field | ||
+ | id="usrChosen2" | ||
+ | name="Chosen Thing / Pick #2" | ||
+ | type="user" | ||
+ | style="menu"> | ||
+ | </field> | ||
+ | |||
+ | <!-- Candidate tagexpr used to determine which picks/things are shown in menu #2 | ||
+ | NOTE! If this field is empty, it means NO second menu is shown for the pick. | ||
+ | --> | ||
+ | <field | ||
+ | id="usrCandid2" | ||
+ | name="Candidate TagExpr for Menu #2" | ||
+ | type="derived" | ||
+ | maxlength="1000" | ||
+ | defvalue=""> | ||
+ | </field> | ||
+ | |||
+ | <!-- Source to pull choices from within menu #2 --> | ||
+ | <field | ||
+ | id="usrSource2" | ||
+ | name="Source for Menu #2 Choices" | ||
+ | type="derived"> | ||
+ | <!-- Determine the source to choose from based on the tag, defaulting to "Hero" --> | ||
+ | <calculate phase="Render" priority="10000"><![CDATA[ | ||
+ | if (tagis[ChooseSrc2.Thing] <> 0) then | ||
+ | @value = 0 | ||
+ | elseif (tagis[ChooseSrc2.Container] <> 0) then | ||
+ | @value = 1 | ||
+ | elseif (tagis[ChooseSrc2.Hero] <> 0) then | ||
+ | @value = 2 | ||
+ | else | ||
+ | @value = 2 | ||
+ | endif | ||
+ | ]]></calculate> | ||
+ | </field> | ||
+ | |||
+ | <!-- Label associated with the array-based menu --> | ||
+ | <field | ||
+ | id="usrLabelAr" | ||
+ | name="Array Menu Label" | ||
+ | type="static" | ||
+ | maxlength="50"> | ||
+ | </field> | ||
+ | |||
+ | <!-- Array of text items user can select from | ||
+ | NOTE! If the 0th element is empty, it means NO menu is shown for the pick. | ||
+ | --> | ||
+ | <field | ||
+ | id="usrArray" | ||
+ | name="Array of Items to Choose" | ||
+ | type="derived" | ||
+ | style="array" | ||
+ | arrayrows="10" | ||
+ | maxlength="30"> | ||
+ | </field> | ||
+ | |||
+ | <!-- Item selected from the array --> | ||
+ | <field | ||
+ | id="usrSelect" | ||
+ | name="Selected Item in Array" | ||
+ | type="user" | ||
+ | maxlength="30"> | ||
+ | </field> | ||
+ | |||
+ | <!-- Initialize the current array-based selection from the array if not defined --> | ||
+ | <creation><![CDATA[ | ||
+ | if (empty(field[usrArray].arraytext[0]) = 0) then | ||
+ | if (field[usrSelect].isempty <> 0) then | ||
+ | field[usrSelect].text = field[usrArray].arraytext[0] | ||
+ | endif | ||
+ | endif | ||
+ | ]]></creation> | ||
+ | |||
+ | <!-- Integrate the various user selections into the name of the pick | ||
+ | NOTE! Must be scheduled after the "shortname" field is synthesized at Render/100. | ||
+ | --> | ||
+ | <eval index="1" phase="Render" priority="500"><![CDATA[ | ||
+ | ~if we're not supposed to auto-amend the name for this pick, we're done | ||
+ | if (tagis[User.NoAutoName] <> 0) then | ||
+ | done | ||
+ | endif | ||
+ | |||
+ | ~if we have thing-based menus, determine the text to append to the name | ||
+ | var choices as string | ||
+ | if (field[usrCandid1].isempty = 0) then | ||
+ | if (field[usrChosen1].ischosen <> 0) then | ||
+ | choices = field[usrChosen1].chosen.field[name].text | ||
+ | else | ||
+ | choices = "-Choose-" | ||
+ | endif | ||
+ | if (field[usrChosen2].ischosen <> 0) then | ||
+ | choices &= ", " & field[usrChosen2].chosen.field[name].text | ||
+ | endif | ||
+ | |||
+ | ~if we have an array-based menu, determine the text to append | ||
+ | elseif (empty(field[usrArray].arraytext[0]) = 0) then | ||
+ | choices = field[usrSelect].text | ||
+ | |||
+ | ~if we have a selected checkbox, determine the text to append | ||
+ | elseif (field[usrChkText].isempty = 0) then | ||
+ | if (field[usrIsCheck].value <> 0) then | ||
+ | choices = field[usrChkText].text | ||
+ | endif | ||
+ | endif | ||
+ | |||
+ | ~if we have no text to append, we're done | ||
+ | if (empty(choices) <> 0) then | ||
+ | done | ||
+ | endif | ||
+ | |||
+ | ~add the selection to both the livename and shortname (if present) fields | ||
+ | field[livename].text = field[name].text & ": " & choices | ||
+ | if (tagis[component.shortname] <> 0) then | ||
+ | field[shortname].text &= " (" & choices & ")" | ||
+ | endif | ||
+ | ]]></eval> | ||
+ | |||
+ | <!-- Report a validation error if no selection has been made for a menu selection --> | ||
+ | <evalrule phase="Validate" priority="10000" message="You must choose an option" summary="Choose!"><![CDATA[ | ||
+ | ~determine the number of menus that NEED selection | ||
+ | ~Note: Remember that a non-empty tagexpr field indicates menu selection is used. | ||
+ | var needed as number | ||
+ | needed = !field[usrCandid1].isempty + !field[usrCandid2].isempty | ||
+ | needed += !empty(field[usrArray].arraytext[0]) | ||
+ | |||
+ | ~determine the number of menus that HAVE selections | ||
+ | var actual as number | ||
+ | if (field[usrCandid1].isempty = 0) then | ||
+ | actual += field[usrChosen1].ischosen | ||
+ | endif | ||
+ | if (field[usrCandid2].isempty = 0) then | ||
+ | actual += field[usrChosen2].ischosen | ||
+ | endif | ||
+ | if (field[usrSelect].isempty = 0) then | ||
+ | actual += 1 | ||
+ | endif | ||
+ | |||
+ | ~if the user has chosen something whenever required, we're valid | ||
+ | if (actual >= needed) then | ||
+ | @valid = 1 | ||
+ | done | ||
+ | endif | ||
+ | |||
+ | ~mark any associated tab as invalid | ||
+ | if (ispanel <> 0) then | ||
+ | linkvalid = 0 | ||
+ | endif | ||
+ | ]]></evalrule> | ||
+ | |||
+ | </component> | ||
+ | </pre> | ||
+ | |||
+ | Line 400: Add the new Eval script below to the "Domain" component. | ||
+ | |||
+ | <pre> | ||
+ | <eval index="1" phase="Render" priority="500"><![CDATA[ | ||
+ | ~if we don't need a domain, there's nothing to do | ||
+ | if (tagis[User.NeedDomain] = 0) then | ||
+ | done | ||
+ | endif | ||
+ | |||
+ | ~if we're not supposed to auto-amend the name for this pick, we're done | ||
+ | if (tagis[User.NoAutoName] <> 0) then | ||
+ | done | ||
+ | endif | ||
+ | |||
+ | ~if we don't have a domain, use a placeholder for it | ||
+ | var domain as string | ||
+ | if (field[domDomain].isempty = 0) then | ||
+ | domain = field[domDomain].text | ||
+ | else | ||
+ | domain = "????" | ||
+ | endif | ||
+ | |||
+ | ~add the domain to both the livename and shortname (if present) fields | ||
+ | field[livename].text = field[name].text & ": " & domain | ||
+ | if (tagis[component.shortname] <> 0) then | ||
+ | field[shortname].text &= " (" & domain & ")" | ||
+ | endif | ||
+ | ]]></eval> | ||
+ | </pre> | ||
+ | |||
+ | Line 401: Replace the original Eval script with the new one shown below. | ||
+ | |||
+ | <pre> | ||
+ | <evalrule index="1" phase="Validate" priority="9000" message="????"><![CDATA[ | ||
+ | ~if no domain is needed or the domain is specified, we're valid | ||
+ | if (tagis[User.NeedDomain] = 0) then | ||
+ | @valid = 1 | ||
+ | elseif (field[domDomain].isempty = 0) then | ||
+ | @valid = 1 | ||
+ | endif | ||
+ | |||
+ | ~if we're valid, get out of here | ||
+ | if (@valid <> 0) then | ||
+ | done | ||
+ | endif | ||
+ | |||
+ | ~if we have a linked panel, flag it as invalid | ||
+ | if (ispanel <> 0) then | ||
+ | linkvalid = 0 | ||
+ | endif | ||
+ | |||
+ | ~synthesize an appropriate message using the correct domain term | ||
+ | var term as string | ||
+ | term = tagnames[DomainTerm.?] | ||
+ | if (empty(term) <> 0) then | ||
+ | term = "Domain" | ||
+ | endif | ||
+ | @message = term & " must be specified" | ||
+ | ]]></evalrule> | ||
</pre> | </pre> | ||
===Next=== | ===Next=== |
Revision as of 22:30, 18 February 2009
Context: HL Kit Kit Reference Skeleton Data File Revision History
File: "actor.str"
Line 163: Change the reference to the "trtLeft" field to "trtUser".
Line 221: Replace the Eval script with the revised script below.
<eval index="1" phase="Final" priority="1000"><![CDATA[ ~if no damage has been incurred, assign a tag to indicate that state if (field[acHPNow].value >= field[acHPMax].value) then perform hero.assign[Hero.NoDamage] ~if the hero is dead or otherwise out of combat, indicate that state elseif (field[acHPNow].value = 0) then perform hero.assign[Hero.Dead] endif ]]></eval>
File: "advancement.core"
Line 19: Added the "Notation" tag shown below.
<value id="Notation"/>
Line 160: Insert new logic to handle notation advancements at the start of the Eval script, as shown below.
~if this advancement has an annotation, there is no user-selection, so build ~the name from our pieces and we're done if (tagis[Advance.Notation] <> 0) then perform gizmo.child[advDetails].setfocus field[livename].text = field[name].text & ": " & focus.field[advUser].text done endif
File: "components.core"
Line 273: Change the reference to the "component.Ability" tag to "component.shortname".
Line 278: Change the reference to the "component.Ability" tag to "component.shortname".
Line 283: Insert the code below to use the standard name if no short name is defined.
~if we don't have a short name, just use the regular name if (empty(short) <> 0) then short = name endif
Line 337: Insert the new "UserSelect" component definition that is provided below.
<component id="UserSelect" name="User Selection"> <!-- Text to display with the checkbox NOTE! If this field is empty, it means NO checkbox is shown for the pick. --> <field id="usrChkText" name="Checkbox Text" type="derived" maxlength="100"> </field> <!-- Indicates whether the checkbox is selected is not --> <field id="usrIsCheck" name="Checked?" type="user" minvalue="0" maxvalue="1"> </field> <!-- Label associated with the first thing-based menu --> <field id="usrLabel1" name="Thing Menu Label #1" type="static" maxlength="50"> </field> <!-- Tracks the first selection made when a menu choice is required --> <field id="usrChosen1" name="Chosen Thing / Pick #1" type="user" style="menu"> </field> <!-- Candidate tagexpr used to determine which picks/things are shown in menu #1 NOTE! If this field is empty, it means NO first menu is shown for the pick. --> <field id="usrCandid1" name="Candidate TagExpr for Menu #1" type="derived" maxlength="1000" defvalue=""> </field> <!-- Source to pull choices from within menu #1 --> <field id="usrSource1" name="Source for Menu #1 Choices" type="derived"> <!-- Determine the source to choose from based on the tag, defaulting to "Hero" --> <calculate phase="Render" priority="10000"><![CDATA[ if (tagis[ChooseSrc1.Thing] <> 0) then @value = 0 elseif (tagis[ChooseSrc1.Container] <> 0) then @value = 1 elseif (tagis[ChooseSrc1.Hero] <> 0) then @value = 2 else @value = 2 endif ]]></calculate> </field> <!-- Label associated with the second thing-based menu --> <field id="usrLabel2" name="Thing Menu Label #2" type="static" maxlength="50"> </field> <!-- Tracks the second selection made when a menu choice is required --> <field id="usrChosen2" name="Chosen Thing / Pick #2" type="user" style="menu"> </field> <!-- Candidate tagexpr used to determine which picks/things are shown in menu #2 NOTE! If this field is empty, it means NO second menu is shown for the pick. --> <field id="usrCandid2" name="Candidate TagExpr for Menu #2" type="derived" maxlength="1000" defvalue=""> </field> <!-- Source to pull choices from within menu #2 --> <field id="usrSource2" name="Source for Menu #2 Choices" type="derived"> <!-- Determine the source to choose from based on the tag, defaulting to "Hero" --> <calculate phase="Render" priority="10000"><![CDATA[ if (tagis[ChooseSrc2.Thing] <> 0) then @value = 0 elseif (tagis[ChooseSrc2.Container] <> 0) then @value = 1 elseif (tagis[ChooseSrc2.Hero] <> 0) then @value = 2 else @value = 2 endif ]]></calculate> </field> <!-- Label associated with the array-based menu --> <field id="usrLabelAr" name="Array Menu Label" type="static" maxlength="50"> </field> <!-- Array of text items user can select from NOTE! If the 0th element is empty, it means NO menu is shown for the pick. --> <field id="usrArray" name="Array of Items to Choose" type="derived" style="array" arrayrows="10" maxlength="30"> </field> <!-- Item selected from the array --> <field id="usrSelect" name="Selected Item in Array" type="user" maxlength="30"> </field> <!-- Initialize the current array-based selection from the array if not defined --> <creation><![CDATA[ if (empty(field[usrArray].arraytext[0]) = 0) then if (field[usrSelect].isempty <> 0) then field[usrSelect].text = field[usrArray].arraytext[0] endif endif ]]></creation> <!-- Integrate the various user selections into the name of the pick NOTE! Must be scheduled after the "shortname" field is synthesized at Render/100. --> <eval index="1" phase="Render" priority="500"><![CDATA[ ~if we're not supposed to auto-amend the name for this pick, we're done if (tagis[User.NoAutoName] <> 0) then done endif ~if we have thing-based menus, determine the text to append to the name var choices as string if (field[usrCandid1].isempty = 0) then if (field[usrChosen1].ischosen <> 0) then choices = field[usrChosen1].chosen.field[name].text else choices = "-Choose-" endif if (field[usrChosen2].ischosen <> 0) then choices &= ", " & field[usrChosen2].chosen.field[name].text endif ~if we have an array-based menu, determine the text to append elseif (empty(field[usrArray].arraytext[0]) = 0) then choices = field[usrSelect].text ~if we have a selected checkbox, determine the text to append elseif (field[usrChkText].isempty = 0) then if (field[usrIsCheck].value <> 0) then choices = field[usrChkText].text endif endif ~if we have no text to append, we're done if (empty(choices) <> 0) then done endif ~add the selection to both the livename and shortname (if present) fields field[livename].text = field[name].text & ": " & choices if (tagis[component.shortname] <> 0) then field[shortname].text &= " (" & choices & ")" endif ]]></eval> <!-- Report a validation error if no selection has been made for a menu selection --> <evalrule phase="Validate" priority="10000" message="You must choose an option" summary="Choose!"><![CDATA[ ~determine the number of menus that NEED selection ~Note: Remember that a non-empty tagexpr field indicates menu selection is used. var needed as number needed = !field[usrCandid1].isempty + !field[usrCandid2].isempty needed += !empty(field[usrArray].arraytext[0]) ~determine the number of menus that HAVE selections var actual as number if (field[usrCandid1].isempty = 0) then actual += field[usrChosen1].ischosen endif if (field[usrCandid2].isempty = 0) then actual += field[usrChosen2].ischosen endif if (field[usrSelect].isempty = 0) then actual += 1 endif ~if the user has chosen something whenever required, we're valid if (actual >= needed) then @valid = 1 done endif ~mark any associated tab as invalid if (ispanel <> 0) then linkvalid = 0 endif ]]></evalrule> </component>
Line 400: Add the new Eval script below to the "Domain" component.
<eval index="1" phase="Render" priority="500"><![CDATA[ ~if we don't need a domain, there's nothing to do if (tagis[User.NeedDomain] = 0) then done endif ~if we're not supposed to auto-amend the name for this pick, we're done if (tagis[User.NoAutoName] <> 0) then done endif ~if we don't have a domain, use a placeholder for it var domain as string if (field[domDomain].isempty = 0) then domain = field[domDomain].text else domain = "????" endif ~add the domain to both the livename and shortname (if present) fields field[livename].text = field[name].text & ": " & domain if (tagis[component.shortname] <> 0) then field[shortname].text &= " (" & domain & ")" endif ]]></eval>
Line 401: Replace the original Eval script with the new one shown below.
<evalrule index="1" phase="Validate" priority="9000" message="????"><![CDATA[ ~if no domain is needed or the domain is specified, we're valid if (tagis[User.NeedDomain] = 0) then @valid = 1 elseif (field[domDomain].isempty = 0) then @valid = 1 endif ~if we're valid, get out of here if (@valid <> 0) then done endif ~if we have a linked panel, flag it as invalid if (ispanel <> 0) then linkvalid = 0 endif ~synthesize an appropriate message using the correct domain term var term as string term = tagnames[DomainTerm.?] if (empty(term) <> 0) then term = "Domain" endif @message = term & " must be specified" ]]></evalrule>