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

[Script] ColorEmote -- Release v0.1.2 -- Long form Colored Emotes based on Character, Token, or Player!

1455592958

Edited 1455714555
The Aaron
Pro
API Scripter
ColorEmote v0.1.2 Update v0.1.2 &nbsp;-- Fixed a crash bug introduced with adding Short Forms (Thanks Coal Powered Puppet !) Update v0.1.1 -- Added Configuration options for Parse order and Short Form. ColorEmote provides a long form emote block with a colored background and header based on the Character , Token , or Player speaking. The header contains a representative image for the speaker (Character Avatar, Token Image, or Player Image) as well as the name of the speaker. The speaker is the first one of the following to be found An explicit Token or Character ID specified with the bracketed command syntax: !cem[@{target|token_id}] Does the things! The selected token's character. The selected token. The character the player is speaking as. The player. Background color is determined based on what is speaking. The foreground color will be either black or white depending on the brightness of the background color. The background color is chosen using the following methods: Characters will have the color stored in an attribute named color or the player color. The color attribute must be specified in standard html form with the # sign. ex: #ff3322 or #f32 Tokens will have their aura2 color. Players will have their player color. If it is currently the speaker's turn, a black pawn (♟)on a white circle will be displayed on the right side. (Does not apply to Players speaking.) Multi-line emote messages may be specified by surrounding them in {{ and }}. You can insert new lines by pressing shift-enter. Example: !cem {{ Does the things! But it fails in the usual way... }} Commands !cem &nbsp;-- Outputs a long form emote. &nbsp;The emote message is anything that follows !cem. &nbsp; You can optionally specify an explicit character or token id by appending it onto the !cem command within square brackets (see above). You can pull up the in-game help by appending --help to the command: &nbsp; !cem --help !wcem -- Identical to !cem, except that the output is whispered to the gm and player. Configuration Settings: Short Form &nbsp;-- When enabled, !cem will produce a more condensed format, effectively just in the header part. [Default: Off] Parse Order &nbsp;-- This determines whether character or token images &nbsp;and colors are used first. &nbsp;[Default: character first] Image Scale -- This determines the relative size of the representative image in the header. &nbsp;Sizes: small, medium, large, huge, gargantuan, and colossal. &nbsp;[Default: medium]. Vignette Mode -- This sets an optional constraint around the representative image. &nbsp;Options are: none, thin-square, thick-square, thin-round, thick-round. [Default: none]. Previous Discussion:&nbsp; <a href="https://app.roll20.net/forum/permalink/2953619/" rel="nofollow">https://app.roll20.net/forum/permalink/2953619/</a> Git:&nbsp; <a href="https://github.com/shdwjk/Roll20API/blob/master/Co" rel="nofollow">https://github.com/shdwjk/Roll20API/blob/master/Co</a>... Support my work on If you use my scripts, want to contribute, and have the spare bucks to do so , go right ahead. However, please don't feel like you must contribute just to use them! I'd much rather have happy Roll20 users armed with my scripts than people not using them out of some sense of shame. Use them and be happy, completely guilt-free! Disclaimer: This Patreon campaign is not affiliated with Roll20; as such, contributions are voluntary and Roll20 cannot provide support or refunds for contributions.
1455616827
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
A pawn? I want promoted!
1455619315
Ziechael
Forum Champion
Sheet Author
API Scripter
We are all but Pawns in this life which is but a script The Aaron wrote 'in the beginning' :( Nice script though, chat is gonna be a riot of colour now!!
1455624785

Edited 1455628937
The Aaron
Pro
API Scripter
Stephen S. said: A pawn? I want promoted! Absolutely! &nbsp;All you have to do is make it t the other side of this map...
Is there a commnad to pull up the instructions in game?
1455628779
The Aaron
Pro
API Scripter
!cem --help I'll add that to the message above, thanks for the reminder!
1455630726

Edited 1455633758
Alicia
Sheet Author
Actually pretty cool. Run a text game and all the emotes tend to start running together. Edit: I actually ended up modifying it a little. We always have images for the characters so I moved the message up to where the name is and adjusted the header text to accommodate the text being there. Works well for my purpose: I can post the changes if anyone want's it.
1455631399
The Aaron
Pro
API Scripter
Not anymore! &nbsp;=D &nbsp;I bet that's what Chris had in mind when he asked for it. &nbsp;I'm thinking about using it for NPC interactions in my own game...
The Aaron said: !cem --help I'll add that to the message above, thanks for the reminder! I am using that, its nothing is happening. &nbsp;The script works great otherwise. &nbsp;Not sure what I did to it. No other scripts currently installed .
1455640877
The Aaron
Pro
API Scripter
@Alicia G -- Looks cool, I'll roll that in as a configuration option, great idea! @Coal Powered Puppet -- I'll have to debug that when I get home from work. &nbsp;Did you type it directly into the chat, or copy/paste it from the forum? &nbsp;Sometimes invisible characters sneak in from copy/paste here.
Coy & paste, and direct typing fails to work. &nbsp;Also tried in an macro using the code below. &nbsp; !cem ?{Message} Don't get me wrong; the script works great, and I love it. &nbsp;I just can't get the help screen to appear. I do keep getting this warning when looking typing in --help:&nbsp; {"who":"error","type":"error","content":"Unable to find a player or character with name: &nbsp;&lt;div style="}
1455643313
Alicia
Sheet Author
The Aaron said: @Alicia G -- Looks cool, I'll roll that in as a configuration option, great idea! LOL, I was actually rather hoping you'd say that. Manually updated scripts (and remembering to do so) is a bit of a pain.&nbsp; Hopefully paired with a macro (#em anyone?) I can get my players to use it too!
1455647969
The Aaron
Pro
API Scripter
@Coal Powered Puppet -- That is very strange. &nbsp;What is your display name set to? &nbsp;That error only happens when the name passed to /w is invalid: /w "taco tuesday" This will fail if you don't have a character with that name... To get who to speak to, the help function takes your player id, gets your player object and then gets the name from it. &nbsp;If your name has a " in it, that might cause the issue. &nbsp;Changing my name to "The" Aaron caused the same issue when I tried to --help. &nbsp;I'm not sure why you'd have that &lt;div style= bit in there. &nbsp;Can you paste lines 298-301 of your copy of the script here? @Alicia G -- I agree on the simplicity of having it in the main branch. =D &nbsp;I've made some modifications to other peoples' scripts for some users, to the point where keeping track of which copy is which is a bit of a nightmare. &nbsp;What other things about the script should be configurable? &nbsp;I was considering separating out the Vignette settings by source of graphic, for example If I show a user image, I might want to put it in a circle like on the forums, but tokens shouldn't be changed and character portraits should have the square border but filling the square and clipping. &nbsp; (Also need to add a Queen chess piece so Stephen can get promoted!). Do you need any extra support for macros to work the way you want?
1455649085
Alicia
Sheet Author
I'll have to think on it some. I may not have any suggestions till we play and we use it. Compacting the layout was really my only desired modification.
1455649311
The Aaron
Pro
API Scripter
Sweet! &nbsp;I'll get that out soon! &nbsp;=D
The Aaron said: @Coal Powered Puppet -- That is very strange. &nbsp;What is your display name set to? &nbsp;That error only happens when the name passed to /w is invalid It was set to nothing. &nbsp;When I changed the display to something , the "--help" worked just fine. &nbsp;So, everything works. &nbsp;However...I keep getting this warning in the API Output Console: "Error: No attribute or sheet field found for character_id -KABpr4mFoIL7ftCYl2V named color"
1455653404
The Aaron
Pro
API Scripter
Great! &nbsp;That error is something you can ignore. &nbsp;it is a side effect of calling getAttrByName() but isn't actually an error. I'll see what I can come up with for whispering to a player without a name, but I don't know if that will be possible. &nbsp;I suppose I could fall back to /w gm if that player is a gm.
The Aaron said: Great! &nbsp;That error is something you can ignore. &nbsp;it is a side effect of calling getAttrByName() but isn't actually an error. So...no chance of developing super powers, huh? &nbsp;Damn.
1455657448
The Aaron
Pro
API Scripter
Hahahahah.. not so far (but then, if I had superpowers I'd hardly tell people and ruin my secret identity as a mild mannered arcane scriptomancer.... =D)
The Aaron said: ...and ruin my secret identity as a mild mannered arcane scriptomancer... Sadly, when I first saw this, I read "my secret identity as a well manicured arcane scriptomancer"
1455683109

Edited 1455683117
The Aaron
Pro
API Scripter
Oh, that's DEFINITELY not the case. &nbsp;=D &nbsp;I've got programmer's fingernails; once they start clicking on the keys I efficiently and quickly pair them down... =D
Aaron, the Color Emote script works great. I can't wait to try it out in a game. I have a question about the order in which the script processes the speaker. Here's the order: The speaker is the first one of the following to be found An explicit Token or Character ID specified with the bracketed command syntax: !cem[@{target|token_id}] Does the things! The selected token's character. The selected token. The character the player is speaking as. The player. Could you swap the order of items 2 and 3, so that the script processes all the token-related possibilities first? I think we'll get the best results if we prioritize the token image whenever possible, since they tend to be square and arranged for viewing at smaller sizes, which the chat window always will be. &nbsp;So we get:&nbsp; 1. An explicit Token or Character ID. 2. The selected token. 3. The selected token's character 4. The character the player is speaking as. 5. The player. With that order, the script works naturally through each of the token options first, then through to the character options and to the player options last.
1455685482
The Aaron
Pro
API Scripter
I can certainly make a change like that. &nbsp;Since the token will ALWAYS have an image though, that means the only way to get a character image is to either be speaking as that character or explicitly specify it. &nbsp;I don't know if I mentioned it, but if a character doesn't have an avatar, it will use the character's default token's image.
1455689700
The Aaron
Pro
API Scripter
Update v0.1.1 -- Added Configuration options for Parse order and Short Form. Enjoy!
When I have Short Form off, I get this warning and the API breaks. &nbsp;Any chance this will give me super powers? /home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v ^ ReferenceError: ccss is not defined at Object.eval (
1455710953
The Aaron
Pro
API Scripter
You appear already to HAVE a super power. :) &nbsp;I'm starting to suspect you might be Vince's well manicured alter ego... &nbsp;=D. I'll get a fix for that pushed out in the next hour.&nbsp;
1455714583
The Aaron
Pro
API Scripter
Update v0.1.2 -- Fixed a crash bug introduced with adding Short Forms (Thanks Coal Powered Puppet !) There you go! &nbsp;(Now only use your powers for good!)
1455725068
Alicia
Sheet Author
Thanks for the update! Decided to play with the&nbsp;Vignette Mode and I probably won't be using it. I could see it be useful for images that you've cropped ahead of time to actually fit, but the cropping of the images didn't really work for me.
1455725720
The Aaron
Pro
API Scripter
Yeah, I need to play with it a bit more. &nbsp;In order to have the tokens/images, etc fit in the right sized space I have a box around them which has the vignette. It works well for transparent tokens and player images, but not for avatars which aren't square. &nbsp;At some point I'll refactor the output code (adding a header only option was slightly messy with the way I did the styles originally), and then possibly split the vignette option up into 3 settings, one for each graphic source. &nbsp;I might also see if putting the vignette on the image instead of the container leads to nice results.
1456107793

Edited 1456108141
Alicia
Sheet Author
Ok.. So request time. We got to use it for our game and a few of my players really got into using it. However, it sort of became annoying to have to type their name when they wanted to do an emote, but they liked that the could use like a chat box. So we'd like to see a separate command where it would preface the name like with /me. Also, a few of them had an image that was about at the max size and didn't like how close the text was around the image. It would be nice if there was some sort of dynamic margin rather than a set image size for the avatar image.
1456108744
The Aaron
Pro
API Scripter
Awesome sauce! &nbsp;Can do! How about I add a !cme that prefaced with the name of the Player, Token, or Character. I'll fix the CSS as well.&nbsp;
Alicia's got a point about adding the Character/Token name into this style setting, although I don't think I am having the problem where the text is set right against the image. I think it might be worth considering a merge of the two current settings (Short and Long), to keep the options from getting out of hand. The "Short" setting is cleaner than my original Heading layout, and if it is rebuilt a little we can accomplish everything with one main configuration and a couple simple toggle options, rather than two complete branches. A minor revision of the markup and CSS would allow you to float the image left, and everything else to the right. Start the text side with the optional "Token/ Character/Player Name" row, along with the Turn Tracker icon. Then the emote content proper can be set below it, with a little padding. (Examples shown, with and without Token Name being displayed). For me, that approach would be preferable to getting outrageous with the number of settings and configurations, all with separate style requirements.
1456111880
The Aaron
Pro
API Scripter
That all sounds very reasonable!
Curious situation. I set up a macro today using the !cem API. I like to run little emotes before (say) casting a spell.&nbsp;This was the macro I used: !cem Drawing forth a small pistol-shaped object, with a hose attached to her backpack, The Ecologist turns a dial and a gout of steam explodes forth. %{selected|repeating_spell-1_$3_spell} The idea is to run one of our cool API emotes, then display the spell. However, the spell resolved first, displaying out of order. I guess the API has a lot of business to do, but Aaron, what do you think? Is there a way to make sure the emote fires first?&nbsp;
1456198103
The Aaron
Pro
API Scripter
That's a problem I've battled in the past. Unfortunately, there isn't a good solution. :(. API messages will be in the correct order with other API messages, but other chat commands will always happen first. :(
Huh. I did not know that. This is the first time I've attempted to run an API prior to a regular command. It's too bad we can't add a delay in the sequence. I guess you learn something every day.
1456238956
The Aaron
Pro
API Scripter
If your macros don't require any user interaction, we might be able write something to execute them from the api side. &nbsp;Alternatively, you could replace them with something like: !cem Drawing forth a small pistol-shaped object, with a hose attached to her backpack, The Ecologist turns a dial and a gout of steam explodes forth. /w "@{charactername}" [Cast](~%{selected|repeating_spell-1_$3_spell}) The basic idea being you whisper a button to execute the macro to the character and they click it to do the macro. A little obnoxious, but workable. &nbsp;(I'm just pulling that syntax out of my memory, you might have to play with it or get Silvyre "King of Macros" to adjust it...)
1456257986

Edited 1456258031
Silvyre
Forum Champion
[Cast](~repeating_spell-1_$3_spell)
Now I am getting a eoor using this script. &nbsp;its says /home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v ^ ReferenceError: ccss is not defined at Object.eval ( Any ideas? &nbsp;It was working before, so I think I broke it. &nbsp;Or its my day for theses things.
1457397020
The Aaron
Pro
API Scripter
There goes that super power again... you are on the latest version, right?
Uh....maybe?
1457399117
The Aaron
Pro
API Scripter
<a href="https://app.roll20.net/forum/permalink/2977361/" rel="nofollow">https://app.roll20.net/forum/permalink/2977361/</a> had the same error, fixed by v0.1.2 (so far as I know...)...
Updated to the neweset: everything is fine. &nbsp;
1457409871
The Aaron
Pro
API Scripter
Great!
So...sam power as before. &nbsp;No upgrades. &nbsp;Stand by until next issue!
1457416259
The Aaron
Pro
API Scripter
I bet it will manifest tomorrow... =D
Chris said: Alicia's got a point about adding the Character/Token name into this style setting, although I don't think I am having the problem where the text is set right against the image. I think it might be worth considering a merge of the two current settings (Short and Long), to keep the options from getting out of hand. The "Short" setting is cleaner than my original Heading layout, and if it is rebuilt a little we can accomplish everything with one main configuration and a couple simple toggle options, rather than two complete branches. A minor revision of the markup and CSS would allow you to float the image left, and everything else to the right. Start the text side with the optional "Token/ Character/Player Name" row, along with the Turn Tracker icon. Then the emote content proper can be set below it, with a little padding. (Examples shown, with and without Token Name being displayed). For me, that approach would be preferable to getting outrageous with the number of settings and configurations, all with separate style requirements. Dont suppose I could get a copy of this modification :&lt;
1457911160
Alicia
Sheet Author
Saevar L. "Liquid-Sonic" said: Chris said: Alicia's got a point about adding the Character/Token name into this style setting, although I don't think I am having the problem where the text is set right against the image. I think it might be worth considering a merge of the two current settings (Short and Long), to keep the options from getting out of hand. The "Short" setting is cleaner than my original Heading layout, and if it is rebuilt a little we can accomplish everything with one main configuration and a couple simple toggle options, rather than two complete branches. A minor revision of the markup and CSS would allow you to float the image left, and everything else to the right. Start the text side with the optional "Token/ Character/Player Name" row, along with the Turn Tracker icon. Then the emote content proper can be set below it, with a little padding. (Examples shown, with and without Token Name being displayed). For me, that approach would be preferable to getting outrageous with the number of settings and configurations, all with separate style requirements. Dont suppose I could get a copy of this modification :&lt; Eagerly awaiting the next batch of updates.. though I bet the Aaron is busy updating all his major scripts for compatibility with the Script Library update.&nbsp;
1457926069
The Aaron
Pro
API Scripter
You're not wrong! &nbsp; 56 released scripts and 30+ in development and more ideas all the time. &nbsp;(I picked a bad time to start GMing a new game but it's going on hiatus until after Easter...) &nbsp;I've rewritten my deploy system, updated 4 scripts to use the new User Options for configuration and now I'm writing an abstraction layer to wrap my configuration system and Roll20's configuration system. &nbsp;After completing that, I'll be updating all of my scripts, then back to development on new things... woot.
Abstraction Layer &nbsp;would be a wonderful campaign title. Give it a nice, tilty font and you'd be golden. You're the best, Aaron.
1457927790
The Aaron
Pro
API Scripter
Hahahaha, it does have that "the 39 steps" sort of feeling to it.. =D