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 .
×

ChatSetAttr to insert reference to other attribute in attribute field

I want to use the !setattr function to add an attribute called "talk" to all characters in my game. I want the attribute field to read something like: !as @{target|token_name} I have nothing to say to you My players will then use a macro which simply contains @{target|talk} to get a message as if the target was speaking. By default I want this to be "I have nothing...". I will then change this depending on the character. However, when using the following function call: !setattr --all --talk|!as @{target|token_name} I have nothing to say to you.  I get a request for a target, which is then substituted in place of @{target|token_name} in the attribute field of @{talk}. I want it instead to simply write the letters @{target|token_name} into the field. I have tried using inverted commas around "@{target|token_name}" but the same problem. Many thanks for your help.
1596745392
The Aaron
Roll20 Production Team
API Scripter
Try: !setattr --all --talk|!as @{target|token_name} I have nothing to say to you.
373x45 (Original: 373x45) 373x45 (Original: 373x45) Thanks for the reply, The Aaron. The Aaron said: Try: !setattr --all --talk|!as @{target|token_name} I have nothing to say to you. That's very nearly worked, but it seems to have split the attribute field into a value and a maximum value. Example: Setting talk to !as @{target / token_name} I have nothing to say to you. for character Tim. Which appears like:  I think I had this problem earlier when I was messing around, but I am not sure why it is splitting it like that.
1596746237
The Aaron
Roll20 Production Team
API Scripter
Probably that's a ChatSetAttr argument thing.  Try: !setattr --all --talk|!as @{target|token_name} I have nothing to say to you.
The Aaron said: Probably that's a ChatSetAttr argument thing.  Try: !setattr --all --talk|!as @{target|token_name} I have nothing to say to you. Bah. Same problem. I get: Setting talk to !as @{target& / 124;token_name} I have nothing to say to you. for character Tim.
1596749487
The Aaron
Roll20 Production Team
API Scripter
That is obnoxious. It must be splitting on | and #. Check the help, there might be a way to bracket or escape it. I'll have to check next time I'm at my computer. 
I thought I'd solved the problem by putting a backspace after target i.e.  !setattr--talk|!as @{target\|token_name} I have nothing to say to you. This seems to put the correct words into the attribute field, but querying that attribute gives me something rather strange: t;{target|token_name} I have nothing to say to you.