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 .
×
Advertisement Create a free account

[Script Update] TokenMod -- An interface to adjusting properties of a token from a macro or the chat area.

1615386259
Kk
Pro
Hey all. Longtime forum browser. First time poster ;) I’ve been DMing for about 6 months. Learning my way around macros and APIs. Using many of them. 1000+one thank yous to all who have contributed. Such an enhancement to the platform. I have to say: I am amazed at how supportive the Roll20 community is (…and that’s not a setup/butter you up for my question. I mean it)! So, my dilemma: I’ve got a Bag of Tricks and I’m trying to make a Fuzzy Object morph into the appropriate creature with a button click. I can do it in a drop down menu, but I can’t figure out how to make it happen on a roll. I’m not a programer, but I can occasionally sort through and tweak other people's code to make things do my bidding.  I’ve got a Fuzzy Object character. The default token is a multi-sided token I created from my [BagOfTricks] roll table. It has this Token Action on it:   !token-mod {{   --set     ?{Choose a Trick|Weasel,currentside#1 represents#@{Weasel|character_id}       |Giant Rat,currentside#2 represents#@{Giant Rat|character_id}       |Badger,currentside#3 represents#@{Badger|character_id}       |Boar,currentside#4 represents#@{Boar|character_id}       |Panther,currentside#5 represents#@{Panther|character_id}       |Giant Badger,currentside#6 represents#@{Giant Badger|character_id} |Dire Wolf,currentside#7 represents#@{Dire Wolf|character_id} |Giant Elk,currentside#8 represents#@{Giant Elk|character_id}     }     bar1_link|hp       bar1_reset|0     bar2_link|npc_ac     bar3_link|npc_speed     name|”Bag Pet”     showname|yes }} This is tweaked script I found here (credit where it’s due, The Aaron):  Is there a way to do something akin to this: varRoll /roll 1d8   varName [[varRoll T[BagofTricks]]] --set varName currentside#varRoll represents#@{varName|character_id}           name|varName I’ve searched around but can’t find/don’t know where to look to find a potential solution. Macros can't store values, correct? Is there's any solution that could automate the roll and selection? If not, I just roll a 1d8 then manually choose, but, you know... looking for the most efficient solution. Any all help is greatly appreciated! Regardless, my hat is off to the myriad macro/API contributors. You’ve made the game much more enjoyable for me and my party!  
1615386691

