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

!emas Question

Since I like to turn over control of tokens to my players during large battles, I thought I'd found a Christmas miracle with The Aaron's !emas script. However, if I try to use it in a macro thusly...

!emas @{selected|token_name} attacks @{target|token_name} with his sword!

....the script doesn't call the selected token's name. It doesn't throw an error and indeed displays a token name, but I can't figure out where the heck it's getting the name it displays from. I've looked everywhere and the name doesn't exist in any field in the selected token's properties or character sheet that I can see but it still uses another token's name (that's on the tabletop). Stumped. The target token name works as expected — it displays the token's name. But not the selected token.

I'm sure it's just user error on my part...


Thanks,

M.

 
December 29 (8 years ago)
@{selected|token_name} gets the name from the nameplate of the individual token. Usually this name is the same as the character name link to the token, but it can also be changed based on need. 
December 29 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
What's the name that it should be using, and what is the name that is being used?
December 29 (8 years ago)

Edited December 29 (8 years ago)
The names it should be using is "Iona (Bran)". The name is displaying in chat is "(Bran)". There is another token on the Table named "Bran." But "Bran" appears nowhere in "Iona (Bran)"'s character sheet or token properties. But when I target the token with another token's attack, "Iona (Bran)" displays properly. Weird.
December 29 (8 years ago)

Edited December 29 (8 years ago)
Lithl
Pro
Sheet Author
API Scripter
Try:
!emas "@{selected|token_name}" attacks @{target|token_name} with his sword!
It looks like the emas script was written before it was possible to quote names (to deal with names containing spaces). I'm not certain that it actually makes a difference for the /emas command specifically (I think the appearance is the same whether you have "Iona" emoting "(Bran) does a thing", versus "Iona (Bran)" emoting "does a thing") but it's a simple thing to try.
Thanks, Brian. Alas, this doesn't work. It leaves "Iona (Bran)" out of the chat entry altogether, rendering "attacks [target name] with his sword!"
December 29 (8 years ago)

Edited December 29 (8 years ago)
@Kyle G I should have responded earlier that I appreciate the clarification on exactly where the name's being pulled from. I suspected it was from there, but for some reason, the script is not behaving as expected. As I say, the selected token name does render properly when it is targeted by another token, but not when it is doing the targeting.

Dang, this is so close to being what I need...
One other thing I noticed when using the !emas script: the emote (orange bit) seems to always appear after (below) the dice roll in the chat window, instead of before (above) it, as with /emas. I don't know if that's by design, but it can get a bit confusing if the emote doesn't appear consistently — especially if you're sometimes using both /emas and !emas in the same game. A use case for this is someone who hasn't been able to convert their entire library of NPCs to !emas.
December 29 (8 years ago)

Brian said:

Try:
!emas "@{selected|token_name}" attacks @{target|token_name} with his sword!
It looks like the emas script was written before it was possible to quote names (to deal with names containing spaces). I'm not certain that it actually makes a difference for the /emas command specifically (I think the appearance is the same whether you have "Iona" emoting "(Bran) does a thing", versus "Iona (Bran)" emoting "does a thing") but it's a simple thing to try.

Going along with this, I have had problems putting quotes around the name. What I would do is change the token name from 'Iona (Bran)" to just "Iona" and see if that fixes the issues with the spaces.
December 29 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator

Malcolm W. said:

One other thing I noticed when using the !emas script: the emote (orange bit) seems to always appear after (below) the dice roll in the chat window, instead of before (above) it, as with /emas. I don't know if that's by design, but it can get a bit confusing if the emote doesn't appear consistently — especially if you're sometimes using both /emas and !emas in the same game. A use case for this is someone who hasn't been able to convert their entire library of NPCs to !emas.

I'm assuming you mean via a macro command like this:
!emas The Test NPC attacks PC 1 with their sword of unholy wrath!
/w gm Attack:[[1d20+4]]
/w gm Damage:[[1d8+8]]

The em formatted text appears after the rolls in this case because everything is sent to the dice engine at the same time. From here, API commands are sent to the API for scripts to do their thing while other messages are sent straight to chat.

Because standard chat messages don't have any other hoops to jump through, they are displayed immediately while the results of API commands are displayed once their respective scripts are done processing them.
December 29 (8 years ago)

Edited December 29 (8 years ago)
@Kyle G Thanks again, but I've tried that. When I do that it doesn't display any name in the emote piece whatsoever — it will just say "attacks [target token name] with his sword!"
@Scott C. Ah—thanks for the explanation. That's too bad. Rats.
December 29 (8 years ago)
Andrew C
Marketplace Creator
I find those things can work well depending on the Roll Templates.  Diana Ps, D&D 3.5E Templates can have stuff like that easily loaded in.
Thanks, Andrew. Alas, not playing D&D so I have to roll my own. I had everything pretty well ironed out except that my players couldn't control any of the NPCs — they'd get an error in the chat window (Unrecognized command, blah, blah, blah). So this script would seem to solve that problem, except that it doesn't display the attacking character's name correctly. Fie!
December 31 (8 years ago)
The Aaron
Pro
API Scripter
I can probably fix that for you, though I'm a bit swamped right now. 
That would be awesome, Aaron! I'll try to remember to keep this thread alive with a little bump every now and then.
December 31 (8 years ago)
The Aaron
Pro
API Scripter
In the meantime, Color Emote might do what you want with a bit more flair: https://app.roll20.net/forum/permalink/2972233/
(reviewing it, there seem to be some outstanding edits I need to do as well.  I should really collect these somewhere....) 
Dude, I am always up for more flair! Thanks, I'll check it out! Happy New Year!
January 02 (8 years ago)
The Aaron
Pro
API Scripter
You too!  :)