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] Faces

1649040683

Edited 1667338773
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
[Script] Faces This is a short script that is designed to provide a quick visual interface for swapping token images and names. I built it for a Changeling character I want to play, so that I easily could build up a library of disguises from tokens I encounter. The interface will work for both players and GMs. The script calls names and images from rollable tables or from any multisided token. Rollable tables must have  a name and image for each entry: To call up the chat interface, use !faces [tablename] . For the above example: !faces Portraits ...builds this in chat: This menu is visible only to the person issuing the command, so it shouldn't spam the interface. The interface is non-persistent as well, so it will not leave litter in the Chat Archive or persist from game to game. Clicking an image will assign that image to any selected token. Clicking the name will likewise change the token's name. Clicking [Add an image to this table] will prompt the user to target a token on the VTT, and ask for a name. The resulting name and image will form a new entry in the rollable table: [Display this table] is the same as issuing the !faces command for the table [Add another image to this table] repeats the process as above. I've tried to build this so it works equally well for dark and light mode, since the API has no way of adjusting currently. What this script does not do: Adjust token size. Change any token-character representation, linking, or attributes. It is not intended to be a Wildshape script. There are much better-suited scripts for that. Potential uses for this script: Disguise-master characters Changeling characters Alter Self  and  Seeming  spells (and similar) Providing the GM a way to alter the image choices for a group of enemies. Quickly differentiate between goblin archers, goblin infantry, dead goblins Give a visual interface for a player who has multiple expressions or variations for their character Characters who contract lycanthropy Monsters with different states: Ankheg on surface, surfacing or a Bugs Bunny-style burrowing mound Build a library of townsfolk, scholars, city guards or other commoner-types. Assigning map pin icons: Tavern vs temple vs shop, etc. Quickly changing the state of a trap image Changing a closed door image to an open door image. Laying out a bunch of map tiles and quickly switching between them to build a dungeon having tables for map furnishings: a chair table, a door, even a table table. Change downed enemies to a creative variety of grisly remains? A GM could present players with a menu of tokens for their PCs A rollable table of scenes and images to show characters using shift-Z. Just keep one token on table and switch at need. Probably more I haven't thought of. EDIT: New feature. !faces existing will use the same interface as described above, but the token faces will come from token if it is a rollable table token. EDIT: New feature - Filter results !faces <tablename> filter| This will only show results from a table if the table item name includes whatever comes after " filter|" example, if you have a table named "Warriors" that includes: elf archer human archer elf wizard and type  !faces Warrior filter|archer it will only return entries for elf archer human archer A good use for this might be a table of commoners that includes elves, humans and dwarves. When you are in a large cosmopolitan area, you might want to choose from the whole table. If you are in the dwarven mines of Shmoria, you might only want the dwarf entries. Code is updated  here .
1649045215
Oosh
Sheet Author
API Scripter
Jeez Keith, everything you make looks really slick. It makes me feel bad. Everything graphical I do looks like an old CGA monitor shit the bed, then threw up on itself :(
1649045422
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I was going to make a chocolate and peanut butter reference, but now I seem to have lost my appetite. :o
1649053969
GiGs
Pro
Sheet Author
API Scripter
What a great idea for a script, and great implementattion too.
Amazing script, the only possible thing I could think of for improvement would be a button to change token name but thats also easily done without the script.  
1649075064
David M.
Pro
API Scripter
I second Oosh's comments - exactly what I was thinking! This combined with Aaron's make-rtt script (which mass-uploads images to a rollable table & token) makes for a nifty set of multi-sided token management tools!
1649075452
The Aaron
Roll20 Production Team
API Scripter
I believe you can click the name to change just the name. DM Eddie said: Amazing script, the only possible thing I could think of for improvement would be a button to change token name but thats also easily done without the script.  
David M. said: I second Oosh's comments - exactly what I was thinking! This combined with Aaron's make-rtt script (which mass-uploads images to a rollable table & token) makes for a nifty set of multi-sided token management tools! Funny - I was in need of both of these scripts just the other day. I thought I remembered seeing a script to create a rollable table from a set of tokens, but I could not find it for the life of me. So thank you all for these wonderful scripts! Question: for the Make Rollable Table Token script, is it possible to take a current rollable token and gather all of its sides, and add any additional tokens that are selected? Currently it only takes the image that is displayed from a rollable token. In other words, if I already have a multi-sided token with 10 human commoner faces, and find another face to add, would it be possible to select the original multi-sided token on the page along with a token of the new image to be added, and create a token that has all 11 images on it?   (Sorry to hijack this thread, KeithCurtis, but I think it might be a valuable companion to your Faces script, and the other thread is already closed!)
1649088649

Edited 1649088924
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The Aaron said: I believe you can click the name to change just the name. DM Eddie said: Amazing script, the only possible thing I could think of for improvement would be a button to change token name but thats also easily done without the script.   Yup, click on the name. It's buried in the middle of the documentation. I felt making them separate functions would increase the flexibility. Bob might not change his name when he becomes a wereboar, and I feel it's messy to have two rollable table results with the same name.
1649127931
The Aaron
Roll20 Production Team
API Scripter
That script could be modified, or you could use TokenMod to add images to an existing token. Something like this, check the docs to be sure: !token-mod --set imgsrc|+@{target|token_id} --ids @{selected|token_id} Jarren said: David M. said: I second Oosh's comments - exactly what I was thinking! This combined with Aaron's make-rtt script (which mass-uploads images to a rollable table & token) makes for a nifty set of multi-sided token management tools! Funny - I was in need of both of these scripts just the other day. I thought I remembered seeing a script to create a rollable table from a set of tokens, but I could not find it for the life of me. So thank you all for these wonderful scripts! Question: for the Make Rollable Table Token script, is it possible to take a current rollable token and gather all of its sides, and add any additional tokens that are selected? Currently it only takes the image that is displayed from a rollable token. In other words, if I already have a multi-sided token with 10 human commoner faces, and find another face to add, would it be possible to select the original multi-sided token on the page along with a token of the new image to be added, and create a token that has all 11 images on it?   (Sorry to hijack this thread, KeithCurtis, but I think it might be a valuable companion to your Faces script, and the other thread is already closed!)
The Aaron said: That script could be modified, or you could use TokenMod to add images to an existing token. Something like this, check the docs to be sure: !token-mod --set imgsrc|+@{target|token_id} --ids @{selected|token_id} Jarren said: David M. said: I second Oosh's comments - exactly what I was thinking! This combined with Aaron's make-rtt script (which mass-uploads images to a rollable table & token) makes for a nifty set of multi-sided token management tools! Funny - I was in need of both of these scripts just the other day. I thought I remembered seeing a script to create a rollable table from a set of tokens, but I could not find it for the life of me. So thank you all for these wonderful scripts! Question: for the Make Rollable Table Token script, is it possible to take a current rollable token and gather all of its sides, and add any additional tokens that are selected? Currently it only takes the image that is displayed from a rollable token. In other words, if I already have a multi-sided token with 10 human commoner faces, and find another face to add, would it be possible to select the original multi-sided token on the page along with a token of the new image to be added, and create a token that has all 11 images on it?   (Sorry to hijack this thread, KeithCurtis, but I think it might be a valuable companion to your Faces script, and the other thread is already closed!) Wait, does imgsrc add a side to the token or just change the image, cause I have had a macro using that command forever not realizing that if thats how that works lol.  
1649157157
David M.
Pro
API Scripter
Adding the + sign before the token_id makes it append to the image list. Omitting the plus sign just changes the image.
David M. said: Adding the + sign before the token_id makes it append to the image list. Omitting the plus sign just changes the image. Wow this whole time I have been just altering the single sided commoner token with a massive image url table.  Thanks guys!
The Aaron said: That script could be modified, or you could use TokenMod to add images to an existing token. Something like this, check the docs to be sure: !token-mod --set imgsrc|+@{target|token_id} --ids @{selected|token_id} I have never realized TokenMod could add  an additional token face!  Thank you! And I also screwed up my question. I meant to ask about creating a rollable table from a multi-sided token: Question: for the Make Rollable Table Token script , is it possible to take a current rollable token and gather all of its sides, and add any additional tokens that are selected to create a rollable table ? Currently it only takes the image that is displayed from a rollable token. In other words, if I already have a multi-sided token with 10 human commoner faces, and find another face to add, would it be possible to select the original multi-sided token on the page along with a token of the new image to be added, and create a token   rollable table that has all 11 images on it?  
Jarren said: The Aaron said: That script could be modified, or you could use TokenMod to add images to an existing token. Something like this, check the docs to be sure: !token-mod --set imgsrc|+@{target|token_id} --ids @{selected|token_id} I have never realized TokenMod could add  an additional token face!  Thank you! And I also screwed up my question. I meant to ask about creating a rollable table from a multi-sided token: Question: for the Make Rollable Table Token script , is it possible to take a current rollable token and gather all of its sides, and add any additional tokens that are selected to create a rollable table ? Currently it only takes the image that is displayed from a rollable token. In other words, if I already have a multi-sided token with 10 human commoner faces, and find another face to add, would it be possible to select the original multi-sided token on the page along with a token of the new image to be added, and create a token   rollable table that has all 11 images on it?   Isn't that kinda sorta what Faces does though?  All you have to do is make the empty one and then Faces will add the current tokens image to that table right?
DM Eddie said: Isn't that kinda sorta what Faces does though?  All you have to do is make the empty one and then Faces will add the current tokens image to that table right? My situation is having a multi-sided token, but no longer having the associated rollable table.   I want to recreate the original rollable table from a multi-sided token.  The Faces script will only take the current face and add it to the table, not all of the faces from a multi-sided token. Or another possible application would be to quickly combine rollable tables.  Just create two multi-sided tokens from two different tables, then click on them and have all  of the sides of both tokens get combined into a single table. (I'm thinking something like DwarfMales and DwarfFemales can be combing into a single DwarfAll table.) As far as I can tell, the Faces script allows for easy addition of a single image to an already created table.  The Make Rollable Table script allows for easy creation of a table from individual token images on the VTT.  And TokenMod allows for adding an image side to a token.  But as far as I can tell there's no way to create a table from all the sides of multi-sided tokens. Unless I missed something on one of these scripts that allows for that kind of creation!
1649211939
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
It wouldn't be terribly difficult to write a script that does that. The reason I wrote token faces this way is that I wanted to see the faces all at once, with names.
1649829784

Edited 1664848154
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Script is updated. It will now parse a note out of the table item name. Just separate the note from the name with " --" (the space before the dashes is needed). For example, here is a table with three entries that have notes: The chat menu generated looks like this: You can use the little buttons in the lower right of each entry to send the note to either the token's tooltip or gmnotes. The little "x" next to each button will clear those fields respectively. Table entries with and without notes will mix and match: At this moment, "Add an image to this table" will not add a note. That's coming up. Finally, try not to get too clever with the notes. I'm sure control characters like an attribute lookup code will probably cause the universe to explode or something. EDIT: New feature - Pull token faces from selected token instead of table !faces existing will use the same interface as described above, but the token faces will come from token if it is a rollable table token. I chose "existing" as a code rather than something more obvious like "token", since I thought "existing" was less likely to be the name of an actual table. EDIT: New feature - Filter results !faces <tablename> filter| This will only show results from a table if the table item name includes whatever comes after " filter|" example, if you have a table named "Warriors" that includes: elf archer human archer elf wizard and type  !faces Warrior filter|archer it will only return entries for elf archer human archer A good use for this might be a table of commoners that includes elves, humans and dwarves. When you are in a large cosmopolitan area, you might want to choose from the whole table. If you are in the dwarven mines of Shmoria, you might only want the dwarf entries. Code has been updated in the top post.