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

Trouble with roll template Helper function

Hi there! Firstly, I would like to preface this with the fact that I wasn't sure weather to post this here, or in the character sheet section. But I just decided here since it seemed more programmed oriented. Anyways, I'm having a lot of trouble making a roll template, specifically working with the provided helper functions. Everything inside the function is not being printed, even if the property is supposed to be true. In this case I hardcoded Lvl to 0 and the template is still not rendering. I was wondering if I was doing something wrong or if I misunderstood the helper function. I also downloaded the MetaScript toolbox for some other things, and that might be having a weird interaction with the helper function or something. I don't know, but any help would be appreciated!
Here is the code in question. It didn't send properly on the first post
1765834249

Edited 1765834660
vÍnce
Pro
Sheet Author
Hi Jovvii, what is the macro you are using to test?  Are you providing Lvl, eU and tU?  example (just providing something to play with.  adjust for your sheet of course) &{template:tester} {{Lvl=Level:[[ 0d0 + @{selected|level} ]]}} {{eU=Roll:[[ ?{roll|1d6} ]]}} {{tU=Total:[[ ?{roll|1d6} + @{selected|level} ]]}} These rolls will only show if the Lvl roll is exactly "0", otherwise, nothing will be shown. You could also just use [[0d0]] or [[0]] might work as well, but it needs to resolve to "0" in order for your helper "{{#rollTotal() Lvl 0}}...{{/rollTotal() Lvl 0}}" to work. &{template:tester} {{Lvl=Level:[[ 0d0 ]]}} {{eU=Roll:[[ ?{roll|1d6} ]]}} {{tU=Total:[[ ?{roll|1d6} + @{selected|level} ]]}}
I recommend posting in the Character Sheet forum, as this doesn't seem to have any Mod script code (which is the intent for posts in this forum).  I also recommend posting the content of the code in the body of your post. You can click on the small 'magic wand' button at the top left of the post window and select 'Code' to format it nicely. If I'm ever helping with code I never want to retype or try to diagnose issues with only a screenshot - but screenshots are also helpful to include with the code!
1765834595
vÍnce
Pro
Sheet Author
Agreed Jarren said: I recommend posting in the Character Sheet forum, as this doesn't seem to have any Mod script code (which is the intent for posts in this forum).  I also recommend posting the content of the code in the body of your post. You can click on the small 'magic wand' button at the top left of the post window and select 'Code' to format it nicely. If I'm ever helping with code I never want to retype or try to diagnose issues with only a screenshot - but screenshots are also helpful to include with the code!
1766022683

Edited 1766022779
GiGs
Pro
Sheet Author
API Scripter
Also, never post a code extract as a screenshot. Always post it as text - this makes it easier for other people to try your code, and also post fixed edits. Since you want help, this is to your benefit. Make it easy for people to help you. As Jarren says, you can include a screenshot to make it easier to read - but if you do, include that  as well as  the code in text form.
1766022910

Edited 1766022971
GiGs
Pro
Sheet Author
API Scripter
It would be nice to see how eU and tU are being calculated, but as Vince points out, that result will only be posted if it calculated as exactly 0, thanks to the helper function.  I would remove the helper function to test the various parts are working properly.