MadBeardMan
May 28th, 2017, 00:37
Greetings,
Is there a way to link a 'number_linked' source to a characters value outside of the 'windowlist' they're inside.
For example;
WOiN has a Luck Dice pool, and so I'd like when you allocate the pool to skill, that it sets the Max Value to that of the pool.
Now the skills are on a 2nd tab, and within their own window list, which in turn the datasource is set to .skilllist
Here's the template for the luck dice:
<!-- Luck Dice -->
<number_linked name="luckdice">
<anchored width="30" height="20">
<top offset="2" />
<right parent="rightanchor" anchor="left" relation="relative" offset="-15" />
</anchored>
<frame name="fieldlight" offset="5,5,5,5" />
<tabtarget prev="bonus" next="total" />
<source><name>luckdicepool</name><op>+</op></source>
<script>
function onInit()
local nValue = getValue();
print (nValue);
local nValue2 = DB.getValue(getDatabaseNode().getParent().getParen t().getParent(), "luckdicepool", 0);
setMaxValue(nValue2);
end
function onSourceUpdate()
print ("OnSourceUpdate");
end
</script>
</number_linked>
When that runs, the output shows:
Runtime Notice: Reloading ruleset
Script Notice: 0
Script Notice: 0
Script Notice: 0
Script Notice: 0
Script Notice: 0
Script Notice: 0
Script Notice: 0
Yet in the db.xml, luckdicepool has a value of 3.
<jumpvmodifier type="number">0</jumpvmodifier>
<luckdicepool type="number">3</luckdicepool>
<name type="string">Talik</name>
<notes type="string">Medium sentient humanoid (grade 5; max dice pool 5d6)\n\nActions: 2 (+1 bonus melee attack)</notes>
<perception>
<misc type="number">0</misc>
<skillsdice type="number">1</skillsdice>
</perception>
<perceptionmodifier type="number">0</perceptionmodifier>
<race type="string">Felan</race>
<racelink type="windowreference">
<class>reference_race</class>
<recordname>reference.races.felan@Future Careers</recordname>
</racelink>
<size type="string">Medium</size>
<skilllist>
<id-00001>
<attribute type="string">-</attribute>
<attributed6 type="number">0</attributed6>
<bonus type="number">0</bonus>
<equipment type="number">0</equipment>
<luckdice type="number">0</luckdice>
<name type="string">Stealth</name>
<rank type="number">3</rank>
<rankd6 type="number">2</rankd6>
<text type="formattedtext">
<h>Skill Group</h>
<p>Subterfuge Skills</p>
</text>
<total type="number">2</total>
</id-00001>
So I'm suspecting that because the 'luckdicepool' is a number of levels up (getDatabaseNode().getParent().getParent().getPare nt()) that it can't by default see it, which means in turn why the onSourceUpdate doesn't fire.
Is there anyway to make is 'see' the 'luckdicepool'?
Cheers
Is there a way to link a 'number_linked' source to a characters value outside of the 'windowlist' they're inside.
For example;
WOiN has a Luck Dice pool, and so I'd like when you allocate the pool to skill, that it sets the Max Value to that of the pool.
Now the skills are on a 2nd tab, and within their own window list, which in turn the datasource is set to .skilllist
Here's the template for the luck dice:
<!-- Luck Dice -->
<number_linked name="luckdice">
<anchored width="30" height="20">
<top offset="2" />
<right parent="rightanchor" anchor="left" relation="relative" offset="-15" />
</anchored>
<frame name="fieldlight" offset="5,5,5,5" />
<tabtarget prev="bonus" next="total" />
<source><name>luckdicepool</name><op>+</op></source>
<script>
function onInit()
local nValue = getValue();
print (nValue);
local nValue2 = DB.getValue(getDatabaseNode().getParent().getParen t().getParent(), "luckdicepool", 0);
setMaxValue(nValue2);
end
function onSourceUpdate()
print ("OnSourceUpdate");
end
</script>
</number_linked>
When that runs, the output shows:
Runtime Notice: Reloading ruleset
Script Notice: 0
Script Notice: 0
Script Notice: 0
Script Notice: 0
Script Notice: 0
Script Notice: 0
Script Notice: 0
Yet in the db.xml, luckdicepool has a value of 3.
<jumpvmodifier type="number">0</jumpvmodifier>
<luckdicepool type="number">3</luckdicepool>
<name type="string">Talik</name>
<notes type="string">Medium sentient humanoid (grade 5; max dice pool 5d6)\n\nActions: 2 (+1 bonus melee attack)</notes>
<perception>
<misc type="number">0</misc>
<skillsdice type="number">1</skillsdice>
</perception>
<perceptionmodifier type="number">0</perceptionmodifier>
<race type="string">Felan</race>
<racelink type="windowreference">
<class>reference_race</class>
<recordname>reference.races.felan@Future Careers</recordname>
</racelink>
<size type="string">Medium</size>
<skilllist>
<id-00001>
<attribute type="string">-</attribute>
<attributed6 type="number">0</attributed6>
<bonus type="number">0</bonus>
<equipment type="number">0</equipment>
<luckdice type="number">0</luckdice>
<name type="string">Stealth</name>
<rank type="number">3</rank>
<rankd6 type="number">2</rankd6>
<text type="formattedtext">
<h>Skill Group</h>
<p>Subterfuge Skills</p>
</text>
<total type="number">2</total>
</id-00001>
So I'm suspecting that because the 'luckdicepool' is a number of levels up (getDatabaseNode().getParent().getParent().getPare nt()) that it can't by default see it, which means in turn why the onSourceUpdate doesn't fire.
Is there anyway to make is 'see' the 'luckdicepool'?
Cheers