This is probably something super-obvious that I'm just not getting at the moment, but I have Components for certain skill bonuses in my system like the following:
Code:
<!-- SkillBonus component -->
<component
id="SkillBonus"
name="Starting Skill Bonus"
autocompset="no"
panellink="basics">
<field
id="skbName"
name="Name"
type="user"
maxlength="20"/>
</component>
They exist within a compset that is then used to used for specific bonus types like the following:
Code:
<thing
id="fRPlusSk"
name="Skill Bonus"
compset="cmpsetSB"
description="Gives a bonus to the selected skill.">
<fieldval field="usrCandid1" value="component.Skill"/>
<tag group="Hide" tag="Special"/>
<eval index="1" phase="PreTraits" priority="4900">
<before name="Calc trtFinal"/><![CDATA[
var bonus as number
var penalty as number
bonus = tagvalue[Bonus.?]
penalty = tagvalue[Penalty.?]
if (bonus = 0) then
if (penalty = 0) then
bonus = 2
else
bonus = penalty
endif
endif
if (bonus > 0) then
field[livename].text = "+" & bonus & " " & livename
else
field[livename].text = bonus & " " & livename
endif
~build the candidate expression out of our Skill and Skills tags
var skills as string
skills = tagids[Skill.?, " | "]
var skilltypes as string
skilltypes = tagids[Skills.?, " | "]
var combined as string
if (tagis[Skills.?] <> 0) then
if (tagis[Skill.?] <> 0) then
combined = skills & " | " & skilltypes
else
combined = skilltypes
endif
else
combined = skills
endif
~ debug combined & ", " & empty(combined)
if (empty(combined) = 0) then
field[usrCandid1].text &= " & (" & combined & ")"
endif
perform field[usrChosen1].chosen.field[trtBG].modify[+,bonus,field[skbName].text]
]]></eval>
</thing>
Those bonus things are bootstrapped into backgrounds like the following. I would like to only use skbName if specified and, if not, to use the thing name it's bootstrapped to:
Code:
<thing id="bckCrime" name="Crime Lord" description="You probably didn’t get your lawless hands very dirty, but you definitely know some people who did — and they did it on your orders.\n\n{b}Bonus Skill Ranks:{/b} +2 Deceive, +2 Economics {i}or{/i} History, +2 Inspire {i}or{/i} Negotiate" compset="Bckgrnd" uniqueness="unique">
<bootstrap thing="fRPlusSk2">
<autotag group="Skill" tag="skDeceive"/>
</bootstrap>
<bootstrap thing="fRPlusSk">
<autotag group="Skill" tag="skEcon"/>
<autotag group="Skill" tag="skHistory"/>
<autotag group="explicit" tag="1"/>
</bootstrap>
<bootstrap thing="fRPlusSk">
<autotag group="Skill" tag="skInspire"/>
<autotag group="Skill" tag="skNegot"/>
<autotag group="explicit" tag="2"/>
</bootstrap>
</thing>
I'd like the modification line to pull from a field value on SkillBonus since I use SkillBonus's compset in a few different contexts and I'd prefer them to all be using the same field instead of duplicating the logic.