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

Is there a way to set the character name in a macro

So when you create an ability macro, most of the attributes can be called easily like @{hp} instead of needing to use the character name like @{Jeremy R.|hp}. However, max values require the character name to be entered like so @{Jeremy R.|hp|max}; you cannot use @{hp|max} because it things you are looking for a value of max from a character named hp. However, is there anyway I can reference the current character's name so I can easily copy paste these macros and not worry if a character changes their name? I've tried a few variations like @{@{character_name}|hp|max}, @{[[@{character_name}]]|hp|max, but none of these seem to work. I do NOT want to use the selected key word as I'm ultimately going to call this from another macro in which I may not have the character selected.
1520003204

Edited 1520003264
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
If you will always (or at least mostly) have tokens on the vtt, you can use the selected keyword in place of a character name.
1520003880
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Since you don't want to use selected , will target work?
Since you know which attribute you are looking for already, you can probably use the prefix  trick. You have an attribute called prefix with a value of @{ Then in your macro you string the attribute call together like so @{prefix}@{character_name}|hp|max} I have not tested it, but it should work in theory.
1520004264
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Ah, sorry,missed the not wanting to use the selected keyword. That's what I get for checking the forums when I'm only half awake.
1520006152
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Kyle G. said: Since you know which attribute you are looking for already, you can probably use the prefix  trick. You have an attribute called prefix with a value of @{ Then in your macro you string the attribute call together like so @{prefix}@{character_name}|hp|max} I have not tested it, but it should work in theory. Kyle G, that's the second time I have seen you suggest that in a few days. You should write up an entry for the  Stupid Tricks thread. It looks like a broadly useful technique.
1520006377

Edited 1520007574
Yes, the reason I'm not wanting to call selected or targeted is, I am creating a resource macro / ability for each PC that contains things like spells used, divine channel, arrows, etc. I'm doing this for each PC on their PC sheet. Then I want a master macro that I can hit that will call a specific character with a query (another issue I'm working on with) or simply output all 5 of them to chat. I'd like to not have accidental wrong character names, worry about players changing their character names, etc. I'll give the prefix thing a try. Edit: This seems to be working. I'm going to try and get fancy and combine some attributes to include the character name even. More Edits: With some testing, I've gotten something fairly simple to work. So here's what works and what does not. What doesn't work. You can't daisy-chain the elements in a single attribute like so @{@{character_name} , this seems to cause the same issue as the initial reason this wouldn't work. What does work.  You can create an attribute, in this case named prefix , and give it a value of @{ as mentioned by Kyle G. Then I create another attribute called charprefix with a value of @{prefix}@{character_name} , I then use this value in my Ability Macro like so @{charprefix}|hp|max} So this is the final output looking the way I want it to. Now I just need to chain each of these from a single macro at the game level.
1520007616

Edited 1520007625
I agree with Keith, this would be useful for the stupid tricks thread. Likewise, I wish that thread could be pinned, or have a clean version of that thread with just the tricks and none of the comments, or maybe a wiki page!
keithcurtis said: Kyle G, that's the second time I have seen you suggest that in a few days. You should write up an entry for the  Stupid Tricks thread. It looks like a broadly useful technique. Done
1520008582
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Jeremy R. said: I agree with Keith, this would be useful for the stupid tricks thread. Likewise, I wish that thread could be pinned, or have a clean version of that thread with just the tricks and none of the comments, or maybe a wiki page! I've tried (and some have also) to put a header at the top of each trick. As for keeping it pinned, did you see  this stupid trick ? The only problem I have seen with the tricks thread is that forum searching on Roll20 is very spotty in terms of results. I have often had much more luck with a "Roll20.net" keyworded Google search.
1520009103

Edited 1520009337
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Stupid Trick Synergy! Combine your macro with  this trick. Basically, using a master macro sheet to store your campaign macros. I call mine "Macros". If you put the prefix attribute on the Macros sheet, you don't have to add a custom attribute to every character. Just change your macro to this: @{Macros|prefix}@{character_name}|hp|max} It calls the prefix from the Macros sheet, but gets the referenced attribute from the character running the macro. One less step per character. I just tested it, and it seems to work fine.
1520020129

Edited 1520020447
So I'll ask the question here with a Macro Character Sheet, do the players need to have access to the character to be able to call a macro from it? Another good trick is, how do you post a link to a specific spot in a thread? I think I know, permalink?
Jeremy R. said: So I'll ask the question here with a Macro Character Sheet, do the players need to have access to the character to be able to call a macro from it? Yes, they need edit & control access but it doesn't need to be in the player's jounral Another good trick is, how do you post a link to a specific spot in a thread? I think I know, permalink? Yes, permalink the post and then copy your browser's current URL.