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

Formatting help

This is pretty much my first look at anything coding related ever. In short I'm looking to make macros for various homebrew items that will account for various things depending on the player, stuff like regular roll/advantage/disadvantage, for the ranger rogue / sharpshooter/sneak attack, for the warlock/paladin, hexblades curse/great weapon master. I have working code for everything seperately, for example: &{template:atkdmg}{{charname=Angelique Solarix}} {{rname=Esprit}} {{mod=+12}} {{r1=[[1d20 +12]]}} {{attack=1}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[1d10+8]]}} {{dmg1type=Radiant}} {{crit1=Crit: 10}} {{dmg2flag=1}} {{dmg2=[[2d6]]}} {{dmg2type=Radiant(Against Fiends and Undead Targets)}} {{crit2=Crit: 12}} {{normal=1}} Is the default, and then I change {{r1=[[1d20 +12]]}} to {{r1=[[2d20kh1 +12]]}} or {{r1=[[2d20kl1 +12]]}} for advantage/disadvantage, or I change {{r1=[[1d20 +12]]}} to {{r1=[[1d20 +7]]}} and {{dmg1=[[1d10+8]]}}to {{dmg1=[[1d10+18]]}} to simulate GWM. However what I'm after is something where it brings up the pop up and the player can select the desired options and it will work. From what I gather the commands for that would be stuff like ?{Attack Type|Regular, <abc>|Advantage, <abd>|Disadvantage, <abe>|} but that does not work, nor does ?{Attack Type|Regular, #Regular-Attack|Advantage, #ADV-Attack|Disadvantage, DIS-Attack|} So is there a way to get it to roll with the correct formatting but have it go through a check list of everything (For Paladin example: Type of attack roll (Reg/Adv/Dis) > GWM (Yes/No) > Hexblades Curse > (Yes/No) > Necrotic Shroud or for Range/Rogue example, Type of attack roll (r/a/d) > sharpshooter (y/n) > sneak attack (y/n) > fury of the small (y/n)
1686192360
GiGs
Pro
Sheet Author
API Scripter
It is possible to do what you want, but you either have to deal with html entities or chains of queries, or both. You can learn how html entitiers are used here: <a href="https://wiki.roll20.net/Macros#Advanced_Usage_for_Roll_Queries" rel="nofollow">https://wiki.roll20.net/Macros#Advanced_Usage_for_Roll_Queries</a> My recommendation: learn about chat menus, and have a series of buttons that have the options you want preselected for each button.
1686193853

Edited 1686193887
Gauss
Forum Champion
Here is the wiki on Chat Menus that GiGs referenced. If you need help setting that up let me know, but as GiGs said, HTML entities are a pain, Chat Menus are simpler.&nbsp;
1686213094

Edited 1686215663
Interesting, I had come across the HTML things in the time between my post and yours, and I think I understand the rough premise, which is as I understand it that in something like "any "}" between the one which is a part of the first "{" needs to be replaced by &amp;#125; that essentially I can do this with a simple ctrl+f and find and replace command (along with any other commas or pipes) which turns my (working) code into &amp;{template:atkdmg&amp;#125;{{charname=Angelique Solarix&amp;#125;&amp;#125; {{rname=Esprit&amp;#125;&amp;#125; {{mod=+12&amp;#125;&amp;#125; {{r1=[[1d20 +12]]&amp;#125;&amp;#125; {{attack=1&amp;#125;&amp;#125; {{damage=1&amp;#125;&amp;#125; {{dmg1flag=1&amp;#125;&amp;#125; {{dmg1=[[1d10+8]]&amp;#125;&amp;#125; {{dmg1type=Radiant&amp;#125;&amp;#125; {{crit1=Crit: 10&amp;#125;&amp;#125; {{dmg2flag=1&amp;#125;&amp;#125; {{dmg2=[[2d6]]&amp;#125;&amp;#125; {{dmg2type=Radiant(Against Fiends and Undead Targets)&amp;#125;&amp;#125; {{crit2=Crit: 12&amp;#125;&amp;#125; {{normal=1&amp;#125;&amp;#125; Which when pasted into roll 20 doesn't work, even when posted on it's own ( before/after changing } to html ) From a quick glance, chat menus seem like an interesting option I wasn't aware of which might even be a better option. I'll look into them now and give them a whirl, but I'd still quite like to get to the bottom of this html stuff if for nothing else than my own obstinate determination and hatred of conceding defeat. Edit to add: Well those chat windows seem... easy and effective? &amp;{template:default}{{name=Attacks menu}}{{[Esprit](`#Esprit)= [Esprit (Advantage)](`#Esprit-ADV)}}{{[Esprit (Disadvantage)](`#Esprit-DIS)}} seems to be all it takes o.o This is going to be really wanksy "I want it to look pretty" stuff, but is there anyway to make the text format the same within the chat menu (the text on left is bold but the text on right isnt) also to have rows of 3 (so one row is just attacks regular/advantage/disadvantage, the second with is regular/advantage/disadvantage but all against hexblade targets etc) I assume from experimentation and deducation the = between (`#Esprit)= [Esprit is what puts it on the same row, and that ending&nbsp; the (`#Esprit-ADV) with }} not = is what puts the next one on the second row, but if I try putting closing it as (`#Esprit-ADV)= it doesnt seem to work
1686218339
GiGs
Pro
Sheet Author
API Scripter
You cant use a simple find &amp; replace because you don''t replace all }. you only replace the ones you need to. This for example doesn't work: &amp;{template:atkdmg&amp;#125;, it must be &amp;{template:atkdmg} - unless its inside a query. I havent looked at the rest of your macro. If you're using queries, its best to move everything that you can outside of the query, so you don't need to mess with sd msny html entities. This is why HTML substitition is frustrating: you have to (1) build the complete macro in its entirety without HTML entites, which will not work , and then (2) insert the HTM entities where you need to, to make it work. You have to build the full macro so you can see the big picture. This part is essential if you macro calls other macros - you have to copy those macros and insert them into the first macro.
1686218473

Edited 1686227679
GiGs
Pro
Sheet Author
API Scripter
Regarding arranging rolltemplates: you are a but limited here. There is always exactly two columns. However one the coumns can be empty. You can do {{=Stuff here} or {{stuff here=}} Also, you can make both sides bold by putting ** on either side of the text you want to make bold. So {{=**stuff here**}} for example.
Daaamn that sounds awful unless you're a legit coder and really understand it all lol. The **works nice, thanks
1686227664

Edited 1686227693
GiGs
Pro
Sheet Author
API Scripter
I said chat menus in my post when I meant to say rolltemplates (now corrected). Chat menus are very easy, and we don't have much control over arranging their buttons in a rolltemplate, but its not in the same league of awfulness as working with html entities :)
1686233754
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Link:&nbsp; Chat Menu