You're running into two problems- one syntax error, and one very fundamental roll20 problem: the Order of Operations. The syntax error: you cant do this: @{body|max}. It will look for a character named body, and an attribute named max. Whenever you use the |max syntax, you must include something to tell roll20 which character to use, like @{selected|body|max) or @{Frodo|body|max}. The second problem is a killer though. When you start a macro, roll20 checks all attribute calls (like @{selected|body|max}) mentioned in the macro, and replaces the call with the value. It does this before proceeding with the macro. So with this: !setattr --sel --body|max|[[1d10]] --body|=@{selected|body|max} It is getting the body_max before doing anything else. Lets say it's currently 0. The above line becomes !setattr --sel --body|max|[[1d10]] --body|=0 Because it uses attribute values as they were before the macro started. The only way around this problem in this case (since your value is based on a roll) is to create a custom API script.