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

ColorEmote Questions

Just set myself up with ColorEmote and am excited about the possibilities for my game, but I'm running into two questions that I'd love to see if I can work around.  Here's my current output from running a shooting macro: First, I'd love to have the !cem emote land before the roll template.  It's listed first in the code, but I'm assuming Roll20 parses the macro first before running any scripts, which is why !cem runs later? Second, I can't for the life of me figure out where that rogue colon is coming from between the "Roll Damage" button and the emote.  It's inconsistent in that it doesn't appear for every macro called (e.g. it isn't visible with the Reload or Deploy Bipod or Suppressive Fire macros, but it *is* on all the attack / shooting macros.   In case it's helpful, here's the macro that gets me the above result: !token-mod --ids @{selected|token_id} --set bar1_value|-1 !cem[@{selected|character_id}] @{selected|token_name} squeezes off a single M4 round at @{target|token_name}! !roll20AM --audio,nomenu,play|SFX_XCOM_M4_Single !delay .4 --!cfx MuzzleFlash @{selected|token_id} @{target|token_id} &{template:default} {{name=M4 Single Shot}} {{**Target**= @{target|token_name}}} {{**Roll**= [[{1d@{selected|shooting}, 1d@{selected|wilddie}}kh1 + @{selected|shooting_mod} [Shooting mod] + (-4) [Base TN] + (@{selected|wounds}-@{selected|wounds|max}) [Wounds] + @{selected|encumbranceMod} [Encumbrance] + ((@{target|size})-(@{selected|size})) [Size Difference] + @{selected|aim} [Aiming] + @{selected|fatigue} [Fatigue] + @{target|vulnerable} [Vulnerable] + @{target|focus} [Focus Fire] + @{target|cover} [Heads Down] + @{selected|distracted} [Distracted] + @{selected|adrenaline} [Adrenaline] + ?{Multiple Actions?|No, 0|2 Actions, -2|3 Actions, -4|4 Actions, -6} [Multiple Actions] + ?{Optics?|None, 0|Laser Sight (short range only), 1|ACOG (stationary, med/long range), 1|Scope (stationary, med/long/extreme range), 2} [Optics] + ?{Range?|Short, 0|Medium, -2|Long, -4|Extreme, -8} [Range] + ?{Target has Cover?|No, 0|Light, -2|Medium, -4|Heavy, -6} [Cover] + ?{Misc. Modifers (e.g. called shot, dim lighting, etc)?|0} [Misc. Modifiers]]]}} {{``0-3``= ``Hit``}} {{``4-7``= ``Hit + 1 Raise``}} {{``8-11``= ``Hit + 2 Raises...``}} %{Status|RemAim} [Roll Damage](~Weapons|M4-single-damage) Thanks in advance!
1631077365
The Aaron
Roll20 Production Team
API Scripter
The picture didn't come through, so I can't speak to the colon. For the first, the issue is that API commands are executed on the API server. Templates are expanded by the client. The practical upshot being that the template is displayed while the API command is still  in transit.  You can get around that by having an API script expand the template for you. RecursiveTable should be able to do that, probably by just adding !rt in front of it. 
Thanks for the quick response!  Your solve seems to have addressed both issues (the output order as well as the colon)--... but it has introduced a new one. The roll currently displays as an inline roll result, so the players can mouse-over and see exactly what modifiers are affecting their shot: After prefacing the table with !rt, however, the inline roll result just displays as plain text: I'm not super clear on what RecursiveTable actually does, so maybe that's actually the intended functionality.  If so, is there a way to get around it?  Can I both have my cake and eat it too?
1631090565
Gold
Forum Champion
rogue colon : made me laugh I have seen the rogue colon from my macro results for ColorEmote too.
1631121437

Edited 1631121664
vÍnce
Pro
Sheet Author
Rogue Colon™ used to crop up in the old Power Cards script as well...&nbsp; Must be a ghost in the machine. HB/Sky apparently fixed it here: <a href="https://app.roll20.net/forum/permalink/1461067/" rel="nofollow">https://app.roll20.net/forum/permalink/1461067/</a> Updates December 30th, 2014 ~ 1:40 pm eastern:&nbsp;Minor bugfix for sendChat issues and the random colon fix from earlier... It should work now. Had two issues... command wasn't being turned into a string properly (my bad) and the if/else logic I changed to get rid of the random colon that appeared when using the custom emotes was slightly off. Should be good though.
I very nearly went with "loose colon" in my initial post but better judgment prevailed.
1631131401
vÍnce
Pro
Sheet Author
;-)
1631191743