Edited 1615387052
The Aaron
Forum Champion
API Scripter
hmm.  You can probably do that with RecursiveTable if you have a table with rows like: name#"Bag Pet: Weasel" currentside#1 represents#@{Weasel|character_id} I'm not entirely sure that will work, you might need to expand the character_id manually for each.
1615388242
Kk
Pro
Wow, swift response! Thank you for pointing me in that direction. I'll poke around and see what I can make/break. 
1615388308
The Aaron
Forum Champion
API Scripter
If that doesn't work, I bet Tim can make it happen with APILogic... =D
1615389764
Joe
Pro
Kk said: Wow, swift response! Thank you for pointing me in that direction. I'll poke around and see what I can make/break.  If you do manage to get it working, please share; I'd love to get my own bag of tricks and other random table items more automated, also!  :-)
1615390994
The Aaron said: Chris M. said: Can anyone give me some help debugging this simple script? Basically when our bard wants to use Bardic Inspiration, he will run this from the token action bar and it will put a statusmarker (I was hoping aura) on the target. !power {{       --name|Bardic Inspiration   --tokenid|@{selected|token_id}   --target_list|@{target|token_id}   --emote|@{selected|character_name} sings the words 'War Pig' to@{target|token_name}!   --Effect:| You can inspire others through stirring words or music. To do so, you use a Bonus Action on Your Turn to choose one creature other than yourself within 60 feet of you who can hear you. That creature gains one Bardic Inspiration die: **A d8.**^^^^ Once within the next 10 minutes, the creature can roll the die and add the number rolled to one ability check, Attack roll, or saving throw it makes. The creature can wait until after it rolls The d20 before deciding to use the Bardic Inspiration die, but must decide before the DM says whether the roll succeeds or fails. ^^^^Once the Bardic Inspiration die is rolled, it is lost. A creature can have only one Bardic Inspiration die at a time. ^^^^You can use this feature a number of times equal to your Charisma modifier //**(Bard’s is 4)**//. You regain any expended uses when you finish a Long Rest. --api_token-mod|_ids @{selected|token_id}_set statusmarkers|!aura }} Thanks (By the way I know there is a giant wall of text in this card but that is what my players like.) Everything seems to work except the last line where the --api call is. Generally, I'd suggest about this in the PowerCards thread.  That said, I'm guessing you need a space between @{selected|token_id} and _set: --api_token-mod|_ids @{selected|token_id} _set statusmarkers|!aura Thank you so much!!
1615392035
The Aaron said: Doug E. said: How did I miss that one? However, it doesn't answer my question (if someone could chime in, that would be appreciated), It does look like it will address my need, tho'. Especially with Roll20s bulk deck building feature. I'll have to give it a try. Thanks, Keith The easiest way (the way I do it) is to drag the image onto the map, then just collect it by token  id: !token-mod --set imgsrc|+@{target|token_id} Thanks. Filing away for future.
1615394284
Kk
Pro
Well, there’s several steps involved to set it up, but… it does work! Now that it’s all set up, it’s super quick to roll a pet. Only API it requires !token-mod (The Arron, I didn’t need !rt. Just putting the code into the roll table worked, but I did have to hard code the character IDs). STEP 1: Create a character sheet called ‘Fuzzy Object’.   STEP 2:   Create a roll table ‘BagOfTricks’ with 9 sides. Upload images to the appropriate tokens (see below) for 1-8. Upload a default token (like… a Tribble or something;) for side 9. Roll the token. Set the token to side to 9 and assign it as the default token for your ’Fuzzy Object” character. STEP 3:   Set up the Roll Table ‘BagOfTricks-CODE’ as follows? name#"Bag Pet - Weasel" currentside#1 represents#-MVOulpB2SQSLZtCTlDd name#"Bag Pet - Giant Rat" currentside#2 represents#- LcBITvnSC4UVuFDdHVR name#"Bag Pet - Badger" currentside#3 represents# -MVOuvi4nGO3icR5fjS6 name#"Bag Pet - Boar" currentside#4 represents# -LafZNOHj5lmBnvCSoM7 name#"Bag Pet - Panther" currentside#5 represents# -MVOv1qlnzKDOKebIO-w name#"Bag Pet - Giant Boar" currentside#6 represents# -LafEF0apX-loKu9m_DK name#"Bag Pet - Dire Wolf" currentside#7 represents# -KdiNu4uiIWLlT_feowN name#"Bag Pet - Giant Elk" currentside#8 represents# -LafTILlEFc6XJAUyelo STEP 4: Create a Token Action ‘Bag-of-Tricks’: !token-mod {{   --set   [[1t[BagOfTricks-CODE]]]     bar1_link|hp       bar1_reset|0     bar2_link|npc_ac     bar3_link|npc_speed     showname|yes }} I’m excited to potentially contribute something new to the community, given all the benefits I have reaped from other peoples efforts! If anyone has any improvements/ways to simplify set up, please let me know. Enjoy.
1615395792
The Aaron
Forum Champion
API Scripter
Oh, I should have realized this earlier, but you can use the character's name for represents: Character ID You can use the @{CHARACTER NAME|character_id} syntax to specify a character_id directly or use the name of a character (quoted if it contains spaces) or just the shortest part of the name that is unique ('Sir Maximus Strongbow' could just be 'max'.). Not case sensitive: Max = max = MaX = MAX Available Character ID Properties: represents Here is setting the represents to the character Bob. !token-mod --set represents|@{Bob|character_id} Note that setting the represents will clear the links for the bars, so you will probably want to set those again.
1615395815
timmaugh
Pro
API Scripter
The Aaron said: If that doesn't work, I bet Tim can make it happen with APILogic... =D I might just take that as a challenge. =D
1615399364
Kk said: Well, there’s several steps involved to set it up, but… it does work! Now that it’s all set up, it’s super quick to roll a pet. Only API it requires !token-mod (The Arron, I didn’t need !rt. Just putting the code into the roll table worked, but I did have to hard code the character IDs). STEP 1: Create a character sheet called ‘Fuzzy Object’.   STEP 2:   Create a roll table ‘BagOfTricks’ with 9 sides. Upload images to the appropriate tokens (see below) for 1-8. Upload a default token (like… a Tribble or something;) for side 9. Roll the token. Set the token to side to 9 and assign it as the default token for your ’Fuzzy Object” character. STEP 3:   Set up the Roll Table ‘BagOfTricks-CODE’ as follows? name#"Bag Pet - Weasel" currentside#1 represents#-MVOulpB2SQSLZtCTlDd name#"Bag Pet - Giant Rat" currentside#2 represents#- LcBITvnSC4UVuFDdHVR name#"Bag Pet - Badger" currentside#3 represents# -MVOuvi4nGO3icR5fjS6 name#"Bag Pet - Boar" currentside#4 represents# -LafZNOHj5lmBnvCSoM7 name#"Bag Pet - Panther" currentside#5 represents# -MVOv1qlnzKDOKebIO-w name#"Bag Pet - Giant Boar" currentside#6 represents# -LafEF0apX-loKu9m_DK name#"Bag Pet - Dire Wolf" currentside#7 represents# -KdiNu4uiIWLlT_feowN name#"Bag Pet - Giant Elk" currentside#8 represents# -LafTILlEFc6XJAUyelo STEP 4: Create a Token Action ‘Bag-of-Tricks’: !token-mod {{   --set   [[1t[BagOfTricks-CODE]]]     bar1_link|hp       bar1_reset|0     bar2_link|npc_ac     bar3_link|npc_speed     showname|yes }} I’m excited to potentially contribute something new to the community, given all the benefits I have reaped from other peoples efforts! If anyone has any improvements/ways to simplify set up, please let me know. Enjoy. Woo cool. Will have to check this out. This type of procedure has a range of applications -- I was actually looking for something just like this to deal with the random effects of a Wild Magic Barbarian, so I could present them visually on the TT. That's Karma, baby. (note to self: a karma baby would be a fantastic monster) .
1615400457
Kk said: Well, there’s several steps involved to set it up, but… it does work! Now that it’s all set up, it’s super quick to roll a pet. Only API it requires !token-mod (The Arron, I didn’t need !rt. Just putting the code into the roll table worked, but I did have to hard code the character IDs). STEP 1: Create a character sheet called ‘Fuzzy Object’.   STEP 2:   Create a roll table ‘BagOfTricks’ with 9 sides. Upload images to the appropriate tokens (see below) for 1-8. Upload a default token (like… a Tribble or something;) for side 9. Roll the token. Set the token to side to 9 and assign it as the default token for your ’Fuzzy Object” character. STEP 3:   Set up the Roll Table ‘BagOfTricks-CODE’ as follows? name#"Bag Pet - Weasel" currentside#1 represents#-MVOulpB2SQSLZtCTlDd name#"Bag Pet - Giant Rat" currentside#2 represents#- LcBITvnSC4UVuFDdHVR name#"Bag Pet - Badger" currentside#3 represents# -MVOuvi4nGO3icR5fjS6 name#"Bag Pet - Boar" currentside#4 represents# -LafZNOHj5lmBnvCSoM7 name#"Bag Pet - Panther" currentside#5 represents# -MVOv1qlnzKDOKebIO-w name#"Bag Pet - Giant Boar" currentside#6 represents# -LafEF0apX-loKu9m_DK name#"Bag Pet - Dire Wolf" currentside#7 represents# -KdiNu4uiIWLlT_feowN name#"Bag Pet - Giant Elk" currentside#8 represents# -LafTILlEFc6XJAUyelo STEP 4: Create a Token Action ‘Bag-of-Tricks’: !token-mod {{   --set   [[1t[BagOfTricks-CODE]]]     bar1_link|hp       bar1_reset|0     bar2_link|npc_ac     bar3_link|npc_speed     showname|yes }} I’m excited to potentially contribute something new to the community, given all the benefits I have reaped from other peoples efforts! If anyone has any improvements/ways to simplify set up, please let me know. Enjoy. Wow. That's cool! Thank you for sharing.
1615455153

Edited 1615455439
Kk said: Well, there’s several steps involved to set it up, but… it does work! Now that it’s all set up, it’s super quick to roll a pet. Only API it requires !token-mod (The Arron, I didn’t need !rt. Just putting the code into the roll table worked, but I did have to hard code the character IDs). STEP 1: Create a character sheet called ‘Fuzzy Object’.   STEP 2:   Create a roll table ‘BagOfTricks’ with 9 sides. Upload images to the appropriate tokens (see below) for 1-8. Upload a default token (like… a Tribble or something;) for side 9. Roll the token. Set the token to side to 9 and assign it as the default token for your ’Fuzzy Object” character. STEP 3:   Set up the Roll Table ‘BagOfTricks-CODE’ as follows? name#"Bag Pet - Weasel" currentside#1 represents# -MVOulpB2SQSLZtCTlDd name#"Bag Pet - Giant Rat" currentside#2 represents# - LcBITvnSC4UVuFDdHVR name#"Bag Pet - Badger" currentside#3 represents# -MVOuvi4nGO3icR5fjS6 name#"Bag Pet - Boar" currentside#4 represents# -LafZNOHj5lmBnvCSoM7 name#"Bag Pet - Panther" currentside#5 represents# -MVOv1qlnzKDOKebIO-w name#"Bag Pet - Giant Boar" currentside#6 represents# -LafEF0apX-loKu9m_DK name#"Bag Pet - Dire Wolf" currentside#7 represents# -KdiNu4uiIWLlT_feowN name#"Bag Pet - Giant Elk" currentside#8 represents# -LafTILlEFc6XJAUyelo STEP 4: Create a Token Action ‘Bag-of-Tricks’: !token-mod {{   --set   [[1t[BagOfTricks-CODE]]]     bar1_link|hp       bar1_reset|0     bar2_link|npc_ac     bar3_link|npc_speed     showname|yes }} I’m excited to potentially contribute something new to the community, given all the benefits I have reaped from other peoples efforts! If anyone has any improvements/ways to simplify set up, please let me know. Enjoy. I imagine that the represents codes refer to character ID's of Bag Pet - Weasel, Bag Pet - Giant Rat, Bag Pet - Badger, etc. ... ***OR*** They represent the original monster sheets; Weasel, Giant Rat, Badger, etc. ... (Either way, the following is true) So another step is added, making sure those sheets are in your library and you've drawn the character ID's from each, as I'm pretty sure that they won't be universal across all games. Easiest way I go about this is to drop the character sheet token on the field, select it, and run /w gm @{selected|character_id} from the chat (I always use /w gm to avoid spamming the chat to my players, but that's optional). After collecting this in your list, delete all the tokens you dropped onto the field.
1615462985
Kk
Pro
Correct @Wolf Thunderspirit. I forgot Step 0, if you will. Get the monsters into your library. That's how I got the IDs w/ @{selected|character_id}. Thanks for noting that.
1615466798
The Aaron
Forum Champion
API Scripter
Kk said: Correct @Wolf Thunderspirit. I forgot Step 0, if you will. Get the monsters into your library. That's how I got the IDs w/ @{selected|character_id}. Thanks for noting that. Did you try it with just the character names? (Like here: &nbsp; <a href="https://app.roll20.net/forum/permalink/9886090/" rel="nofollow">https://app.roll20.net/forum/permalink/9886090/</a> )
1615467613
I added a "Bag of Tricks" to a dungeon my players are going into when I ran this. This is brilliant!
1615481963
Kk
Pro
The Aaron said: Kk said: Correct @Wolf Thunderspirit. I forgot Step 0, if you will. Get the monsters into your library. That's how I got the IDs w/ @{selected|character_id}. Thanks for noting that. Did you try it with just the character names? (Like here: &nbsp; <a href="https://app.roll20.net/forum/permalink/9886090/" rel="nofollow">https://app.roll20.net/forum/permalink/9886090/</a> ) I did. No joy (though it's entirely possible I didn't use the correct syntax). I tried adding these two as a test:&nbsp; name#"Bag Pet - Weasel" currentside#1 represents|@{Weasel|character_id} name#"Bag Pet - Giant Rat" currentside#2 represents|@{“Giant Rat”|character_id} Did I miss something?&nbsp; @al e. I'm so glad to hear! As I said in an earlier post, if you make any improvements or think of other uses for this approach (roll table + token-mod), let me know.&nbsp;
1615482078
The Aaron
Forum Champion
API Scripter
It would be like this: name#"Bag Pet - Weasel" currentside#1 represents|Weasel name#"Bag Pet - Giant Rat" currentside#2 represents|“Giant Rat”
1615483060
Kk
Pro
Hot diggity! Yup, that works. That's going to speed this up so much and add versatility. Question: Do you think you it's possible to create a custom name rather than hardcode it? Concatenate the name of the caster (using target@{some awesome code here to get the caster's name} + "'s new pet " + the new token's name? I'm still not sure what is/isn't possible in a macro.
1615483367
The Aaron
Forum Champion
API Scripter
Nice. As for the naming, not with the way it's set up now in a table.&nbsp; If it was separate, you could just embed such things.&nbsp; You could add a second command to inject it, but it wouldn't work in the same macro.&nbsp; What I really need to do is add either a relative change operation (like concatenation), or add a way to inject API derived references.&nbsp; I actually HAVE a way to do that which I need to finish and release, which would work perfectly for this.&nbsp; Maybe I can wrap that up this weekend and you can be my secret beta tester. =D
The Aaron said: Nice. As for the naming, not with the way it's set up now in a table.&nbsp; If it was separate, you could just embed such things.&nbsp; You could add a second command to inject it, but it wouldn't work in the same macro.&nbsp; What I really need to do is add either a relative change operation (like concatenation), or add a way to inject API derived references.&nbsp; I actually HAVE a way to do that which I need to finish and release, which would work perfectly for this.&nbsp; Maybe I can wrap that up this weekend and you can be my secret beta tester. =D That's an honor, do not pass it up @Kk!
I am trying to use the token mod light macro: !token-mod --set ?{Vision|Torch, light_radius#40 light_dimradius#20 light_hassight#yes light_angle#360 light_otherplayers#yes|Hooded Lantern, light_radius#60 light_dimradius#30 light_hassight#yes light_angle#360 light_otherplayers#yes|Bullseye Lantern, light_radius#120 light_dimradius#60 light_angle#60 light_hassight#yes light_otherplayers#yes|Lamp, light_radius#30 light_dimradius#15 light_hassight#yes light_angle#360 light_otherplayers#yes|Candle, light_radius#5 light_dimradius#=0 light_hassight#yes light_angle#360 light_otherplayers#yes|Darkvision, light_radius#60 light_dimradius#=-5 light_hassight#yes light_angle#360 light_otherplayers#no|Darkvision (90'), light_radius#90 light_dimradius#=-5 light_hassight#yes light_angle#360 light_otherplayers#no|Warlock Devil's Sight, light_radius#120 light_dimradius#=120 light_hassight#yes light_angle#360 light_otherplayers#no|No light source(Dusk), light_radius#120 light_dimradius#=-5 light_hassight#yes light_angle#360 light_otherplayers#no|Fog, light_radius#200 light_dimradius#=5 light_hassight#yes light_angle#360 light_otherplayers#no|No light source, light_radius#5 light_dimradius#=-5 light_hassight#yes light_angle#360 light_otherplayers#no|Blinded, light_hassight#no light_angle#360 light_otherplayers#no} But I can not seem to get it to work, I have the token Mod library set in my game and the !token-mod --help works but I can't get this lighting macro to work.
1615527669
The Aaron
Forum Champion
API Scripter
That's a macro for Legacy Dynamic Lighting, is that what you have enabled on the page? &nbsp;
No
1615529086
The Aaron
Forum Champion
API Scripter
That's why it appears to not be working. Someone posted a UDL light macro recently, I think it might be a few pages earlier on the thread.&nbsp;
Thank you, I finally found it on page 24 and after a little bit I got it working
1615556772
Kk
Pro
Wolf Thunderspirit said: The Aaron said: Nice. As for the naming, not with the way it's set up now in a table.&nbsp; If it was separate, you could just embed such things.&nbsp; You could add a second command to inject it, but it wouldn't work in the same macro.&nbsp; What I really need to do is add either a relative change operation (like concatenation), or add a way to inject API derived references.&nbsp; I actually HAVE a way to do that which I need to finish and release, which would work perfectly for this.&nbsp; Maybe I can wrap that up this weekend and you can be my secret beta tester. =D That's an honor, do not pass it up @Kk! (: Wouldn't miss it :)
1615618198
This is a great script! I have a question though: is there a way to set the night vision tint color? I've searched everywhere I can think of, but haven't seen any examples that do this. Thanks.
1615618414
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Not yet. There are still several properties which have not been revealed to the API.
1615619783
Thanks. That explains why I couldn't find it. :)
1615650665
Flame L. said: Thank you, I finally found it on page 24 and after a little bit I got it working How did my macros work out for you?&nbsp; Bob
1615651468
HELP!&nbsp; This may be a simple fix. But, Recently I noticed that now whenever I try to link my New Tokens to a journal (or anything else) item in the "Character represents" Drop down List, my page Freezes up.&nbsp; Then It asks me to wait, then it loses connection altogether.&nbsp; How can I fix this???
1615653074
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Check your list of characters in the journal. Make sure none of them have a weird control character like { or @ in the name. Also, (I've never seen this happen), do you have many hundreds of characters in your game?
1615656875
Checked my Journal entries.&nbsp; I only have less than 10 custom entries other than ones from Purchased from the Marketpace.&nbsp; But, I have noticed that the drop down has an excessive number of items in the list.&nbsp; How can I delete these unnecessary items?&nbsp; For example, I don't need "Tree in left corner of street".&nbsp; I do make Copies of Compendium searched Monsters to link up with Tokens...
1615674035
I'm trying to figure out a way to advance a token representing what part of the day it is, have it post the relevant image to chat, and then advance an identical rollable token on another game page. It seems to me that I'd want to break it down into a few steps. First of all, is there a way to simultaneously advance a rollable token and send its relevant image to the chat? (I know when you roll a token it sends a tiny version of the image, but is there a way to call whatever image it's representing?) Second, can you somehow link two rollable tokens together, even if they're on separate pages? So that when you select one and advance it, it will automatically advance the other? I've played around with it a little and haven't been able to achieve the steps above. I have, however, come up with a sort-of workaround macro. /w gm ?{Which Watch? | Morn, [x](<a href="https://i.imgur.com/VTmGhDD.png" rel="nofollow">https://i.imgur.com/VTmGhDD.png</a>) | Day, [x](<a href="https://i.imgur.com/lSCD0FV.png" rel="nofollow">https://i.imgur.com/lSCD0FV.png</a>) | Dusk, [x](<a href="https://i.imgur.com/SMNrexF.png" rel="nofollow">https://i.imgur.com/SMNrexF.png</a>) | Dream, [x](<a href="https://i.imgur.com/93Ipv7q.png" rel="nofollow">https://i.imgur.com/93Ipv7q.png</a>) | Witching, [x](<a href="https://i.imgur.com/WEyBIa4.png" rel="nofollow">https://i.imgur.com/WEyBIa4.png</a>) | Dawn, [x](<a href="https://i.imgur.com/BFDVIUy.png" rel="nofollow">https://i.imgur.com/BFDVIUy.png</a>) } !token-mod --set currentside|+ This prompts a query that will call the image in question from an external source, and then advance the selected token. A little janky, since I can't just advance to the next part of the day. It also doesn't advance the same token on the other page automatically. I would also love to be able to call the API inside the query so I could select a particular side, but nothing I tried worked and it seems like the API doesn't work inside queries anyways. Hope someone can help!
1615676515
The Aaron
Forum Champion
API Scripter
If both tokens represent the same character, you can affect all tokens representing that character in one go: !token-mod {{ &nbsp;&nbsp;&nbsp;&nbsp;--set currentside|+ &nbsp;&nbsp;&nbsp;&nbsp;--ignore-selected &nbsp;&nbsp;&nbsp;&nbsp;--ids @{SomeCharacter|character_id} To show the token's image in chat, you'd need another script. Here's one (very bare bones): !show-token-in-chat or !show-token-in-chat --whisper Code: on('ready',()=&gt;{ on('chat:message',msg=&gt;{ if('api'===msg.type &amp;&amp; /^!show-token-in-chat(\b\s|$)/i.test(msg.content) &amp;&amp; playerIsGM(msg.playerid)){ let who = (getObj('player',msg.playerid)||{get:()=&gt;'API'}).get('_displayname'); let args = msg.content.split(/\s+--/).slice(1).map(s=&gt;s.toLowerCase()); const whisper = args.includes('whisper'); (msg.selected || []) .map(o=&gt;getObj('graphic',o._id)) .filter(g=&gt;undefined !== g) .forEach(g=&gt;sendChat('',`${whisper ? `/w "${who}" ` : ''}&lt;div&gt;&lt;img src="${g.get('imgsrc')}"&gt;&lt;/div&gt;`)); } }); });
1615679987
Is there a way to set the "dimming start" parameter for Nightvision?
1615680071

Edited 1615680097
The Aaron
Forum Champion
API Scripter
No. That setting isn't exposed to the API yet.
1615681177
Sigh. Thanks. This script is so huge that it's hard to tell what all the parameters do. You do great work!
1615681253
The Aaron
Forum Champion
API Scripter
Thanks! I've got some ideas on making the documentation easier to consume, but haven't had the time to work on them.
1615685818
The Aaron said: If both tokens represent the same character, you can affect all tokens representing that character in one go: !token-mod {{ &nbsp;&nbsp;&nbsp;&nbsp;--set currentside|+ &nbsp;&nbsp;&nbsp;&nbsp;--ignore-selected &nbsp;&nbsp;&nbsp;&nbsp;--ids @{SomeCharacter|character_id} To show the token's image in chat, you'd need another script. Here's one (very bare bones): !show-token-in-chat or !show-token-in-chat --whisper Code: on('ready',()=&gt;{ on('chat:message',msg=&gt;{ if('api'===msg.type &amp;&amp; /^!show-token-in-chat(\b\s|$)/i.test(msg.content) &amp;&amp; playerIsGM(msg.playerid)){ let who = (getObj('player',msg.playerid)||{get:()=&gt;'API'}).get('_displayname'); let args = msg.content.split(/\s+--/).slice(1).map(s=&gt;s.toLowerCase()); const whisper = args.includes('whisper'); (msg.selected || []) .map(o=&gt;getObj('graphic',o._id)) .filter(g=&gt;undefined !== g) .forEach(g=&gt;sendChat('',`${whisper ? `/w "${who}" ` : ''}&lt;div&gt;&lt;img src="${g.get('imgsrc')}"&gt;&lt;/div&gt;`)); } }); }); Thank you so much! Representing yet again why you're a forum hero.
1615686291
Here is my macro for setting vision and light sources for a token. It has an issue going to and from directional lighting (the Bullseye Lantern). If I go from Bullseye to Torch, for instance, it changes the radius of the light, but it is still directional. The same thing happens in reverse. If I go into the token and just save it, it fixes the problem. Weird. !token-mod ?{Token dynamic lighting settings: |Normal, --on has_bright_light_vision --off has_night_vision emits_bright_light emits_low_light |Darkvision 60 ft, --on has_bright_light_vision has_night_vision --off emits_bright_light emits_low_light --set night_vision_distance#60 |Darkvision 120 ft, --on has_bright_light_vision has_night_vision --off emits_bright_light emits_low_light --set night_vision_distance#120 |Blind, --off has_bright_light_vision has_night_vision emits_bright_light emits_low_light |Candle, --on emits_bright_light emits_low_light --off has_directional_bright_light has_directional_low_light --set bright_light_distance#5 low_light_distance#5 |Torch/Light Cantrip, --on emits_bright_light emits_low_light--off has_directional_bright_light has_directional_low_light --set bright_light_distance#20 low_light_distance#20 |Lamp, --on emits_bright_light emits_low_light --off has_directional_bright_light has_directional_low_light --set bright_light_distance#15 low_light_distance#30 |Hooded Lantern, --on emits_bright_light emits_low_light --off has_directional_bright_light has_directional_low_light --set bright_light_distance#30 low_light_distance#30 |Hooded Lantern (shuttered), --on emits_bright_light emits_low_light --off has_directional_bright_light has_directional_low_light --set bright_light_distance#0 low_light_distance#5 |Bullseye Lanterm, --on emits_bright_light emits_low_light has_directional_bright_light has_directional_low_light --set bright_light_distance#60 low_light_distance#60 directional_bright_light_center#90 directional_bright_light_total#45 |Snuff, --off emits_bright_light emits_low_light has_directional_bright_light has_directional_low_light }
1615693668
The Aaron
Forum Champion
API Scripter
That's one of the bugs with UDL for the API right now. Hopefully they fix it soon.&nbsp;
1615747089
The Aaron said: That's one of the bugs with UDL for the API right now. Hopefully they fix it soon.&nbsp; Since there are still some bugs in UDL and some features are not exposed to API, I hope they won't force us all to use it before fixing that stuff. Currently they announced the shut-down of Legacy already. I'm not happy about that.
1615752269
The Aaron
Forum Champion
API Scripter
Bernd S. said: Since there are still some bugs in UDL and some features are not exposed to API, I hope they won't force us all to use it before fixing that stuff. Currently they announced the shut-down of Legacy already. I'm not happy about that. Truth!
1615815199
Kk
Pro
DPRoberts said: Here is my macro for setting vision and light sources for a token. It has an issue going to and from directional lighting (the Bullseye Lantern). If I go from Bullseye to Torch, for instance, it changes the radius of the light, but it is still directional. The same thing happens in reverse. If I go into the token and just save it, it fixes the problem. Weird. !token-mod ?{Token dynamic lighting settings: |Normal, --on has_bright_light_vision --off has_night_vision emits_bright_light emits_low_light |Darkvision 60 ft, --on has_bright_light_vision has_night_vision --off emits_bright_light emits_low_light --set night_vision_distance#60 |Darkvision 120 ft, --on has_bright_light_vision has_night_vision --off emits_bright_light emits_low_light --set night_vision_distance#120 |Blind, --off has_bright_light_vision has_night_vision emits_bright_light emits_low_light |Candle, --on emits_bright_light emits_low_light --off has_directional_bright_light has_directional_low_light --set bright_light_distance#5 low_light_distance#5 |Torch/Light Cantrip, --on emits_bright_light emits_low_light--off has_directional_bright_light has_directional_low_light --set bright_light_distance#20 low_light_distance#20 |Lamp, --on emits_bright_light emits_low_light --off has_directional_bright_light has_directional_low_light --set bright_light_distance#15 low_light_distance#30 |Hooded Lantern, --on emits_bright_light emits_low_light --off has_directional_bright_light has_directional_low_light --set bright_light_distance#30 low_light_distance#30 |Hooded Lantern (shuttered), --on emits_bright_light emits_low_light --off has_directional_bright_light has_directional_low_light --set bright_light_distance#0 low_light_distance#5 |Bullseye Lanterm, --on emits_bright_light emits_low_light has_directional_bright_light has_directional_low_light --set bright_light_distance#60 low_light_distance#60 directional_bright_light_center#90 directional_bright_light_total#45 |Snuff, --off emits_bright_light emits_low_light has_directional_bright_light has_directional_low_light } @DPRoberts, I don't know if this is helpful or not, but here's what I'm using. It's a pastiche of other people's code tinkered with a bit to suit my needs. It feels clunky/redundant in parts, but works.&nbsp;Re: your bullseye lantern look at what I designated as 'Magical Vision' below (I have a party member that has a Gem of Seeing. He needs to be able to see in any condition, but in a narrow radius as he's looking through it). You could tweak the radius to suit your needs.&nbsp; !token-mod {{ --set ?{Lighting/Vision Options &nbsp;|See Normal, has_limit_field_of_vision#yes&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;limit_field_of_vision_total#360 &nbsp; &nbsp; &nbsp;|Darkvision, night_vision#yes &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;limit_field_of_night_vision_total#360 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;limit_field_of_vision_total#360 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;night_vision_distance#60 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;night_vision_tint##cc0000 &nbsp; &nbsp;|Blinded, has_limit_field_of_vision#yes&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;has_limit_field_of_night_vision#yes &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;limit_field_of_night_vision_total#0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;limit_field_of_vision_total#0 &nbsp; &nbsp; |Magical Vision, has_limit_field_of_night_vision#yes &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;has_limit_field_of_vision#yes&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;limit_field_of_vision_total#15&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;limit_field_of_night_vision_total#15 |No light,&nbsp; &nbsp; &nbsp; &nbsp;has_bright_light_vision#off &nbsp; &nbsp; &nbsp;emits_bright_light#0ff &nbsp; &nbsp; &nbsp;emits_low_light#off |Candle (br5/dim10), &nbsp; &nbsp; &nbsp;has_bright_light_vision#on &nbsp; &nbsp; &nbsp;emits_bright_light#on &nbsp; &nbsp; &nbsp;bright_light_distance#5 &nbsp; &nbsp; &nbsp;low_light_distance#5 |Lamp (br15/dim30), &nbsp; &nbsp; &nbsp;has_bright_light_vision#on &nbsp; &nbsp; &nbsp;emits_bright_light#on &nbsp; &nbsp; &nbsp;bright_light_distance#15 &nbsp; &nbsp; &nbsp;low_light_distance#30 |Torch/Light Cantrip (br20/dim40), &nbsp; &nbsp; &nbsp;has_bright_light_vision#on &nbsp; &nbsp; &nbsp;emits_bright_light#on &nbsp; &nbsp; &nbsp;bright_light_distance#20 &nbsp; &nbsp; &nbsp;low_light_distance#20 |Hooded Lantern (br30/dim60), &nbsp; &nbsp; &nbsp;has_bright_light_vision#on &nbsp; &nbsp; &nbsp;emits_bright_light#on &nbsp; &nbsp; &nbsp;bright_light_distance#30 &nbsp; &nbsp; &nbsp;low_light_distance#30} }}&nbsp;
Hi. Noob question here -- I'm just getting started with APIs, and have run into a problem with TokenMod: it doesn't seem to want to function at all. It shows as loaded in the API console (v0.8.64), I've tried disabling/enabling, deleting/saving, exiting the game and re-entering, but I can't even get the "!token-mod --help" command to respond. Except it did *once* and I was able to turn on a torch effect *once*, but nothing since then. Which, as a developer, I know is even more goofy.&nbsp; I've loaded a couple of other scripts (Message of the Day and Death Tracker), and they've worked fine. I'm hoping there's a "Oh, do you have that big flashing switch called 'Allow token_mod to work Yes|No' turned on" level of explanation, but if there is, I need help being pointed at it.
1615850598

Edited 1615850624
The Aaron
Forum Champion
API Scripter
hmm.&nbsp; That's peculiar.&nbsp; If you select a token and run: !token-mod --set statusmarkers|!blue Does it toggle the blue status marker on and off? I'm wondering if it's just a problem with the help rendering, or if the whole thing isn't working. Also, feel free to PM me a join link and GM me if you want me to just come and suss things out directly.&nbsp; =D
Yup, that does nothing. I'll DM you a join link, etc. -- thanks!
1615904497
*** Dave H. said: Hi. Noob question here -- I'm just getting started with APIs, and have run into a problem with TokenMod: it doesn't seem to want to function at all. It shows as loaded in the API console (v0.8.64), I've tried disabling/enabling, deleting/saving, exiting the game and re-entering, but I can't even get the "!token-mod --help" command to respond. Except it did *once* and I was able to turn on a torch effect *once*, but nothing since then. Which, as a developer, I know is even more goofy.&nbsp; I've loaded a couple of other scripts (Message of the Day and Death Tracker), and they've worked fine. I'm hoping there's a "Oh, do you have that big flashing switch called 'Allow token_mod to work Yes|No' turned on" level of explanation, but if there is, I need help being pointed at it. Are your other scripts working? Or do you perhaps just need to refresh your API sandbox?