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

[HELP] Asking selection from dynamically obtained repeating section

So I want to use a macro that will pop up a dropdown list of every possible attack stored on the character's repeatable section. Ideas: Can a *macro* dynamically iterate? I don't think so right? So I can hard-code a fixed amount of repeatable section ids, like ?{Choose:|@{selected|repeating_attacks_$0_name} |@{selected|repeating_attacks_$1_name} |@{selected|repeating_attacks_$2_name}} But that is a shot in the dark - maybe the character has 1 attack, maybe he has 18. So, not ideal. The other thing I tried is obtaining dynamically the list of attacks via Mod code. That worked - I obtained it. But sendChat() doesn't allow macros, so even though I have the list, I cannot ask the user to pick from it. Any other ideas?
1663269880
timmaugh
Pro
API Scripter
InsertArgs can do this. Whatever the choices you make, it uses those parameters to go get the information you want. You can store that command in a new ability or send it to chat directly (say, in menu form). There are lots of examples in that first post of the kind of output IA can give you, but the easiest way to see it is to use the !xray command and walk a character sheet. Drill down into the repeating section that has the attacks. The xray will detect the "executability" of the sub-attribute and give you a button to create the menu list based on that attribute across the repeating list. Then "up-arrow" in the chat box to see how that menu was made. The output is HIGHLY customizable, but the learning curve can be (admittedly) a bit steep. If you want to do something like this yourself using the list you've derived, you just need to escape the HTML characters that will cause the elements to expand... for instance you should be able to output the '#' character as  # so that it doesn't immediately expand when you would send that to the chat as a part of a button, for instance.
1664058918
GiGs
Pro
Sheet Author
API Scripter
I I;m understanding your question properly, you can also try the Universal Chat Menus script (search for that thread name). It will create a dynamic list of buttons, macros, or whatever you need from a character sheet. Scott C has a similar script, but I forget the name.