Edited 1631191781
Given the issue that I'm seeing with Recursive Table (where it pulls the underlying information about the inline roll from the chat output so that it contains only the plaintext final result), is there a bit of simple "do nothing" code that would accept a roll template as input, do nothing to it, and just kick it right back out with the inline roll information intact?&nbsp; I'm not a scripter but tried the below on a whim, where "!dn" (do nothing) would theoretically be the command: on("chat:message", function(msg) { if (msg.type == "api" &amp;&amp; msg.content.indexOf("!dn") !== -1) { } }); Predictably, it didn't work.&nbsp; I'm sure there's got to be a reasonably simply way to do this for a scripter who knows what they're doing, but unfortunately, I'm not them, so any guidance would be appreciated!
1631195154
The Aaron
Roll20 Production Team
API Scripter
The only way to get the timing right is to have a script initiate the message. Adding a delay command followed by a roll template will just delay on the API server, not the game. Each line of a chat command or macro is processed individually, so the delaying api command would be processed and sent off to the API to deal with, the next line would be executed.&nbsp; I think Tim might have ways of making this work though, let's see if we can summon him...
1631197629
timmaugh
Pro
API Scripter
Welcome to MetaAir. I will be your pilot for this macro. =D First, a real quick info dump on why/how RecursiveTable does what it does, and how/why the solution I'm proposing does what it does. Aaron can correct me if I am wrong about RT... If you just want the solution, you can jump to the TL;DR at the bottom. RT exists specifically to take a table entry and detect if there is an inline roll within it. If the new roll also includes a table result, RT will continue to expand the result to detect more inline rolls. In other words, it is automatically recursive, but specifically looking at the value of the roll. That's why you don't end up with the roll tip at the end. On the other hand, ZeroFrame (a metascript) will run a loop where a new loop cycle can be triggered by another metascript doing work *OR* a new inline roll being detected. In other words, it allows for recursion, but you have to sometimes tell it to look at the value of the roll in order to detect the new inline roll construction. Because of that, the last/top/outermost inline roll is preserved in the line as it finishes the loop, allowing for the roll-tip to be applied. The trade-off of the whole thing being: you can get recursion and roll-tip if you are willing to extract the value along the way. In your case, I don't think you actually need the recursion, you just need the roll-tip to remain intact, so ZeroFrame can help. TL;DR Like I said, I don't think I see any need for actual recursion to solve what you're looking to do. You just need the template to be filtered through the API to get the timing correct. With ZeroFrame installed, you can take your template line and send it to a ZeroFrame loop which does nothing other than outputting the message at the end. Basically, wrap the entire line in: ! ... {&amp; simple} That will initiate the API but trigger ZeroFrame to output a standard message, including your roll template. Your roll-tip should stay intact: !&amp;{template:default} {{name=M4 Single Shot}} {{**Target**= @{target|token_name}}} {{**Roll**= [[{1d@{selected|shooting}, 1d@{selected|wilddie}}kh1 + @{selected|shooting_mod} [Shooting mod] + (-4) [Base TN] + (@{selected|wounds}-@{selected|wounds|max}) [Wounds] + @{selected|encumbranceMod} [Encumbrance] + ((@{target|size})-(@{selected|size})) [Size Difference] + @{selected|aim} [Aiming] + @{selected|fatigue} [Fatigue] + @{target|vulnerable} [Vulnerable] + @{target|focus} [Focus Fire] + @{target|cover} [Heads Down] + @{selected|distracted} [Distracted] + @{selected|adrenaline} [Adrenaline] + ?{Multiple Actions?|No, 0|2 Actions, -2|3 Actions, -4|4 Actions, -6} [Multiple Actions] + ?{Optics?|None, 0|Laser Sight (short range only), 1|ACOG (stationary&amp;#44; med/long range), 1|Scope (stationary&amp;#44; med/long/extreme range), 2} [Optics] + ?{Range?|Short, 0|Medium, -2|Long, -4|Extreme, -8} [Range] + ?{Target has Cover?|No, 0|Light, -2|Medium, -4|Heavy, -6} [Cover] + ?{Misc. Modifers (e.g. called shot, dim lighting, etc)?|0} [Misc. Modifiers]]]}} {{``0-3``= ``Hit``}} {{``4-7``= ``Hit + 1 Raise``}} {{``8-11``= ``Hit + 2 Raises...``}}{&amp;simple}
1631202445
The Aaron
Roll20 Production Team
API Scripter
Spot on, Tim!
This seems to be working!&nbsp; Thank you both! There are two more things that I'd like to achieve with these attack macros that I'd been playing with, and which worked before adding !cem and ZeroFrame but which are not working now.&nbsp; Neither are crucial to the operation of the game, but I'd love to get both working if I can. The first is the ability to use the image-URL-in-roll-template-name trick within the roll template that's being displayed by the ZeroFrame call.&nbsp; If I paste in the URL, however, it fails to display the roll template altogether.&nbsp; I'm guessing it has something to do with how ZeroFrame parses the roll template? The second is that I'd like to call an ability (RemAim) at the end, after the roll has been processed (i.e. after the shot has been taken) which will remove the Aim status, if present.&nbsp; This ability exists and works correctly elsewhere when called from earlier, pre-!cem versions of the attack macros, but I'm guessing the addition of either !cem (and/or ZeroFrame) is causing the selected token to get deselected before RemAim runs. Here's the macro in its current working form, with both !cem and ZeroFrame in place, but without the image URL or RemAim call: !roll20AM --audio,nomenu,play|SFX_XCOM_M4_Single !delay .4 --!cfx MuzzleFlash @{selected|token_id} @{target|token_id} !token-mod --ids @{selected|token_id} --set bar1_value|-1 !cem[@{selected|character_id}] @{selected|token_name} squeezes off a single M4 round at @{target|token_name}! !&amp;{template:default} {{name= M4 Single Shot}} {{**Target**= @{target|token_name}}} {{**Roll**= [[{1d@{selected|shooting}, 1d@{selected|wilddie}}kh1 + @{selected|shooting_mod} [Shooting mod] + (-4) [Base TN] + (@{selected|wounds}-@{selected|wounds|max}) [Wounds] + @{selected|encumbranceMod} [Encumbrance] + ((@{target|size})-(@{selected|size})) [Size Difference] + @{selected|aim} [Aiming] + @{selected|fatigue} [Fatigue] + @{target|vulnerable} [Vulnerable] + @{target|focus} [Focus Fire] + @{target|cover} [Heads Down] + @{selected|distracted} [Distracted] + @{selected|adrenaline} [Adrenaline] + ?{Multiple Actions?|No, 0|2 Actions, -2|3 Actions, -4|4 Actions, -6} [Multiple Actions] + ?{Optics?|None, 0|Laser Sight (short range only), 1|ACOG (stationary&amp;#44; med/long range), 1|Scope (stationary&amp;#44; med/long/extreme range), 2} [Optics] + ?{Range?|Short, 0|Medium, -2|Long, -4|Extreme, -8} [Range] + ?{Target has Cover?|No, 0|Light, -2|Medium, -4|Heavy, -6} [Cover] + ?{Misc. Modifers (e.g. called shot, dim lighting, etc)?|0} [Misc. Modifiers]]]}} {{``0-3``= ``Hit``}} {{``4-7``= ``Hit + 1 Raise``}} {{``8-11``= ``Hit + 2 Raises...``}} {{ =[Roll Damage](~Weapons|M4-single-damage)}}{&amp;simple} Here's the macro in a form that *doesn't* work, but which has the image URL in the roll template name field and includes the RemAim call at the end (it needs to run after the roll has been made so as not to remove the aim bonus from the shot).&nbsp; Both of those additions are bolded and underlined : !roll20AM --audio,nomenu,play|SFX_XCOM_M4_Single !delay .4 --!cfx MuzzleFlash @{selected|token_id} @{target|token_id} !token-mod --ids @{selected|token_id} --set bar1_value|-1 !cem[@{selected|character_id}] @{selected|token_name} squeezes off a single M4 round at @{target|token_name}! !&amp;{template:default} {{name=[M4](<a href="https://imgur.com/ufTVdJq.png" rel="nofollow">https://imgur.com/ufTVdJq.png</a>)}} {{**Attack**= Single Shot}} {{**Target**= @{target|token_name}}} {{**Roll**= [[{1d@{selected|shooting}, 1d@{selected|wilddie}}kh1 + @{selected|shooting_mod} [Shooting mod] + (-4) [Base TN] + (@{selected|wounds}-@{selected|wounds|max}) [Wounds] + @{selected|encumbranceMod} [Encumbrance] + ((@{target|size})-(@{selected|size})) [Size Difference] + @{selected|aim} [Aiming] + @{selected|fatigue} [Fatigue] + @{target|vulnerable} [Vulnerable] + @{target|focus} [Focus Fire] + @{target|cover} [Heads Down] + @{selected|distracted} [Distracted] + @{selected|adrenaline} [Adrenaline] + ?{Multiple Actions?|No, 0|2 Actions, -2|3 Actions, -4|4 Actions, -6} [Multiple Actions] + ?{Optics?|None, 0|Laser Sight (short range only), 1|ACOG (stationary&amp;#44; med/long range), 1|Scope (stationary&amp;#44; med/long/extreme range), 2} [Optics] + ?{Range?|Short, 0|Medium, -2|Long, -4|Extreme, -8} [Range] + ?{Target has Cover?|No, 0|Light, -2|Medium, -4|Heavy, -6} [Cover] + ?{Misc. Modifers (e.g. called shot, dim lighting, etc)?|0} [Misc. Modifiers]]]}} {{``0-3``= ``Hit``}} {{``4-7``= ``Hit + 1 Raise``}} {{``8-11``= ``Hit + 2 Raises...``}} {{ =[Roll Damage](~Weapons|M4-single-damage)}}{&amp;simple} %{Status|RemAim}
1631246988
timmaugh
Pro
API Scripter
The answer to the second part (with the token becoming deselected) is due to ZeroFrame, but it can (likely) be easily remedied by installing SelectManager (another meta-script that specifically handles that selected token issue). As for the image in the roll template... let me dig into that one (probably tomorrow) and see what I can find.
Thanks, Tim!&nbsp; I suspected SelectManager might be my next stop, but held off because I wasn't sure about the syntax.&nbsp; I see now, though, that there *is* no syntax for me to worry about, and installing it has sorted the RemAim issue with haste and style.&nbsp; Thank you! And no rush on the image in the roll template;&nbsp; I'd love to have it, but I'm a good long ways off from being able to run this game, so no worries. :)