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 .
×

Auto-Encoding of HTML Entities in Advanced Macros

1569881604

Edited 1569881667
I've been working on a tool to automatically encode HTML entities as required in advanced macros with many nested drop downs, the intention being to make it easier to create macros with "branching" (all outcomes from several paths manually added to the macro). I've tested it with several macros so far, but would like to ask for additional complicated macros to test with. Ideally OGL D&D5e (as that what I have a sheet set up to test with), but ones from any system will do. One of the macros I've tested it with: ?{Level: |Level 1, ?{Single Target?|Yes, [[3d4 + 3]] |No, ?{Number of targets? |1, ?{Missiles to 1st Target|1, [[1d4+1]] + "A1" |2, [[2d4+2]] + "A2" |3, [[3d4+3]] + "A3" } |2, ?{Missiles to 1st Target|1, [[1d4+1]] + "A1" |2, [[2d4+2]] + "A2" |3, [[3d4+3]] + "A3" } ?{Missiles to 2nd Target|1, [[1d4+1]] + "B1" |2, [[2d4+2]] + "B2" |3, [[3d4+3]] + "B3" } |3, ?{Missiles to 1st Target|1, [[1d4+1]] + "A1" |2, [[2d4+2]] + "A2" |3, [[3d4+3]] + "A3" } ?{Missiles to 2nd Target|1, [[1d4+1]] + "B1" |2, [[2d4+2]] + "B2" |3, [[3d4+3]] + "B3" } ?{Missiles to 3rd Target|1, [[1d4+1]] + "C1" |2, [[2d4+2]] + "C2" |3, [[3d4+3]] + "C3" } } } |Level 2, ?{Single Target?|Yes, [[4d4+4]]|No, ?{Number of targets? |1, ?{Missiles to 1st Target|1, [[1d4+1]] |2, [[2d4+2]] |3, [[3d4+3]] |4, [[4d4+4]] } |2, ?{Missiles to 1st Target|1, [[1d4+1]] |2, [[2d4+2]] |3, [[3d4+3]] |4, [[4d4+4]] } ?{Missiles to 2nd Target|1, [[1d4+1]] |2, [[2d4+2]] |3, [[3d4+3]] |4, [[4d4+4]] } |3, ?{Missiles to 1st Target|1, [[1d4+1]] |2, [[2d4+2]] |3, [[3d4+3]] |4, [[4d4+4]] } ?{Missiles to 2nd Target|1, [[1d4+1]] |2, [[2d4+2]] |3, [[3d4+3]] |4, [[4d4+4]] } ?{Missiles to 3rd Target|1, [[1d4+1]] |2, [[2d4+2]] |3, [[3d4+3]] |4, [[4d4+4]] } |4, ?{Missiles to 1st Target|1, [[1d4+1]] |2, [[2d4+2]] |3, [[3d4+3]] |4, [[4d4+4]] } ?{Missiles to 2nd Target|1, [[1d4+1]] |2, [[2d4+2]] |3, [[3d4+3]] |4, [[4d4+4]] } ?{Missiles to 3rd Target|1, [[1d4+1]] |2, [[2d4+2]] |3, [[3d4+3]] |4, [[4d4+4]] } ?{Missiles to 4th Target|1, [[1d4+1]] |2, [[2d4+2]] |3, [[3d4+3]] |4, [[4d4+4]] } } } } Encoded: ?{Level: |Level 1, ?{Single Target?|Yes, [[3d4 + 3]] |No, ?{Number of targets? |1, ?{Missiles to 1st Target|1, [[1d4+1]] + "A1" |2, [[2d4+2]] + "A2" |3, [[3d4+3]] + "A3" } |2, ?{Missiles to 1st Target|1, [[1d4+1]] + "A1" |2, [[2d4+2]] + "A2" |3, [[3d4+3]] + "A3" } ?{Missiles to 2nd Target|1, [[1d4+1]] + "B1" |2, [[2d4+2]] + "B2" |3, [[3d4+3]] + "B3" } |3, ?{Missiles to 1st Target|1, [[1d4+1]] + "A1" |2, [[2d4+2]] + "A2" |3, [[3d4+3]] + "A3" } ?{Missiles to 2nd Target|1, [[1d4+1]] + "B1" |2, [[2d4+2]] + "B2" |3, [[3d4+3]] + "B3" } ?{Missiles to 3rd Target|1, [[1d4+1]] + "C1" |2, [[2d4+2]] + "C2" |3, [[3d4+3]] + "C3" } } } |Level 2, ?{Single Target?|Yes, [[4d4+4]]|No, ?{Number of targets? |1, ?{Missiles to 1st Target|1, [[1d4+1]] |2, [[2d4+2]] |3, [[3d4+3]] |4, [[4d4+4]] } |2, ?{Missiles to 1st Target|1, [[1d4+1]] |2, [[2d4+2]] |3, [[3d4+3]] |4, [[4d4+4]] } ?{Missiles to 2nd Target|1, [[1d4+1]] |2, [[2d4+2]] |3, [[3d4+3]] |4, [[4d4+4]] } |3, ?{Missiles to 1st Target|1, [[1d4+1]] |2, [[2d4+2]] |3, [[3d4+3]] |4, [[4d4+4]] } ?{Missiles to 2nd Target|1, [[1d4+1]] |2, [[2d4+2]] |3, [[3d4+3]] |4, [[4d4+4]] } ?{Missiles to 3rd Target|1, [[1d4+1]] |2, [[2d4+2]] |3, [[3d4+3]] |4, [[4d4+4]] } |4, ?{Missiles to 1st Target|1, [[1d4+1]] |2, [[2d4+2]] |3, [[3d4+3]] |4, [[4d4+4]] } ?{Missiles to 2nd Target|1, [[1d4+1]] |2, [[2d4+2]] |3, [[3d4+3]] |4, [[4d4+4]] } ?{Missiles to 3rd Target|1, [[1d4+1]] |2, [[2d4+2]] |3, [[3d4+3]] |4, [[4d4+4]] } ?{Missiles to 4th Target|1, [[1d4+1]] |2, [[2d4+2]] |3, [[3d4+3]] |4, [[4d4+4]] } } } } No code published anywhere yet but should be on GitHub in the near future. The tool is written in Typescript.
1569882582
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
You might want to look at this Stupid Trick to see if you can get any useful techniques from it: Drop Down Nester  - Scott C
1569883245
Ziechael
Forum Champion
Sheet Author
API Scripter
Pitfall to consider: Attribute calls in nested queries don't require html encoding. You've likely got that covered but would hate for it to trip you up!
1569883852

Edited 1569883952
keithcurtis said: You might want to look at this Stupid Trick to see if you can get any useful techniques from it: Drop Down Nester &nbsp;- Scott C Thanks - I'll take a look! Yep, thanks for the reminder - I've already ran into that issue, and managed to handle it. Code is now on GitHub for people that want to take a look: <a href="https://github.com/JakeYallop/Roll20MacroEncoder" rel="nofollow">https://github.com/JakeYallop/Roll20MacroEncoder</a>