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

Displaying a Chat menu whilst using Mod scripts

Hello! I have a simple condition I want to check, and if it is met, I want a certain menu to be displayed, else I want  something different. Never used conditional statements before in Roll20, so this is why I want to start with something simple like this. So, I have an attribute called @{Prayer} . If Prayer =1 , I want a certain menu to be displayed, else, another... Here's the code: !&{template:default} {{name=**Sample** for @{Selected|character_name} }} {&if @{selected|Prayer} = 1} {{Prayer:=[On](~Réjean|BigAttackHOLD)}} {&else} {{Prayer:=[Off](~Réjean|SmallAttackHOLD)}} {&end} {&log} I checked with the {&log} parameter and I can see that the test is succeful. When Prayer =1 , the proper option is selected, the same when Prayer has any other value. The only problem is that nothing is being displayed in the chat menu. The code does its job, except displaying the result. I can see the correct display in the log window, but not in the chat menu... I think that this: !&{template:default} is the problem, how can I indicate to Roll20 that I'm using meta scripts whilst letting the template do its job? (If I place the " ! " elsewhere, say immediatly before the {&if (...) } element, or even remove it altogether. Then the menu gets displayed, but the test fails, it always displayed the {&else} option, regardless of the value Prayer has.)
1679274863
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi Jean-Guy! Which mod scripts have been installed (relevant to this macro)?
1679278785
timmaugh
Pro
API Scripter
Hey, Jean-Guy. You just need to include a {&simple} somewhere in that command line where it will survive the logical check. {&simple} tells ZeroFrame to release the message to the chat output rather than letting it continue in the script stack. So if your message will *always* be intended to hit the chat (ie, no matter what happens, your message will always be a roll template, so you want that to hit the chat), then you need to have the {&simple} in the command line *outside* of the IF block. !&{template:default}{&if a = b} ... {&else} ... {&end} {&simple} If one side of the conditional is intended to hit the chat but the other is intended to continue to the script stack, then your {&simple} should be in the conditional branch with the side that is intended to hit the chat. !{&if a = b}token-mod --set bar3|[[1d20]] {&else}This will hit chat {&simple} {&end}
Ha! Thank you very much, it's not like you mentioned that parameter at least a dozen time before... I totally forgot about it. Now it behaves as I want it to.