DICE PACKS BUNDLE
  1. #1

    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.

    Number_Linked.png

    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?

  2. #2
    You might want to try and just override the calculation instead. Here is an example:

    capture.png
    Dominic Morta
    Ruleset Developer
    Smiteworks

    How to zip up your campaign if the Developers ask for it-How to zip up your campaign if the Developers ask for it

    How to provide an Unity Connection issue?-Connection Issues and What to Provide

    Unity Updater issue?-Updater Issues

    Classic and Unity Port Forwarding?-Fantasy Grounds Connections Explained

    Comcast or Cox ISP User?-Comcast XFinity and Cox Users

    Have a suggestion?-Idea Informer

  3. #3
    Yeah, the way the number_linked control script was originally built (before my time) is as a very blunt instrument. Even though the code shows support multiplication/division, it doesn't really work without doing as @superteddy57 suggests.

    Regards,
    JPG

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Starfinder Playlist

Log in

Log in