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

Token renamer/describer API?

Could be possible to write a script that renamed selected tokens with a short description taken randomly from a list or rollable table? Ideally it could rename a token in the pattern Name (table1,table2,table3). Renaming, for instance, an "Orc" token to "Orc (male, old, shifty)" where the first table held genders, the second age descriptors and the third a general list of adjectives. I'm thinking that the description should follow the original token name to look better in the turn order and other places where the name is shortened. Additionally it could be fun to also be able to occasionally replace the original token name with a proper name for the moments when a random goblin suddenly steps up to be a major NPC - or the players ask what the bartender is named. I'm thinking that this could be a great alternative to numbering tokens and adding som flavour. 
1610478945
David M.
Pro
API Scripter
Token-mod should be able to do that with a variation of something like: !token-mod --set name|@{selected|token_name} ([[ 1t[Table1Name] ]], [[ 1t[Table2Name] ]], [[ 1t[Table3Name] ]])
1610479867
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Yup, I use David's method above, except it writes the features to the token GM notes so I can call them with Supernotes.
1610481552

Edited 1610481613
The Aaron
Roll20 Production Team
API Scripter
Generally speaking, it's best to quote text: !token-mod --set name|"@{selected|token_name} ([[ 1t[Table1Name] ]], [[ 1t[Table2Name] ]], [[ 1t[Table3Name] ]])" You might also decide you'd rather use Character Name, so you could run it a few times if you get something you don't feel is sensible: !token-mod --set name|"@{selected|character_name} ([[ 1t[Table1Name] ]], [[ 1t[Table2Name] ]], [[ 1t[Table3Name] ]])" If you wanted to go really crazy, you could use RecursiveTable and create a whole tree of possible formats and features: !rt !token-mod --set name|"@{selected|character_name} ([[ 1t[Goblin-Names] ]])" --ids @{selected|token_id} (If you do that, you'll need to explicitly pass the token's ID, so it can get passed through to the eventual call to TokenMod)
Thank you!
1610527540

Edited 1610527946
This works wonderfully, currently using The Aarons second macro with two tables. However, if I select a group of tokens they all get the same description. Is there a way to select a bunch of tokens and still roll individually? For quick naming of tokens I´m setting up a macro that pulls a table named the same as the token, and I'll add table for orc names, goblin names, bandit names etc... !token-mod --set name|"[[ 1t[@{selected|character_name}] ]]"
1610549749
The Aaron
Roll20 Production Team
API Scripter
Right now, there's not a way with TokenMod to do individual rolls.  The rolls happen on the client side, so the API would just see the command as something like: !token-mod --set name|"Goblin ( Grumpy , Scrawny )" (though the bold parts have slightly more information) At some point, I plan to add individual re-rolls, but that's gonna take quite a bit of work, and I've been busy with work and other things lately.
I'm certainly use the new feature when it apperas, but it's a small issue. If I could assign different descriptions to a group of tokens with one click I'd do this during set-up, now I'll just have a token action and push it when I need a description.