phylll / mychs-macro-magic

A simple, sane, and friendly little scripting language for your Roll20 macros.
MIT License
0 stars 0 forks source link

Is it possible to build dynamic sequential user dialogs? #52

Open phylll opened 2 years ago

phylll commented 2 years ago

We are no longer limited to every detail of any user dialog being statically defined for a ?{...} statement in the code, since we can now execute such code dynamically. We can store input controls in attributes, e.g. if MacroSheet.myUniqueInput is set as ?{Input|a,0|b,1|c,2}, this script...

!mmm script
!mmm   set choice = "@{MacroSheet|myUniqueInput}"
!mmm   chat: ${choice}
!mmm end script

... launches the input control and writes the chosen value to the chat (0, 1 or 2).

A separate script, executed before the one above is even sent to MMM and thus parsed/expanded by the Roll20 chat engine, could dynamically set the myUniqueInput attribute and thus change the options given to the player or even replace the entire control by a preset value or nothing at all (""). They cannot be part of the same script / execution chain, since then the Roll20 attribute reference would be expanded before it got changed by MMM.

What does not work: