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

Help with a macro that returns info on a character associated with a selected token.

I am trying to make a macro that whispers info back regarding info on the character that is represented by a selected token.  I have already worked with or GM to make sore that each token does represent the correct character (and tested each).  What we want is a table in chat that gives them the Name, Race / Class, Level, Hit Points, Armor Class, Passive Perception, Initiative Bonus, Spell Save DC and Spell Attack Bonus.  I have done this originally by making a macro that querries the name and then giving the table and that worked, nut now our cmacro that allows us to select a token and then run it (from the macro bar) does not function.  Here is the code: /w gm @{selected|wtype} &{template:default}{{name=Character Info: @{selected|character_name}}} {{Race Class:= @{selected|race} @{selected|class}}} {{Level:= @{selected|base_level}}} {{Hit Points:= @{selected|hp}/@{selected|hp|max}}} {{Armor Class:= @{selected|ac}}} {{Passive Perception:= @{selected|passive_wisdom}}} {{Initiative Bonus:= +@{selected|initiative_bonus}}} {{Spell Save DC:= @{selected|spell_save_dc}}} {{Spell Attack Bonus:= +@{selected|spell_attack_bonus}}}} What am I missing? Probably a dumb mistake ... Here is the return for the one that works with the querry and what we want for the selected token option):
1761528135

Edited 1761528163
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi Jake! We can help a lot more if we know exactly which sheet this references. There are some scripts like Reporter, Universal Chat Menus, or ScriptCards that can do a very good job of this.
1761536757
timmaugh
Forum Champion
API Scripter
When you take the above command line text out of the query, you lose the requirement for the HTML substitutions. In fact, you lose the ability of the macro to run because there will be no opportunity for Roll20 to un-escape the HTML codes. Basically, just replace all of the... } ...instances with... } ...and you should be good. But, like Keith says... there may be cleaner/prettier/more informative options you could get from a script dedicated to this "token report" idea.
Jako Dar said: I am trying to make a macro that whispers info back regarding info on the character that is represented by a selected token.  I have already worked with or GM to make sore that each token does represent the correct character (and tested each).   keithcurtis  said: Hi Jake! We can help a lot more if we know exactly which sheet this references. There are some scripts like Reporter, Universal Chat Menus, or ScriptCards that can do a very good job of this. As Keith said, it's likely that there are already solutions created that you could use and not have to reinvent the wheel. In addition to what he suggested, if you're using the D&D 5E 2014 by Roll20 sheet, then the Statblock Macromule can do exactly what you're looking for. The Stats and Bio menus look like this (you can choose Light or Dark mode):
I do not think Macro Mule works with 2024 sheets yet, but I tested your script, once changed to } and you also had one extra } at the end, and it works wonderfully with 2024. I love the idea, as to not have to load player sheets. Can drop/add other things to custom it to whatever you need. Ty for the great work.