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 Update] TokenMod -- An interface to adjusting properties of a token from a macro or the chat area.

1560361829
The Aaron
Roll20 Production Team
API Scripter
Hahahaha!  We don't have those problems. =D
The Aaron said: I use that super power in the game I play in to fix things for the GM. =D ( ...and subtly rename the other players' tokens... =D ) keithcurtis said: We have enough issues come up during the course of any game, that any player who tried intentional shenanigans would have the others fall on him like a "ton of rectangular building things". lmao
1561523660

Edited 1561523764
Is there a way for me to turn off (Names: See) for all tokens in my game? To be honest, I can't even seem to set one using Token-Mod :( NOTE: here's the command I was using with the token selected - !token-mod --set showplayers_name|no
1561524544
The Aaron
Roll20 Production Team
API Scripter
That should work.  You could try: !token-mod --off showplayers_name You can try this script also: on('ready',()=>{ let tokens = findObjs({ type: 'graphic' }); let num = `${tokens.length}`; const burndown = () => { if(tokens.length){ let t = tokens.shift(); to.set({ showplayers_name: false }); setTimeout(burndown,0); } else { sendChat('',`/w gm Adjusted ${num} graphics.`); } } }); Just save that, then when you get the message in chat about how many graphics it adjusted, you can disable it.
Sorry if this has been answered before, but I've been searching all day and couldn't find an answer.   Is there a macro/API that rolls attack and damage, shows it on chat and then compares it to a target token and automatically subtracts the damage from health bar if the attack hit?   I could swear I had a DM once that used this, but now I'm starting to think I'm remembering it wrong...
1561599344
The Aaron
Roll20 Production Team
API Scripter
That could definitely be written.  It's very dependent on how a Character is set up, what system you are playing, etc.
1561599761
The Aaron
Roll20 Production Team
API Scripter
Ok, I read your other thread. TokenMod could certainly be used to apply damage to a token, but the currently released version doesn't have a way fo reporting back what that damage was.  You could write a formula that did the calculation for if it hit, multiplied the 1 or 0 result time the damage, and then subtracted that from the token's health, but you would not get any feedback about what was rolled in any case.  Probably the DM had a different script to do this, likely something custom. BTW, the buttons at the top left are called Token Actions.  They are (usually) Character Abilities that have the Token Action check marked.  They only show up when the token is selected.
Oh yeah, I was able set up the Token Actions no problem, just forgot the proper name hahaha Anyways, even if it's not possible right now it feels good to settle the question, I can finally go to sleep. Thank you very much!
1561600147
The Aaron
Roll20 Production Team
API Scripter
No problem. =D
I've been in a game where the DM used the Power cards script with the OGL sheet and Alter bars script in the past. I don't know if it works with any sheet. <a href="https://app.roll20.net/forum/post/4285059/script-powercards-3-thread-4/?pageforid=4286942" rel="nofollow">https://app.roll20.net/forum/post/4285059/script-powercards-3-thread-4/?pageforid=4286942</a>
1561866661

Edited 1561879909
Hi, I was hoping I could get some help with this. I made the following macro to change the vision type for PCs in my campaign (some of them can change to a form with a different vision than they have), but the light_multiplier doesn't change when I use it. EDIT: Turned out to be a rogue } in the bolded section below. Copied the macro format from someone else and didn't think to proofread :p !token-mod {{ --set?{vision type| &lt;snip&gt; moonlight adv/ll, light_radius#60 light_dimradius# light_multiplier#2}} }} ?{vision toggle|no, |yes, --flip light_hassight} Light_radius and dim_radius are changed appropriately. Am I overlooking something in the macro, or could it be another script interfering?
1561867930
The Aaron
Roll20 Production Team
API Scripter
Hmm. I'll&nbsp; have to do some testing...
I'd like to use tokenmod's relocation parameter (top, left), but don't know what the values should be.&nbsp; I have a really cool area where they are magically ported from one place to another if they agree, and when they arrive they are faced with arriving in a magical darkness spell.&nbsp; I already can set all the parameters for darkness through tokenmod, and I know I will have to use subsequent calls for each of them to not arrive on top of each other. Either way, is there a way I can set the token in its arrival position and draw from that it's current location in the top and left numbered format?&nbsp; If so, how?
1565006427

Edited 1565006514
The Aaron
Roll20 Production Team
API Scripter
You can set it explicitly with a number: !token-mod --set top|5u left|5u u is units, so grid squares. No unit means pixels, there are a few others in the help. &nbsp;The above places it in the grid square 5 down from the to and 5 in from the left. (Might need a .5 on there to center it.) You can move the relative with a preceding - or +: !token-mod --set top|+5u left|-5u That's down 5 units and right 5 units.&nbsp;
Forgive me if this has been answered (I looked, but don't see it), but is there a way to keep the aura on the gmlayer while the token it's attached to is on the Object/Token layer?&nbsp; I don't want the players to see the auras, but I need the reminder that they're there.&nbsp; Thank you!
1567471763
The Aaron
Roll20 Production Team
API Scripter
Not with TokenMod. Something could be written that does something similar. I have a few snippets that keep an invisible token on another layer which have auras on them and follow the tokens around. If you look at Bump, it has similar functionality (but won't work for what you want). &nbsp;I'll see if I can find something for your use case.&nbsp;
1567481661
The Aaron
Roll20 Production Team
API Scripter
Ok ASC, I made a thing:&nbsp; <a href="https://app.roll20.net/forum/post/7739509/script-gmaura-gm-only-auras-that-follow-tokens-around/?pageforid=7739509#post-7739509" rel="nofollow">https://app.roll20.net/forum/post/7739509/script-gmaura-gm-only-auras-that-follow-tokens-around/?pageforid=7739509#post-7739509</a> \ Enjoy!
1568058986

Edited 1568059015
Joe
Pro
Hi Aaron, For my 10 foot square maps such as the Howling Caves in Princes of the Apocalypse, to get the ruler and token size to work correctly I have set the page settings to &nbsp;“1 grid cell = 5ft, cell width 0.5”.&nbsp; However, then using TokenMod with a scale of ft (eg 15ft) didn’t work, but using “g” did (eg 3g), including on normal scale maps. The problem is that using “g” when setting aura sizes on the 10’ square maps resulted in auras that are half the size they should be (eg 7.5 in the token settings, resulting in 1.5 squares). Am I overlooking something, or is that perhaps an overlooked case in your relatively recent scaling update? Thanks for your help!
1568064168
The Aaron
Roll20 Production Team
API Scripter
Hmm. I'll take a look!
1568072557
The Aaron
Roll20 Production Team
API Scripter
Hmm.. Joe, I'm getting the opposite behavior!? Here are my page settings: Using this command, I get a valid 15ft / 3 unit aura on my token: !token-mod --set aura2_radius|15ft Using this command, I get a 7.5ft / 1.5 unit aura on my token: !token-mod --set aura2_radius|3g It definitely seems like the 3g should end up with 15ft / 3 units.&nbsp; Questions for you: Do I have the configuration you described above?&nbsp; Are you getting the same results I have and I misunderstood what you meant, or are you getting different results?
1568074822
The Aaron
Roll20 Production Team
API Scripter
Ok, I think I've tracked down the issue. g is supposed to be grid units, so 3g should be whatever would make it measure 3 grid units.&nbsp; It's working for sizing tokens, but not for radii, which are measured in page based scales instead of pixels. u is supposed to be Roll20 Units, 70 pixels, regardless of map scale.&nbsp; It also is working for sizing tokens, but not for radii. I have fixed it and will push an update.&nbsp; This is unfortunately a breaking change, as existing scripts that use one of the other unit will be broken.&nbsp; Hopefully people will forgive me, particularly as the vast majority of cases probably do not use an altered grid size...
Aww - c'mon Aaron, all of us should be thanking you, not having you beg forgiveness...
Wolf Thunderspirit said: Aww - c'mon Aaron, all of us should be thanking you, not having you beg forgiveness... Yep, what he said! &nbsp;Thank you as always for being so responsive, and I apologize to those whose scripts were disturbed, but hopefully now I can convince Roll20 to really actually though play nice with the same scripts for 5’ and 10’ maps. :-P ;-)&nbsp;
1568082367

Edited 1568082467
Joe said: Wolf Thunderspirit said: Aww - c'mon Aaron, all of us should be thanking you, not having you beg forgiveness... Yep, what he said! &nbsp;Thank you as always for being so responsive, and I apologize to those whose scripts were disturbed, but hopefully now I can convince Roll20 to really actually though play nice with the same scripts for 5’ and 10’ maps. :-P ;-)&nbsp; Alot of the new tech in R20 has thrown the APIs in a descending spiral, including some things that I'm not sure can be fixed. But while we're at it Aaron, I've been noticing that - using token-mod for something like an enlarge/ reduce spell has had some strange effects.&nbsp; One of the things I see happen is the token loses it's actual borders.&nbsp; The image is the correct size, but the selected area is significantly larger - the Right &amp; Bottom edges and Right-Bottom Corner being far off the map.&nbsp; Simply moving the token one grid over resolves the issue, I just find it strange.&nbsp; I notice it does it on every page that token is found.&nbsp; It's a player's token, so I don't want to make it current page only in case I transition the page their on, but as I said, it's a strange thing.&nbsp; I'm using the 'g' scaring to accomplish this, as i find it has better overall use, since not all maps are 1 grid : 5' : 70px - I only wish they were.&nbsp; When you're dealing with large areas like town and kingdom maps, you get smaller and smaller ...
1568085623
The Aaron
Roll20 Production Team
API Scripter
Thanks guys! &nbsp;I just really hate breaking interfaces. =D Yeah, I've noticed that same issue why resizing. It happened with the first round of canvas rewrites. I should find a reproducible case and devs it up the dev chain... I'll try and get a release out for this tomorrow night. I've got a new feature for TokenMod that I need to finish up so I can deploy both at the same time. ;D
1568117323

Edited 1568119280
Sorry, I've been out of the loop for a few months. Would anyone mind confirming whether 'Bar position' and the 'condensed bar' option is covered by the tokenmod api now? I recall that 'set token default' via the API couldn't 'remember' these settings. I think I remember something about Aaron not getting the key details he needed supplied by the Dev team. Thanks!
1568118999
The Aaron
Roll20 Production Team
API Scripter
Currently, the API has no access to those settings and setdefautttoken() does not preserve them.&nbsp;
Thanks for the super fast response!
1568122070
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The Aaron said: Currently, the API has no access to those settings and setdefautttoken() does not preserve them.&nbsp; "And there was much wailing and gnashing of teeth, causing the multitude to rend their garments and mourn with overpowering sadness" I mean, I would very much like those to be implemented, Roll20.
1568163417
The Aaron
Roll20 Production Team
API Scripter
Update v0.8.45 &nbsp;-- Fixed a bug where&nbsp; u , &nbsp; g &nbsp;relative units were being incorrectly scaled when the Grid Cell width was other than 1.&nbsp; My sincere apologies if that makes any of your existing macros incorrect, I wish I'd caught it before I released it.&nbsp; (Thanks&nbsp; Joe ) New feature: Report Experimental &nbsp; --report &nbsp;provides feedback about the changes that were made to each token that a command affects. Arguments to the&nbsp; --report &nbsp;command are&nbsp; | &nbsp;separated pairs of Who to tell, and what to tell them, with the following format: !token-mod --report Who[:Who ...]|Message You can specify multiple different Who arguments by separating them with a&nbsp; : . Be sure you have no spaces. Available options for Who player &nbsp;will whisper the report to the player who issued the command. gm &nbsp;will whisper the report to the gm. all &nbsp;will send the report publicly to chat for everyone to see. token &nbsp;will whisper to whomever controls the token. character &nbsp;will whisper to whomever controls the character the token represents. control &nbsp;will whisper to whomever can control the token from either the token or character controlledby list. This is equivalent to specifying&nbsp; token:character . The Message must be enclosed in quotes if it has spaces in it. The Message can contain any of the properties of the of the token, enclosed in&nbsp; { } , and they will be replaced with the final value of that property. Additionally, each property may have a modifier to select slightly different information: Available options for Property Modifiers before &nbsp;-- Show the value of the property before a change was applied. change &nbsp;-- Show the change that was applied to the property. (Only works on numeric fields, will result in 0 on things like name or imagsrc.) Showing the amount of damage done to a token. !token-mod&nbsp;{{ &nbsp;&nbsp;--set &nbsp;&nbsp;&nbsp;&nbsp;bar1_value|-[[2d6+8]] &nbsp;&nbsp;--report &nbsp;&nbsp;&nbsp;&nbsp;all|"{name}&nbsp;takes&nbsp;{bar1_value:change}&nbsp;points&nbsp;of&nbsp;damage." }} Showing everyone the results of the hit, but only the gm and the controlling players the actual damage and original hit point value. !token-mod&nbsp;{{ &nbsp;&nbsp;--set &nbsp;&nbsp;&nbsp;&nbsp;bar1_value|-[[2d6+8]] &nbsp;&nbsp;--report &nbsp;&nbsp;&nbsp;&nbsp;all|"{name}&nbsp;takes&nbsp;a&nbsp;vicious&nbsp;wound&nbsp;leaving&nbsp;them&nbsp;at&nbsp;{bar1_value}hp&nbsp;out&nbsp;of&nbsp;{bar1_max}hp." &nbsp;&nbsp;&nbsp;&nbsp;gm:control|"{name}&nbsp;damage:&nbsp;{bar1_value:change}hp,&nbsp;was&nbsp;at&nbsp;{bar1_value:before}hp" }} Being experimental means I'll probably make some changes to this based on feedback.&nbsp; I've been wanting to add something like this for a while.&nbsp; I was working on it but haven't had the time to really polish it.&nbsp; I'm looking for feedback on where this should go, and how it should be expanded, or changed.&nbsp; Let me know what you think!
1568163528
GiGs
Pro
Sheet Author
API Scripter
That report feature does look very useful.
1568163692
The Aaron
Roll20 Production Team
API Scripter
I hope so!&nbsp; It's pretty basic right now, but I have some ideas on how to make it nicer.
1568164488
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Quick question: can you perform math with the report values? subtract an after value from a before value, for instance?
1568164531
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Oh, and WOW!
1568165278
The Aaron
Roll20 Production Team
API Scripter
Not yet... I have a few ideas on how to do that: Use a special syntax like PCPP [#[ {bar1_value} - {bar1_value:change} ]#] Advantage: you can do it inline Disadvantage: it's counter to how you'd usually type it Define reports in handouts and specify the report to "fill in".&nbsp; Advantage: can use all the formatting you like, can have GM reports with player reports, can type formulae as normal Disadvantage: have to set them up and manage them separately from commands Define reports in Abilities in a particular character (or the represented character) and fill them in.&nbsp; Advantage: Can type formulae as normal, grouped together, can override a global format on a specific character basis Disadvantage: have to set them up and manage them separately from commands Probably doing all three is the answer. &nbsp;Maybe with a blend of calling Roll Templates as well.
Report feature looks nifty! &nbsp;Certainly useful if you have any concerns about player abuse (fortunately, I don’t). &nbsp;Thank you for the quick scaling fix!
1568228824
The Aaron
Roll20 Production Team
API Scripter
I suppose it could be used for monitoring player changes, but I mostly intended it for getting back the results from formula supplied, such as a healing potion being used.&nbsp; =D
Good point, and that was actually clear in your example. I just haven’t tried to use it for anything like that yet, so it didn’t jump out at me as much. Definitely see the utility, though.&nbsp;
Hey Aaron, since the recent update when I resize a token using scale in units of g, but to a non-whole number (eg 0.72), the selected token resizes to a whole grid unit the next time it is moved. Scaling the token manually by holding down alt/option while dragging its corner square works as normal. One thing I also notice is that after using TokenMod to scale it, the selected token only has the top-left 3 of the blue grab squares that are usually on all 8 sides and corners. &nbsp;The rest of the thin blue “selected” square outline is still there. After it is moved and resizes itself, they are all there again. Any ideas what might be going on? &nbsp;Thanks in advance!
1569171323
The Aaron
Roll20 Production Team
API Scripter
Yeah, that's a bug introduced when the did the bug AFoW rewrite of the canvases. If you hold alt the next time you move it, it will preserve the new size. Hopefully that will get fixed at some point.&nbsp;
The Aaron said: Yeah, that's a bug introduced when the did the bug AFoW rewrite of the canvases. If you hold alt the next time you move it, it will preserve the new size. Hopefully that will get fixed at some point.&nbsp; Ok, thanks for the info!
I was hoping someone could enlighten me on something. I am trying to set up a macro for a player with Find Familiar (5e OGL) and so far I am able to set the tokens represents, hp, ac, etc.. using token-mod and a rollable table but have a few snags. Here is what I have so far working: !token-mod {{ --set represents|?{Familiar?|Bat|Cat|Crab|Frog|Hawk|Lizard|Octopus|Owl|Quipper|Rat|Raven|Seahorse|Snake|Spider|Weasel} bar3_link|ac bar2_link| bar1_link|hp currentside|?{Side?} --on showname showplayers_name light_hassight }} Question 1: Is there a better way to set the current side other than what I have? currentside|?{Familiar?|Bat, 1|Cat, 2 etc...} does not work. Question 2: Is there a way to set the name that works?&nbsp; name|"@{selected|npc_name}" seems to pass thru the API first and no name is set. Question 3: Not strictly token-mod maybe, but is there a way to have the macro call the token from the rollable table along with this macro? As in when you click the 'Token' button next to the rollable table. Thanks in advance!!&nbsp;
1569338320

Edited 1569338361
Mike said: I was hoping someone could enlighten me on something. I am trying to set up a macro for a player with Find Familiar (5e OGL) and so far I am able to set the tokens represents, hp, ac, etc.. using token-mod and a rollable table but have a few snags. Here is what I have so far working: !token-mod {{ --set represents|?{Familiar?|Bat|Cat|Crab|Frog|Hawk|Lizard|Octopus|Owl|Quipper|Rat|Raven|Seahorse|Snake|Spider|Weasel} bar3_link|ac bar2_link| bar1_link|hp currentside|?{Side?} --on showname showplayers_name light_hassight }} Question 1: Is there a better way to set the current side other than what I have? currentside|?{Familiar?|Bat, 1|Cat, 2 etc...} does not work. Question 2: Is there a way to set the name that works?&nbsp; name|"@{selected|npc_name}" seems to pass thru the API first and no name is set. Question 3: Not strictly token-mod maybe, but is there a way to have the macro call the token from the rollable table along with this macro? As in when you click the 'Token' button next to the rollable table. Thanks in advance!!&nbsp; One thing I noticed, though I doubt it will actually resolve the issue, is a space between current sides and values.&nbsp; Try eliminating that and seeing if it changes the function.&nbsp; It may or may not, but I noticed a difference in the macros I've written in the past.&nbsp; So... currentside|?{Familiar?|Bat, 1|Cat, 2 etc...} becomes currentside|?{Familiar?|Bat,1|Cat,2 etc...} It's actually a shot in the dark here, but I know that something as simple as that has made a difference in some of my macros.
Wolf Thunderspirit said: One thing I noticed, though I doubt it will actually resolve the issue, is a space between current sides and values.&nbsp; Try eliminating that and seeing if it changes the function.&nbsp; It may or may not, but I noticed a difference in the macros I've written in the past.&nbsp; So... currentside|?{Familiar?|Bat, 1|Cat, 2 etc...} becomes currentside|?{Familiar?|Bat,1|Cat,2 etc...} It's actually a shot in the dark here, but I know that something as simple as that has made a difference in some of my macros. Holy *&amp;%*^ it was that simple, lol. Removed the spaces and the currentside now works! Thanks!!
1569343054

Edited 1569343418
For the name function, you may not be able to do that without going back and hitting a second macro.&nbsp; The issue is timing.&nbsp; The macro is a once-and-done, and what you're wanting it to do is re-evaluate the change and then change something else, based on the change.&nbsp; So what you have to realize is that it wants to draw from the current state - not the changed state - because the API can't loop back and check what it (itself) has changed.&nbsp; It did it's job and quit for the day. You also can't sequence two macros.&nbsp; When you try, it's two people working in the same shift, not one following the other.&nbsp; So everything is happening at once.&nbsp; There is a Delay API out there, but I was never able to get it to do everything I wanted, maybe you'll be luckier.&nbsp; Short term though, this is a two stage process.&nbsp; You'll have to call two different macros when you would like this to happen.
As far as Q3, I think What you're looking for is Here , but not 100% sure...
For name, simply setting what you know to be the correct name based on the “Familiar?” selection, rather than using a token attribute, seems like an easy answer. For the delay, I know the Roll20AM script has a delay function built in that seems to work well, but I don’t know if Aaron has ever considered adding it to this script.
1569347682

Edited 1569348388
Joe said: For name, simply setting what you know to be the correct name based on the “Familiar?” selection, rather than using a token attribute, seems like an easy answer. For the delay, I know the Roll20AM script has a delay function built in that seems to work well, but I don’t know if Aaron has ever considered adding it to this script. Exactly as Joe stated about naming.&nbsp; I'm hitting myself for not thinking of that!&nbsp; With that suggestion, you could do alot.&nbsp; But also, what about the fact that your familiar is your familiar, it has a name ... Caleb Widogast from CR has Frumpkin.&nbsp; Whether he is a cat or an octopus, he's still "Frumpkin".&nbsp; Unless you're using the script for multiple familiars (Oh gawds, the thought of that as a DM frightens me!), I think you could hardcode one name fits all, unless you wanted to do something like "Frumpkin (Cat)", and change that to "Frumpkin (Bat)" on the fly when he resummons it in a different form.&nbsp; That's still doable under Joe's suggestion: name|Frumpkin (?{Familiar?|Bat|Cat|Crab|Frog|Hawk|Lizard|Octopus|Owl|Quipper|Rat|Raven|Seahorse|Snake|Spider|Weasel}) If you do have multiple uses of this, you could just copy the macro and make slight enough changes in the name of macro and who uses it, i.e: Sally's Familiar Macro is named Fam-Sally with her familiar named Shazbot in it, and Bob's Familiar Macro is named Fam-Bob with his named Nanu-Nanu ... if you see what I mean.&nbsp; That only matters if you are using macros from anywhere outside of their character sheet.&nbsp; For example, I have a whole character sheet for DM level Macros and another for PC level Macros when the macro is used by multiple PCs (The macros are on the Abilities Tab).&nbsp; This makes the macros portable between games, rather than using the global macro system, which makes them far more time consuming to copy into another game ....&nbsp; But if you are using them per character sheet on the abilities tab, it won't matter anyway, those are isolated to that character. . As far as a delay in token-mod, it seems outside the parameters of what the API needs.&nbsp; I'm not sure what implementing a delay would be useful for.&nbsp; As I said, the API can't stop and re-evaluate changes it has made, so where would delay benefit the API? I'd think it would be useful (and probably is, for others, at least) as a stand alone API rather than part of token-mod.
Wolf Thunderspirit said: As far as Q3, I think What you're looking for is Here , but not 100% sure... Perfect! This solved every issue, thanks all!
Mike said: Wolf Thunderspirit said: As far as Q3, I think What you're looking for is Here , but not 100% sure... Perfect! This solved every issue, thanks all! Weird ... I solved something?&nbsp; Since when am I answering questions instead of asking?&nbsp; LMAO