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
This post has been closed. You can still view previous posts, but you can't post any new replies.

Nesting Macros

A feature I'd like to see is nest-able macros without api scripting. Example is currently you can't nest a bracketed item in a bracket item. as a free user Macro:(Does not work as is) ?{Choose an Attack | Balance,/em balances the shields with a computers check of [[1d20cs>20 +@{Reina|Computers} +@{Reina|ShipComputer} +?{Mod|0} ]] | Scan Sensors,/em scans for ship information with a computers check of [[1d20cs>20 +@{Reina|Computers} +@{Reina|ShipComputer} +?{Mod|0} ]] | Target Systems,/em targets the ship's ?{System |core|engines|life support|sensors|weapons} with a computers check of [[1d20cs>20 +@{Reina|Computers} +@{Reina|ShipComputer} +?{Mod|0} ]] | Glide,/em moves the star-ship at half its normal speed. The star-ship can take turns during this movement but the star-ship's distance between turns increases by 2. Add @{Reina|Pilot} to the star-ship's AC and TL for this round with a pilot override check of [[1d20cs>20 +@{Reina|Pilot} +@{Reina|ShipPilot} + ?{Mod|0} ]] | Snap Shot,/em fires one of your star-ship's weapons with gunnery override check of [[1d20cs>20 + {@{Reina|Pilot},@{Reina|BAB}}kh1 - 2 + ?{Mod|0}]] } The reason it does not work is because each element --> ------------------------------------------ ?{List | ect, 1 | ect2, 2} @{Character|Atribute} ?{SimpleChoice |1} {@{Character|Attribute},@{Character|Attribute,[[1d6+12]]}}kh1 @{selected|token_name} @{target|token_name} %{selected|Attribute} ------------------------------------------ <-- looks for a close "bracket", "commas", "|", ect in the whole line, not in logically mathematical method. I understand that this would require an overhaul of the api that reads macros. This is known to happen with %, @, ?, }, {, commas, #, and |. There is 2 workarounds already; 1) Replace all the elements markers as Unicode, so it reads the whole line before processing the element. This option may disappear with future changes, but does exist as of this posting. Example turn line one into line two, ------------------------------------------- /em @{selected|token_name} attacks @{target|token_name} with his/her ?{List | Melee, [[ 1d20 + @{Character|Attribute} + ?{Mod|0}]] | Ranged, [[ 1d20 + @{Character|Attribute} + ?{Mod|0}]]} /em @{selected|token_name} attacks @{target|token_name} with his/her ?{List | Melee, [[ 1d20 + &# 64;&# 123;Character&# 124;Attribute&# 125; + &# 63;&# 123;Mod&# 124;0&# 125;]] | Ranged, [[ 1d20 + &# 64;&# 123;Character&# 124;Attribute&# 125; + &# 63;&# 123;Mod&# 124;0&# 125;]]}  ------------------------------------------- of course removing the extra space between each "&#" and "xxx;"(Unicode number), because my example would be auto replaced if I left the Unicode as is without the space. But this is very cumbersome plus if you open and re-save the macro all Unicode is replaced with its normal character and again goes back to the system reading operation out of order. 2) The other option is writing your own API script, which not every user is capable of. Due to either finance or ability. These workarounds do work but, My Suggestion is to rework macro processing to include order of operations in a nested situation, whether that nesting comes from a single macro with nested operations or more than one macro that cause a nested operation order error when one macro calls another. On the architecture programming side of it, I can't offer more help in implementing a new macro processing because I don't know your internal code, and rightly so.  So I Drop It In the Suggestion Pool, and hope it floats..... Feel free community,  I'm not offended at my own stupidity. Tell me what you think about my suggestion.
Just a couple of things to note as I agree this is an extremely common occurrence.  Some instances of '{', ',', and '|' do not need to be encoded due to the order of operations of the chat system. Mainly attributes (@{}), abilities (%{}), and macros (#Macro). You can find more information on this in the  Advanced Usage for Roll Queries wiki. However the values of these attributes, abilities, and macros may need to be encoded in order to work properly. This is why you will see a lot of the community suggesting to use  API Command Buttons and  Ability Command Buttons . While the name suggests API, this functionality is available to ALL users regardless of subscription. They are not as user friendly (meaning that they take up more space in the chat window overall), but they are easier to set up and implement.
Would you please expand upon what you mean. From your examples, I did not see a need for an API script to solve your use-case. Rand K. said: 2) The other option is writing your own API script
1503684745

Edited 1503685063
Reply to Kyle G. Example macro: ?{Choose an Attack | Balance,/em balances the shields with a computers check of [[1d20cs>20 +@{Reina|Computers} +@{Reina|ShipComputer} +?{Mod|0} ]] | Scan Sensors,/em scans for ship information with a computers check of [[1d20cs>20 +@{Reina|Computers} +@{Reina|ShipComputer} +?{Mod|0} ]] | Target Systems,/em targets the ship's ?{System |core|engines|life support|sensors|weapons} with a computers check of [[1d20cs>20 +@{Reina|Computers} +@{Reina|ShipComputer} +?{Mod|0} ]] | Glide,/em moves the star-ship at half its normal speed. The star-ship can take turns during this movement but the star-ship's distance between turns increases by 2. Add @{Reina|Pilot} to the star-ship's AC and TL for this round with a pilot override check of [[1d20cs>20 +@{Reina|Pilot} +@{Reina|ShipPilot} + ?{Mod|0} ]] | Snap Shot,/em fires one of your star-ship's weapons with gunnery override check of [[1d20cs>20 + {@{Reina|Pilot},@{Reina|BAB}}kh1 - 2 + ?{Mod|0}]] }                                       As Writen above  As Writen with unicode placed in places When you use this macro as writen The First "?{Choose an Attack ...." Pull down list Should have Balance, Scan Sensors, Target Systems, Glide, Snap Shot. Withh a submenu on Target systems of core, engines, life support, sensors, weapons. The result of using it as is a menu of Balance and the number 0. If you replace the unicode for ",}{@?|" the menus work right, but the roll does not process right. I need to figure out which to replace and which not to replace to get the order of operations to to process right but it not really important. I was just throwing it up here as a suggestion for improvements to roll20 for the "Nesting in Macros" suggestion.                          All Unicode replaced  Separate Macro not in menus
1503694813

Edited 1503694916
Ziechael
Forum Champion
Sheet Author
API Scripter
Rand K. said: If you replace the unicode for ",}{@?|" the menus work right, but the roll does not process right. I need to figure out which to replace and which not to replace to get the order of operations to to process right You are replacing too much, you only need to replace '}', '|' and ',' and even then only when they don't form part of attribute calls. When you replace '@' and '{' etc you are preventing the attributes from parsing which is giving you the following: Check out the  wiki for more info... but generally yes, I agree with the suggestion that this wizardry would be easier if we didn't have to dabble in html-omancy to get it working right ;)
"Html-Omancy" LOL   I fell over on that one.
1550175561
Roll20 Dev Team
Pro
Marketplace Creator
Thanks for the suggestion! After 30 days, Suggestions and Ideas with fewer than 10 votes are closed and the votes are refunded to promote freshness. Your suggestion didn't build the right momentum this time, but feel free to submit it again! We find that the best suggestions describe the problem you are having, and the solution you want. You can learn more about the process of making suggestions on the Roll20 Wiki! More details can be found here .