Thread: Combine values
-
August 3rd, 2019, 21:12 #1
- Join Date
- Dec 2015
- Location
- Boston, MA
- Posts
- 167
Combine values
Can someone point me in the direction to figure out the code to take two values entered on a sheet, add them together, and input the total into a third cell?
I am currently developing a ruleset for Star Trek Adventures, and I would like to automate some of the stuff. In STA, the total stress for your character is equal to your fitness stat plus your security stat.
Thank you for your help.
-
August 3rd, 2019, 22:06 #2
I’m not in front of my computer so can’t paste the exact code. But there are GUI controls in different rulesets that add together data from other fields.
Look in the 5E ruleset at the ac.total field (I’m guessing the control might be called actotal) in the character sheet.
Or, if you want to do it in code then use two getValue commands followed by one setValue.Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
August 3rd, 2019, 22:46 #3
I'm briefly in front of a computer... Have a look at the template "number_chartotalcurrenthp" in the 5E ruleset, campaign\template_char.xml file. This is an example of a way of using the <source> command to source data from another database field, it has the <op> property that specifies if that field is an addition or subtraction from the field total.
Do a find in files in most rulesets for <op> to see other examples.Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
August 4th, 2019, 02:01 #4
- Join Date
- Jun 2019
- Posts
- 71
Not sure if this is what you are wanting to do but this is how I did it for my Conan extension:
Here I am taking the Willpower number (7), adding the Expertise number (1) and putting the result in the "TN" number box.
code for this block:
Code:<frame_char name="willpowerframe"> <bounds>421,313,200,95</bounds> </frame_char> <string_label name="willpower" > <anchored to="willpowerframe" position="insidetopleft" offset="15,10" width="80" /> <default>WILLPOWER</default> <tooltip textres="need new textres" /> </string_label> <basicnumber name="willpowerstat" source="willpowerstat"> <anchored to="willpowerframe" position="insidetopleft" offset="140,13" width="20" height="17"/> </basicnumber> <string_label name="willpowerlabel" > <anchored to="willpowerframe" position="insidetopleft" offset="20,30" width="180" /> <default>Skill..............EX.......FC......TN</default> <font>SmallHeader-8</font> <tooltip textres="need new textres" /> </string_label> <string_label name="disciplinelabel"> <anchored to="willpowerframe" position="insidetopleft" offset="15,45" /> <default>Discipline</default> </string_label> <basicnumber name="disciplineex"> <anchored to="willpowerframe" position="insidetopleft" offset="82,47" width="15" height="15"/> <script> function onValueChanged() local rActor = ActorManager.getActor("pc", window.getDatabaseNode()); Debug.console("rActor: "); Debug.console(rActor); local nodeWin = window.getDatabaseNode(); Debug.console("nodeWin: "); Debug.console(nodeWin); local attribscore = nodeWin.getChild("willpowerstat").getValue(); Debug.console("attribute: "); Debug.console(attribscore); local EX= nodeWin.getChild("disciplineex").getValue(); Debug.console("EXPT: "); Debug.console(EX); nodeWin.getChild("disciplinetn").setValue(attribscore+EX); end </script> </basicnumber> <basicnumber name="disciplinefc" source="disciplinefc"> <anchored to="willpowerframe" position="insidetopleft" offset="110,47" width="15" height="15"/> </basicnumber> <basicnumber name="disciplinetn" source="disciplinetn"> <anchored to="willpowerframe" position="insidetopleft" offset="140,47" width="20" height="15"/> </basicnumber>
Last edited by Ranzarok; August 4th, 2019 at 02:06.
-
August 4th, 2019, 05:09 #5
Do you mean something like this via XML?
Code:<template name="number_chartotalac"> <number_chartotal> <description textres="armorclass" /> <font>reference-b-large</font> <modifiersize>mini</modifiersize> <modifierfield>defenses.ac.temporary</modifierfield> <source><name>defenses.ac.base</name><op>+</op></source> <source><name>defenses.ac.armor</name><op>+</op></source> <source><name>defenses.ac.shield</name><op>+</op></source> <source><name>defenses.ac.misc</name><op>+</op></source> </number_chartotal> </template>
---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
August 5th, 2019, 14:18 #6
- Join Date
- Dec 2015
- Location
- Boston, MA
- Posts
- 167
Thank you, that is all very helpful. I may have more questions going forward. I'm creating my first ruleset, and I am only a novice when it comes to coding.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks