1 Attachment(s)
Order of calculation for number_linked control
Hi there,
I encountered an issue when using a number_linked control using a multiplicator.
The template I build looks like this:
Code:
<template name="number_charsprint">
<number_linked>
<font>reference-b-large</font>
<modifiersize>mini</modifiersize>
<modifierfield>sprint.temporary</modifierfield>
<description textres="char_tooltip_sprint" />
<source><name>speed.base</name><op>+</op></source>
<source><name>speed.bonus</name><op>+</op></source>
<source><name>speed.misc</name><op>+</op></source>
<source><name>encumbrance.bulkhalved</name><op>-</op></source>
<source><name>speed.sprintfactor</name><op>*</op></source>
<source><name>encumbrance.bulk</name><op>-</op></source>
<min>4</min>
</number_linked>
</template>
I was hoping the number_linked.lua logic in CoreRPG would run through the sources from top to bottom but it seems this is not what is happening. Core seems to populate an array and runs through the array in order of the items stored there. As long as all operators are simply additions or subtractions that's not a problem but I use a multiplicator in the template. That multiplicator is now called at a different time than intended, resulting in a total different result.
Attachment 52689
Taking the above example, the correct calculation logic is "(Speed base + Sped Misc - Half Bulk) * Factor - Bulk" but what get calculated is "(Speed Base - Bulk - Half Bulk) * Factor + Speed Misc + Speed Bonus".
Any idea how I can influence the order of calculation without re-writing the CoreRPG function?