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

Shaped Sheet abilities and ChatSetAttr

1509941502
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Has anyone had any experience or success in using the ChatSetAttr script to write Feats and Class features for the Shaped Sheet? I'm considering setting some up, but would like to know before I invest the time if it's possible and/or problematic. If somebody has already written this into macro form, that would be an awesome share. Please note: I am NOT asking for any data, particularly for stuff not in the SRD. I do not wish to violate any copyrights. I'm just looking for implementation or code if it has already been created. I'll transcribe any data myself for my own game only. It would sure make character creation easier.
1509951987

Edited 1509967890
Jakob
Sheet Author
API Scripter
I haven't tried it, but I do not see any reason it shouldn't work. EDIT: At the simplest level, something like !setattr {{ <targeting option> --repeating_feat_-create_name|Grappler --repeating_feat_-create_content|You’ve developed the skills necessary to hold your own in close--quarters Grappling. You gain the following benefits: - You have advantage on Attack rolls against a creature you are Grappling. - You can use your action to try to pin a creature Grappled by you. To do so, make another grapple check. If you succeed, you and the creature are both Restrained until the grapple ends. }} should work. There's some trouble with line breaks though, which are replaced automatically by the script and become spaces instead. Though I can probably  fix that by just adding a replacer for newlines..
1509983099

Edited 1509984876
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Would html entities work, or would they just go in as written? I see that  & #8629; functions as a carriage return; I'm not sure if that's exactly the right character, though.  EDIT: I think that just creates a character representing a line break. Maybe $ #10; or & #13; ? (Space added in entities above to prevent parsing.)
1509985480
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That didn't work for line returns, but the API command you gave above does indeed add the feat. I did have to toggle the display checkmark off and on for it to report to the chat window when the feat was clicked on. That bit I can work with. Is there a chance you could massage your script to parse carriage returns?
1509986164
The Aaron
Pro
API Scripter
You could try: 
 That is an escaped ampersand, then the #13; code for a carriage return.  That might end up with the right amount of escaping to end up as a carriage return in the final attribute.
1509989336
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That just returns a Grappler feat with the description: You’ve developed the skills necessary to hold your own in close--quarters Grappling. You gain the following benefits: & It breaks at the first instance. I got the same behavior with the other entities. The actual message returned in chat from ChatSetAttr is Setting repeating_feat_-create_name to Grappler, repeating_feat_-create_content to You’ve developed the skills necessary to hold your own in close--quarters Grappling. You gain the following benefits: & / 13; - You have advantage on Attack rolls against a creature you are Grappling. & for character Krelinao Omil.
1509990381

Edited 1509991222
Jakob
Sheet Author
API Scripter
I've got a patched version of CSA where you can create a newline with just \n coming. I think anything else will be filtered out no matter what, either by Roll20's chat security filtering or by the filtering for attribute values - because you want an actual line break in the attribute value, not an HTML entity representing a line break.
1509991005

Edited 1509991397
Jakob
Sheet Author
API Scripter
Ah, and the checkbox thing is probably just a missing attribute, I didn't look too carefully for which attributes to set. EDIT: Adding --repeating_feat_-create_content_toggle|1 seems to take care of chat output.
1509994955
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Sweet. I'm at work now, but will give all this a try later on. Thank you!
1510018009
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Very strange. It sets the block of text in its entirety, then there's a pause for a fraction of a second, and the feat re-writes itself and deletes everythign before the last \n. Could there be some logic in the sheet fighting me? Here's the command I am sending: !setattr {{ --sel --replace --repeating_feat_-create_name|Grappler --repeating_feat_-create_content|You’ve developed the skills necessary to hold your own in close--quarters Grappling. You gain the following benefits:\n You have advantage on Attack rolls against a creature you are Grappling.\n You can use your action to try to pin a creature Grappled by you. To do so, make another grapple check. If you succeed, you and the creature are both Restrained until the grapple ends. }} Here is the text of the feat created: You can use your action to try to pin a creature Grappled by you. To do so, make another grapple check. If you succeed, you and the creature are both Restrained until the grapple ends.
1510019605
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
OK. I'm an idiot. :/ I was testing on a backup campaign, but updating the script on my main campaign. Your tweak works perfectly. I will now go out into the moonlight and dance the Dance of Shame. Thank you.
1510050700
Jakob
Sheet Author
API Scripter
Well, I'm glad it's working! BTW, you can still include actual line breaks in the macro to make it more readable. There's also a way I could modify ChatSetAttr to simply not replace any line breaks, then it would do the natural thing without needing any --replace or \n ... something to think about.
1510067615
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
For the time being, I'm parsing all input data through a spreadsheet to make the master macro, so if you do make those changes, I'll only have to alter the formula. I spent last night putting in the list of feats and parsing them into a macro that spits them all out as a big list of API buttons. I'll do similar for Class features and backgrounds next. Sweet. Thanks for the very useful script.
1511897615
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Here is a link to a thread where I have posted the resulting Spreadsheet. It produces macros that write all SRD-available class features to a selected character. Thanks again for the code assist.