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 .
×

Emote-as "!emas" script has buggy behavior between text chat and initiative tracker, is there a workaroud?

Hello! I like the "emote as" functionality provided by the GM /emas command. I've added the <a href="https://wiki.roll20.net/Script:emas" rel="nofollow">https://wiki.roll20.net/Script:emas</a> &nbsp;script to give this functionality to players in my game along with general macros to roll for initiative/hit/damage, with the idea that the character name will always appear with that dice roll in the chat.&nbsp; This simple example initiative macro is 'broken': !emas @{selected|character_name} rolls initiative with @{selected|weapon_name} [[d10+@{selected|weapon_speed}[Speed]&amp;{tracker}]] The output to chat seems correct, something like: &gt; Gnoll rolls initiative with Teeth &amp; Claws [6] But the initiative tracker will show the Gnoll as having rolled in with a different value, because somehow it's separately rolling the base d10, even if it's correctly adding the Gnoll's weapon speed. So the correct initiative band of values will be expressed in the roll to the initiative tracker, but it's almost always a different initiative value than the number displayed in the chat. Which of course, makes the flavor of always rolling with the character name now clash with the functionality of the game chat displaying conflicting values than the initiative tracker, even if the names of the tokens and the weapons they're rolling in with are correct. This is not an issue with the core /emas functionality available to GMs, but even if a GM uses the !emas script it will display this buggy behavior.&nbsp; My game has "token action" macros which are shared between everyone in the game, and these are the macros for initiative/to-hit/damage which I'd like to display character names at all times for all players and GM using the same token actions. Is there any way to work around this? I am hoping there's something clever which can be done with having the tracker read directly from the chat value even after the [[]] inline roll is complete with or without the tracker, or something to that effect. I'd like the tracker to reflect what's displayed in the chat, but I'm not adept with roll20 to know if there's a hacky way to get this working. I'm assuming the original script might be able to be updated, but I'm also assuming that's unlikely to occur or there are other barriers to prevent that from being useful (something like "all macro users then must have api access and be paid members" or something would be a barrier there). Any help is appreciated!&nbsp; Thanks for your time
1770576664
Gauss
Forum Champion
Hi Condor,&nbsp; Does this work?&nbsp; /em @{selected|character_name} rolls initiative with @{selected|weapon_name} [[d10+@{selected|weapon_speed}[Speed]&amp;{tracker}]] I want to make sure the base setup is working to differentiate if the problem is with the script or with the rest of the command.&nbsp; If the problem is with the script I suggest posting in the Mods (API Scripts) subforum.
1770621699

Edited 1770622596
Yes lol I guess I have to make it even more clear, the issue is *only with the !emas script*, no there are no other issues with literally anything else. It's an extremely simple failure case and I guess I should strip even further out of it for additional clarity.&nbsp; Here is the failure case even further simplified: !emas FOO rolls initiative [[d10&amp;{tracker}]] This will result in a chat message with some d10 result showing, and a different d10 result showing in the initiative tracker. Thanks for the suggestion, I'll post this in that forum if there is no further traction here.&nbsp; Really what I might be looking for is some conditional behavior within the macro itself. Something like - if the user of this macro is the GM, use /emas, - else use &lt;some completely different logic for the roll entirely, where I don't have the player even attempt to "emote as" anybody, and they'll roll as themselves with /em. Which might be achievable if there's a way to structure a macro in a clever way where if the macro breaks for some reason it will continue to the next line and try that next, so a macro could look something like: /emas FOO rolls initiative [[d10&amp;{tracker}]] /em rolls initiative [[d10&amp;{tracker}]] With the idea that the macro's first line will fail for anyone non-GM using it, but a player will get the second line's functionality and get a normal /em to function with whatever their currently selected chat name is. I've actually just tested, and this doesn't quite function. But even if it did function, that entire idea would be less interesting than just getting !emas to work properly, but again I don't have high hopes for that. I guess I'll hear about that core issue when I post in the mods/api scripts subforum! Again any help is accepted, thanks for your time&nbsp;
1770636007

Edited 1770636208
Gauss
Forum Champion
I have a solution for you:&nbsp; !emas test [[[[1d10]]&amp;{tracker}]] What I suspect is happening is [[1d10&amp;{tracker}]] is being sent to the intiative at the same time the line is being sent to the API.&nbsp; Then the API performs its thing, sends it to chat and viola, you get two rolls.&nbsp; If there is no roll for the tracker, then it works fine. Wrapping the roll in an extra set of inline brackets solves it.&nbsp; With that said, I'll ping The Aaron, see what he has to say.&nbsp;