-
February 16th, 2022, 06:51 #1
- Join Date
- Jul 2019
- Posts
- 123
Math in Multi-Column tables in Story Templates
Hello all,
I am attempting to automate some math using Story Templates. I'm using the 5e ruleset but attempting to replicate some tables from the 3e Races of Faerūn. I want to take a base number in one column and do math to it using another column. Examples from the RoF: Col1+Col2 = Height (HeightResultCol2xCol4)+Col3=Weight
Table Name: ShieldDwarfMalePhysical
Col1 BaseHt: 50
Col2 Mod: [2d4]
Col3 BaseWt: 145
Col4 Mod: [2d6]
I am testing
[ShieldDwarfMalePhysical]
Calc Height: [#ShieldDwarfMalePhysical|1#+#ShieldDwarfMalePhysic al|2#]
Calc Weight: [#ShieldDwarfMalePhysical|3#+#ShieldDwarfMalePhysic al|2#*#ShieldDwarfMalePhysical|4#]
Sanity Test: [2+2]=4
Output is
50 5 145 5
Calc Height: 50+5
Calc Weight: 145+5*5
Sanity Test: 4=4
That doesn't perform the calculations, but it's close! Is there a way to do that with the column layout I have or is there a better approach?
I can as a workaround just add another column that does the math like [50+2d4] and call that using #|x# in the Story Template as an extra step.
-
February 16th, 2022, 08:55 #2
Someone asked a fairly similar question the other day and I referred them here https://www.fantasygrounds.com/forum...r-Unity)/page8 since I've not been able to get my head around most of the stuff in the updated story templates. The guy that did the code answered the query with a possible solution but I don't know if it worked or not.
If there is something that you would like to see in Fantasy Grounds that isn't currently part of the software or if there is something you think would improve a ruleset then add your idea here https://www.fantasygrounds.com/featu...rerequests.php
-
February 16th, 2022, 15:48 #3
- Join Date
- Jul 2019
- Posts
- 123
Hi Zacchaeus, thanks for pointing out that other thread. I echo that the documentation could use an update. I'm still not clear on when one would want to use {} instead of or in addition to []. Here are the results of my test.
{:ShieldDwarfMalePhysical:Test}
Calc Height: [{#Test|1#}+{#Test|2#}]
Calc Weight: [{#Test|3#}+{#Test|2#}*{#Test|4#}]
Output
50 5 145 9
Calc Height: 55
Calc Weight: 190
This is exactly what I wanted without having separate columns that perform the calculations! Hopefully this will help others out too.
-
February 16th, 2022, 17:02 #4
Documentation, the bane of all programmers.
Paul Grosse
PCGen BoD
PR Silverback
Autobackup Batch file, Always ALWAYS backup your data. Remember to follow the 3-2-1 rule!
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks