Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Math function in scriptcard. How to use?

Hi there, I'm not speaking english natively. Maybe that is why I am not getting everything right in the Wiki. I'm trying to use the math/min function to declare the bonus of a cure light wounds spell using Pathfinder 1st. The max bonus is set to 5. now I want to compare classlevel and 5 and keep the lower one. Here is my try this far: !scriptcard {{   --#title|Leichte Wunden heilen   --#leftsub|Beschwörung (Heilung)   --#rightsub|Berührung      --~Plus|math;min;@{selected|class1_level};5  --=Heilung|1d8 + [$Plus]    --+Heilung|[$Heilung]  --:X| Maybe someone can help me out. Thx in advance
1613222356

Edited 1613222552
Kurt J.
Pro
API Scripter
Rholan said: Hi there, I'm not speaking english natively. Maybe that is why I am not getting everything right in the Wiki. I'm trying to use the math/min function to declare the bonus of a cure light wounds spell using Pathfinder 1st. The max bonus is set to 5. now I want to compare classlevel and 5 and keep the lower one. Here is my try this far: !scriptcard {{   --#title|Leichte Wunden heilen   --#leftsub|Beschwörung (Heilung)   --#rightsub|Berührung      --~Plus|math;min;@{selected|class1_level};5  --=Heilung|1d8 + [$Plus]    --+Heilung|[$Heilung]  --:X| Maybe someone can help me out. Thx in advance What are you getting as a result? Because that script is working fine for me (I changed @{selected|class1_level} to @{selected|level} because I'm using the 5E sheet), but assuming that class1_level is the right attribute for the PF sheet it should be giving you the lower of the two values back as the [$Plus] variable. Oh, and you don't have it listed above, but be sure your script ends with }}
In the picture you can see my output.
1613225209
Kurt J.
Pro
API Scripter
I created a PF1 game, and am still able to run your unchanged script without issues... Can you try running this version just to see what gets output for the various pieces (class level and plus)? My guess is there is a space or some other non-numeric character being inserted somewhere. !scriptcard {{ --#title|Leichte Wunden heilen --#leftsub|Beschwörung (Heilung) --#rightsub|Berührung --+ClassLevel|X@{selected|class1_level}X --~Plus|math;min;@{selected|class1_level};5 --+Plus|[$Plus] --=Heilung|1d8 + [$Plus] --+Heilung|[$Heilung] --:X| }}
Here´s the output
1613229050
Kurt J.
Pro
API Scripter
I think I know what is going on. The math functions were introduced in ScriptCards 0.0.15 (released last night). if I revert my ScriptCards to a prior version I get the same error. Please update to the latest version of ScriptCards from the GIST  and you should be good to go.
That was the problem. Thx for your help. And thx for that awesome script!