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

Using ChatSet Attr to make a bless Macro

The lines below roll the dice once and enter the result into the field whereas I want them to just insert the text after the pipe into the field. Does anyone know how I can alter this to make it work? !setattr --sel --global_save_mod|[[1d4[Bless]]] !setattr --sel --global_attack_mod|[[1d4[Bless]]] I'm learning how to do this mostly by trial and error so apologies if this is a stupid question!
1610726924
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi John Carlow, Not a stupid question. It's not intuitive. The Roll20 chat parser wants to resolve what it thinks are inline rolls before processing the rest of the command. Fortunately the author anticipated this and gave you a method of circumventing it. From the documentation: --replace  will replace the characters < , > , ~ , ; , and ` by the characters [,],-,?, and @ in attribute values. This is useful when you do not want roll20 to evaluate your expression in chat before it is parsed by the script. Alternatively, you can use \lbrak, \rbrak, \n, \at, and \ques to create [, ], a newline, @, and ?. Try this (untested): !setattr --sel --replace --global_save_mod|<<1d4<Bless>>> !setattr --sel--replace --global_attack_mod|<<1d4<Bless>>>
Thank you very much :) This version has worked in case anyone else happens to be following :) !setattr --sel --replace --global_save_mod|<<1d4[Bless]>> !setattr --sel --replace --global_attack_mod|<<1d4[Bless]>>
How about if I wanted to toggle Bless on and off with a query? ?{Toggle Bless| Bless ON, /fx nova-holy @{selected|token_id} !token-mod --ids @{selected|token_id} --set statusmarkers|x-blessed !setattr --sel --replace --global_save_mod|<<1d4[Bless]>> !setattr --sel --replace --global_attack_mod|<<1d4[Bless]>> !roll20AM --audio,play,nomenu|Bless   |Bless OFF, !token-mod --ids @{selected|token_id} --set statusmarkers|-x-blessed !setattr --sel --replace --global_save_mod| !setattr --sel --replace --global_attack_mod|} Normal 0 false false false EN-GB X-NONE X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri",sans-serif; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} These Macros work individually but I think I need to substitute some of the pipes and curly brackets for "HTML entities" to make it work as a query... Am I on the right track?