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

How to make an ability/macro be sent to the text chat by its character instead of the player

1734354454

Edited 1734354584
Hello all,  Don't know if im explaining correctly, but essentially, i don't want it to say i (the GM) made an attack, i want it to say the monster who is attacking did. I know i can achieve this by choosing that monster from the dropdown at the bottom of the text chat sidebar (the "As:" dropdown), but i would like to have it be automatic when i use the Ability macro. All of my monster's Abilities are set to "Show as token actions", so their macro's appear as buttons on the top of the screen while the monsters token is selected. Is there any way to do this?
1734357432

Edited 1734357447
As the GM, you have access to the /as command - so for those abilities, you can start the ability macro with /as "@{character_name}" and it'll show in the chat as being sent by that character (though without the avatar).
1734359749

Edited 1734359767
Tuo said: As the GM, you have access to the /as command - so for those abilities, you can start the ability macro with /as "@{character_name}" and it'll show in the chat as being sent by that character (though without the avatar). Thanks for the help! Im getting this error: " No attribute was found for @{Feral Troll|Feral Troll} " Am i supposed to remove the "" or something?
Did you replace character_name in the attribute call with, well, the character name? @{character_name} is an inherent attribute that contains the name of the character sheet it is called from, so you don't need to change it to anything - just copy it as it is and it should work. The quotation marks are needed for any names containing spaces, as without them the /as command would clip the name at first space. If it still doesn't work - what sheet are you using?
1734360792

Edited 1734361007
Update: this seemed to somewhat work: /as "@{selected|token_name}"  All of my macros are set up as buttons while selecting the token anyway, so that works for me. Still doesn't display the monsters token next to the name though, if anyone has a solution that includes that, please let me know.
1734360892

Edited 1734360969
Tuo said: Did you replace character_name in the attribute call with, well, the character name? @{character_name} is an inherent attribute that contains the name of the character sheet it is called from, so you don't need to change it to anything - just copy it as it is and it should work. The quotation marks are needed for any names containing spaces, as without them the /as command would clip the name at first space. If it still doesn't work - what sheet are you using? Yes, i replaced the name, the monsters name was Feral Troll. I will try without replacing, ty. But, im using the 5e monster sheet EDIT: Yes, thats working now, ty. Didn't realize i wasnt supposed to replace the name.
To get the avatar displayed in the chat, the /as command isn't enough - you can't change the actual character selected for the chat with macros. You might be able to do that with scripts (which I can't help you with), but you'd need pro subscription for that.
Calavid said: Update: this seemed to somewhat work: /as "@{selected|token_name}"  All of my macros are set up as buttons while selecting the token anyway, so that works for me. Still doesn't display the monsters token next to the name though, if anyone has a solution that includes that, please let me know. If you are typing the command into chat, or using a Collections macro, then you need to have a character reference: /as "@{selected|character_name}" I am attacking! /as "@{target|character_name}" I am attacking! /as "@{Feral Troll|character_name}" I am attacking! If the command is directly on a character sheet, then you can omit the character reference, because Roll20 will automatically pull it from the character that the command is on. Where the button is created makes a difference - a Token Action from a Collections macro looks exactly the same as a Token Action from an Ability macro on a character sheet, and they both show up in the same place, but they function differently in terms of the character reference. If you are using a new Beacon sheet (such as the D&D 2024 by Roll20) then some of these character sheet and token references don't work. It's always a good idea to post which game and character sheet you are using, as well as if you are playing in a Jumpgate game, to help troubleshoot, because all of those things may affect the responses you get for help.
Right, sorry, im not using Jumpgate. Just using 2014 5e sheets, as thats what i know and understand
1734369562
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
There is a script that can do this, but of course, scripts are a Pro perk. I'll have to check if the Aaron ever updated it to do automatically.
1734370246
The Aaron
Roll20 Production Team
API Scripter
I have this one that will switch to whatever character's turn is at the top of the turn order, when it is displayed: on('ready',()=>{ const playerCanControl = (obj, playerid='any') => { const playerInControlledByList = (list, playerid) => list.includes('all') || list.includes(playerid) || ('any'===playerid && list.length); let players = obj.get('controlledby') .split(/,/) .filter(s=>s.length); if(playerInControlledByList(players,playerid)){ return true; } if('' !== obj.get('represents') ) { players = (getObj('character',obj.get('represents')) || {get: function(){return '';} } ) .get('controlledby').split(/,/) .filter(s=>s.length); return playerInControlledByList(players,playerid); } return false; }; const GetGMs = () => findObjs({type:'player'}).filter(p=>playerIsGM(p.id)); const getTurnArray = () => ( '' === Campaign().get('turnorder') ? [] : JSON.parse(Campaign().get('turnorder'))); const getCurrentTurnToken = () => getObj('graphic',(getTurnArray()[0]||{}).id); const DoOnEachTurn = () => { let t = getCurrentTurnToken(); let speakingas = ''; if(t){ let c = getObj('character',t.get('represents')); if(c && !playerCanControl(c)){ speakingas = `character|${c.id}`; } } GetGMs().forEach(p=>p.set({speakingas})); }; const ResetGMSpeaking = () => { GetGMs().forEach(p=>p.set({speakingas:''})); }; on('change:campaign:initiativepage',()=>{ if(false == Campaign().get('initiativepage')){ ResetGMSpeaking(); } else { DoOnEachTurn(); } }); on('chat:message', (msg)=>{ if('api'===msg.type && /^!doet\b/i.test(msg.content) && playerIsGM(msg.playerid)){ DoOnEachTurn(); } }); on('change:campaign:turnorder', ()=>setTimeout(()=>DoOnEachTurn(),1000)); on('chat:message', (msg) => { if('api'===msg.type && /^![ep]ot\b/.test(msg.content)){ setTimeout(()=>DoOnEachTurn(),1000); } }); });
1734370408
The Aaron
Roll20 Production Team
API Scripter
It would be hard to do anything more than this with the API because of the sequence of events.  The API doesn't know what you have selected until it gets a command, so it would know too late to shift the speaking as in time for the ability to go off.  Even if you had a command at the start of the ability, the rest of the ability would be processed locally on the client before the API had a chance to receive that command and change the speaking as.  The best you could do short of the above script + only running current turn actions would be to have a macro on all tokens that sets the speaking as to that token's character, and then use that Token Action before any other token actions.
1734375585

Edited 1734375948
Thanks for chiming in guys! We aren't using the initiative tracker. Im trying to jury-rig roll20 to run the D&D Adventure System board games, so turn order is just clockwise around the table (or right-to-left, with how im setting it up, plus things enter and leave the initiative order at multiple places so that would be very tedious to manage with roll20s tracker). I guess ill just have to make do without the icons, the players can at least use their character's "speaking as", we'll just have to make do with names only for monsters and other effects. Thank you all again for your suggestions. All i need now is a way to attach macro's to cards in decks... which im guessing isnt possible, but oh well. Cheers, all!
1734380202
Gold
Forum Champion
You can, however, use an API script like Color Emote to show the Monster's token-or-avatar picture in chat. It would be a different command, which you could either trigger as its own macro, or possibly (not sure) might be able to include the !command in your attack macro. If it can't be included in the attack macro you would have to click the Color Emote anytime you want it, maybe once on the 1st round of combat, or maybe every time you attack depending on what you really want. Another downside of this is the monster's pic is not appearing directly next to the attack, but could easily appear above or below as the next chat line. However a massive UPSIDE of this method, you get to choose the background color (using Aura 2 color swatch), and you get to set the SIZE of the picture of the monster in chat. I use the Gargantuan or Collossal size setting which makes the monster pic take up most of the chatroom width, which really shows off the monster artwork nicely.