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

ChatSetAttr

Hello, I built a sheet in Excel to create png and I would like to import this sheet into Roll20. To do this I used this script, for example, using ChatSetAttr: !setattr --sel --replace --repeating_npcaction_-CREATE_name|Halberd --repeating_npcaction_-CREATE_description|{{ Melee Weapon Attack: <<1d20cs>19+6>> to hit. Reach 5ft, one target. Critical hit 19-20 Hit: <<3d10 + 4>> Slashing damage plus <<2d10>> Necrotic damage. Critical Hit Total Damage: 36 Slashing damage +22 Necrotic damage. }} The problem is that ChatSetAttr change this  <<1d20cs>19+6>>   with the braket [[ 1d20cs]19+6]]  and I want to mantain  cs>19. How can I do?
1718972032
GiGs
Pro
Sheet Author
API Scripter
Where does the +6 go? You might find it better to use 1d20+6cs>19
This is not the problem. The problem is to import in the description of the attack the  ">" without replace it with "]". I also try without the --replace and with \lbrak and \rbrak, but it doesn't work.
1718980713
timmaugh
Forum Champion
API Scripter
Just to be sure... you were using: [ ] ...NOT: &lbrak; &rbrak; Correct? The former is the HTML replacement; the later won't be recognized. Also, can you be more specific about your workflow? When you say you created an Excel spreadsheet that you "imported"... what are you using to import, and where are you importing to? Most people talk about importing a spreadsheet in terms of making it into a rollable table, but that doesn't sound like what you have going. Is your Excel spreadsheet maybe a list of commands for ChatSetAttr? I'm just wondering: ...what is in your spreadsheet? ...how are you "importing" it? ...where is it ending up? ...how are you using the parts of the spreadsheet once imported? ...where did the PNG file go? If we understand things a bit better, we might be able to offer better solutions.
Yes sure. &lbrack doesn't work. \lbrack doesn't work. By the way: let's do in this way. If I write this code !setattr --sel --replace --repeating_npcaction_-CREATE_name|Halberd --repeating_npcaction_-CREATE_description|{{ Melee Weapon Attack: <<1d20cs>19+6>> to hit. Reach 5ft, one target. Critical hit 19-20 Hit: <<3d10 + 4>> Slashing damage plus <<2d10>> Necrotic damage. Critical Hit Total Damage: 36 Slashing damage +22 Necrotic damage. }} I obtain this description: Can you help me understand how you would write the command for chatsetattr to make "cs>19" stay with the " > "? Regarding my spreadsheet,  It's a kind of NPC creation that I made myself. Based on the skills I select for the NPC it comes up with a code through formulas to then import with ChatSetAttr. It's complicated to explain, but I need to solve this ">" issue to find a workaround on attacks that have improved crit.
1718993105

Edited 1718993773
Matteo B.  said: Hello, I built a sheet in Excel to create png and I would like to import this sheet into Roll20. To do this I used this script, for example, using ChatSetAttr: !setattr --sel --replace --repeating_npcaction_-CREATE_name|Halberd --repeating_npcaction_-CREATE_description|{{ Melee Weapon Attack:  <<1d20cs>19+6>>  to hit. Reach 5ft, one target. Critical hit 19-20 Hit: <<3d10 + 4>> Slashing damage plus <<2d10>> Necrotic damage. Critical Hit Total Damage: 36 Slashing damage +22 Necrotic damage. }} The problem is that ChatSetAttr change this  <<1d20cs>19+6>>   with the braket  [[ 1d20cs]19+6]]  and I want to mantain  cs>19. How can I do? Unfortunately the ChatSetAttr --replace function changes all < to [ and > to ]. The script author Jakob must have guessed that no one would be using < or > in their outputs.  ChatSetAttr Readme : --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 ?. It also looks like his deferral character only works on | or # characters: If you want to use the '|' or '#' characters inside an attribute value, you may escape them with a backslash: use '|' or '#' instead. I'm trying to figure out how to use a Metascript replace function, but it looks like it needs to be deferred until after ChatSetAttr runs... but the order of operations isn't working for me. A temporary workaround in the meantime: manually change the ChatSetAttr script to remove lines 17 and 19: [/</g, "["], [/>/g, "]"], Those are the lines that replace < with [ and > with ]. Then just use the other replacement values for [ and ]: !setattr --sel --repeating_npcaction_-CREATE_name|Halberd --replace --repeating_npcaction_-CREATE_description|Melee Weapon Attack: \\lbrak\\lbrak1d20cs>19+6\\rbrak\\rbrak to hit. Reach 5ft, one target. Critical hit 19-20  Or change lines 17 and 19 to: [/<</g, "["], [/>>/g, "]"], And the command will be:  !setattr --sel --repeating_npcaction_-CREATE_name|Halberd --replace --repeating_npcaction_-CREATE_description|Melee Weapon Attack: <<<<1d20cs>19+6>>>> to hit. Reach 5ft, one target. Critical hit 19-20 
1719003079
timmaugh
Forum Champion
API Scripter
We *should* be able to use ChatSetAttr without the --replace argument if we can preserve the brackets *as* brackets (and not have them be parsed into an inline roll. What I mean is that I think Jarren is onto the right solution (using the metascript replace function), we just have to get it to work. The idea would be... we send a message through chat Roll20 parses it -- this is when we need to hide the brackets Metascripts see the message -- this is when we need to restore the brackets ChatSetAttr sees the message -- and if it sees brackets, that's fine... it won't see a parsed inline roll To do that, we'll use the replace function to obscure the brackets and we'll use the ZeroFrame {&escape} tag to remove a text marker so that the roll isn't detected by metascripts at all, but is simply left in the command line that other scripts like ChatSetAttr will see. That would, I think, look like this (air-coded): !setattr --sel --repeating_npcaction_-CREATE_name|Halberd --repeating_npcaction_-CREATE_description|{{ Melee Weapon Attack:  {&eval}replace(--source|`([)^([) 1d20cs>19+6 (])^(])` --find|`([)`|`[` --find|`(])`|`]`){&/eval}   to hit. Reach 5ft, one target. Critical hit 19-20 Hit:  {&eval}replace(--source|`([)^([) 3d10 + 4 (])^(])` --find|`([)`|`[` --find|`(])`|`]`){&/eval}  Slashing damage plus  {&eval}replace(--source|`([)^([)2 d10 (])^(])` --find|`([)`|`[` --find|`(])`|`]`){&/eval}  Necrotic damage. Critical Hit Total Damage: 36 Slashing damage +22 Necrotic damage. }}  {&escape ^} Give that a try and let us know if it works.
Thank you guys, I used the second Jarren's method, replacing  "<<<<" with "<<" and it's working now.  Thank you so much.