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

Calling macros from drop-down selection menu

I am having an head-aching issue in setting up my utilities macros; in this scenario I'm trying to group macros with a dropdown action in order to have my own GM actions grouped together under a single button. 

Here is my code example:

?{Which Macro to run?
|Macro1,#macro1
|Macro2,#macro2
}


depending on the content of #macro1 and #macro2 the result is buggy and the dropdown turns into a simple text field with partial content of the macros themselves. Such macros work perfectly when called alone but here I can't even launch them.

What am I missing?

April 06 (4 years ago)
Kraynic
Pro
Sheet Author

https://wiki.roll20.net/Macros#Nesting_in_a_Roll_Query

Do you have a space after the macro name?  Depending on the content of the macro being called, you may need to be using html replacements for some of the characters (which is mentioned in the link I provided, with links to more detailed instructions).

A lot of us find it easier to use chat menus, which are documented in the Roll20 Tricks thread, which is pinned at the top of this forum (the first post is an index).

https://app.roll20.net/forum/permalink/5927072/

https://app.roll20.net/forum/post/5899495/roll20-tips-and-tricks-innovative-solutions-to-common-problems/?pagenum=1


April 06 (4 years ago)

Edited April 06 (4 years ago)

Thank you Kraynic.
Yes, there is a space after the macro so the parser can know when it ends.

I am experimenting with entities substitutions but I can't seem to understand when and where they are needed (an automatic tool/compiler would be great! ), I'll look into a more solid guide on the subject but I have one last question: are you suggesting the subs are meant for the master macro or the external called ones?

I'll see about the in-chat prompts but they don't seem to be very practical for my needs in this very case, and I really need to master dropdown menus for various reasons.

April 07 (4 years ago)
Ziechael
Forum Champion
Sheet Author
API Scripter

Subs are needed in the resulting macros being called as the chat will attempt to expand the query as it processes everything so you end up with:

?{Which Macro to run?
|Macro1,<whatever the content of #macro1 is> |Macro2,<whatever the content of #macro2 is> }

if either of those macros contains problematic characters it will break the query... however, making the html replacements to the macros will stop them working as standalone collections macros. It's a bit catch 22 really with chat menus being the easiest solution to sustain both functions.

Would be good to get an idea of what your macros being called look like?