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
This post has been closed. You can still view previous posts, but you can't post any new replies.

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

The Aaron said: Update v0.8.14 -- Fixed the bug causing a crash for empty arguments. (Thanks Gozer the Gozerian!) That did it, thanks!
Right I have a strange issue with linking some attributes to a token bar automatically. Specifically ones with large calculations such as AC from the 5th edition shaped sheet.  I can't figure out why this is though.
1442696729
The Aaron
Pro
API Scripter
I believe it's because those don't exist as attributes, they are autocalculated fields.  TokenMod looks for the attribute and fails to find it.  There seems to be a workaround for this (Based on a conversation with Mark/Kryx) that involves setting the represents to the name of the field rather than the id of the attribute.  I need to look into adding this to TokenMod.
Silly question, but are players able to use the !token-mod commands if they are not GM?
1443024135
The Aaron
Pro
API Scripter
Yes. By default, they can only target tokens they can select. You can grant the ability to use --ids if you trust your players sufficiently. She the help for details: !token-mod --help I think there's a button to toggle it. 
Great, thanks, I somehow missed the toggle...
1447675958
Ziechael
Forum Champion
Sheet Author
API Scripter
I challenge you to add a function to allow users to set token sizes in pixels/units using TokenMod ;)
1447695741
vÍnce
Pro
Sheet Author
Ziechael said: I challenge you to add a function to allow users to set token sizes in pixels/units using TokenMod ;) I believe Ziechael has thrown down the gauntlet!
1447696434
Ziechael
Forum Champion
Sheet Author
API Scripter
Vince said: Ziechael said: I challenge you to add a function to allow users to set token sizes in pixels/units using TokenMod ;) I believe Ziechael has thrown down the gauntlet! Only because he has selfishly gone camping and isn't around to 'help' 'me' add the function myself =D
1447696636
vÍnce
Pro
Sheet Author
LOL.  I'm actually surprised that resizing tokens isn't part of TokenMod's kitchen sink of features.  Aaron's such a slacker. ;-P
1447759577
Ziechael
Forum Champion
Sheet Author
API Scripter
Vince said: LOL.  I'm actually surprised that resizing tokens isn't part of TokenMod's kitchen sink of features.  Aaron's such a slacker. ;-P Dammit, it totally is: !token-mod --set width|140 height|140 Admittedly I don't think it can use units as the scale but pixels works a treat... he's good, I'll give him that! I retract my challenge... and instead challenge him to allow autocalc fields as values accessible by the --set option (which I can't seem to do currently)...
1447768296
Alicia
Sheet Author
Ziechael said: I retract my challenge... and instead challenge him to allow autocalc fields as values accessible by the --set option (which I can't seem to do currently)... +1 
1447795664
The Aaron
Pro
API Scripter
Ziechael said: Vince said: LOL.  I'm actually surprised that resizing tokens isn't part of TokenMod's kitchen sink of features.  Aaron's such a slacker. ;-P Dammit, it totally is: !token-mod --set width|140 height|140 Admittedly I don't think it can use units as the scale but pixels works a treat... he's good, I'll give him that! I retract my challenge... and instead challenge him to allow autocalc fields as values accessible by the --set option (which I can't seem to do currently)... Actually... !token-mod --set width|[[@{some_auto_calc_field}]] Should work just fine, as it will get rolled and end up with a number that will then be plugged into the width.  =D " Say.. did you drop this gauntlet?? "  =D
1447806226
vÍnce
Pro
Sheet Author
LOL.  I knew it.  Awesome.
1447838671

Edited 1447838740
Ziechael
Forum Champion
Sheet Author
API Scripter
For me the autocalc issue is pertaining to setting the bars on a token, all of the ones that are pure input values work just dandy but the one that relies on autocalc (armorclass on the 3.5e sheet for reference) doesn't get set... not a huge issue since this is only really affecting the Druid's shape-shift at present (in Elf form she has that bar for weapon ammunition, animal form it is AC) and is purely a visual reminded of any changes in AC when shifted but it is something i'd like to implement in my 'quick token setup macro'... [edit] I suppose technically I could just set the bar value to [[@{armorclass}]] by the same logic since it doesn't need to by tied to the sheet as a dynamic value... but still... ...cautiously picks up the gauntlet again, ready to drop it again at the first hint of a knowing smile on The Aaron's face...
1447848113
The Aaron
Pro
API Scripter
Oh, that old chestnut.  You're talking about setting the represents on the bars.  That's a more difficult problem.  I'll see what I can do.  I know that Kyrx solved this issue for his importer, but I don't recall the actual solution.  I'll drop him a line and see what it was. =D Kicks gauntlet about on the floor for a bit...
1447986212

Edited 1447987018
Hi All! Hopefully, I'm not being dense and this been answered elsewhere already. Is it possible for TokenMod to receive values from another API script?  Meaning, I have a macro with a PowerCard that I'd like have its damage result subtract from the target's HPs when an attack is successful.  Is this possible?  Wonderful scripts btw, Aaron! Example of my PowerCard macro: !power {{ --charid|@{character_id} --emote|@{selected|token_name} swings a @{meleeweaponname1} at @{target|token_name}. --format|COMBAT --titlefont|Arial --titlefontsize|9 --subtitlefont|Arial --name|**Melee Attack** --leftsub|**@{meleeweaponname1}** --rightsub|**Reach 5 ft.** --Target:|$$#ff0000|**@{target|token_name}**$$ --Attack:|[[ [$Atk] @{AdvDisadv} + @{strength_mod} + @{PB} ]] vs AC --?? $Atk.total < @{target|npc_AC} AND $Atk.base <> 1 AND $Atk.base <> 20 ?? Miss:|The attack missed! --?? $Atk.base == 1 ?? Critical Miss:|The attack was fumbled! --?? $Atk.total >= @{target|npc_AC} AND $Atk.base <> 1 AND $Atk.base <> 20 ?? Hit:|You hit for [[ @{meleedmg1} + @{strength_mod} ]] @{meleedmgtype1} damage! --?? $Atk.base == 20 ?? Critical Hit:|You crush your target for [[ (@{meleedmg1} + @{strength_mod}) * 2 ]] @{meleedmgtype1} damage! }}
1447987297
The Aaron
Pro
API Scripter
Unfortunately, no.  There would need to be some seriously intercommunication between the two scripts.  Probably the best you could hope for is to prompt for the damage with something like ?{Damage|[[@{meleedmg1}+@{strength_mod} ]]}, then you could use ?{Damage} in various places to supply the same value. to multiple commands.  The problem is, since it's selectively handled, you'd still have the problem that on a miss, you'd have to back out the damage.
Meh, no worries.  I kind of thought that might be the case.  Thanks for responding though!
1447989614
The Aaron
Pro
API Scripter
No worries!  =D
First, awesome script! Second, I'm having having an issue with this and another script. The other script ( <a href="https://app.roll20.net/forum/post/725584/slug%7D" rel="nofollow">https://app.roll20.net/forum/post/725584/slug%7D</a> ) automatically adds status icons for various levels of HP (i.e. bloodied, 1/4 health, dead). When I modify the HP bar with Token Mod though the other script doesn't update. For example a bloodied token has the half-heart status then is healed to over half, via Token Mod, the status remains. I can go back in and manually set the value to current amount and the status goes away.&nbsp; I'm wondering if there is an easy way to make them work together or to pull that other scripts functionality into TokenMod.
1448045526
The Aaron
Pro
API Scripter
There isn't an easy way, sorry to say. &nbsp;The issue is that API scripts react to events, such as a user changing a token's bar1 value. &nbsp;However, API scripts don't trigger those events. &nbsp;There is a way to do it, but not a very standard way yet. &nbsp;I have plans for one, but it's on the coat tails of some bigger work I want to get done first. &nbsp;The best I can say is "someday". =/
1450227783
The Aaron
Pro
API Scripter
Update v0.8.15 -- Fixed the bug preventing setting some properties to blank. (Thanks Jacob !)
SWEET!
Awesome script! Any chance you're still planning on adding in toFront() and toBack commands to TokenMod? Seems easy enough to make my own little utility script for it, but TokenMod is a perfect home for it! :D
1451887015
The Aaron
Pro
API Scripter
Ah, good point! &nbsp;It would be easy enough to add. I'll try to get that out shortly.&nbsp;
1451917331
The Aaron
Pro
API Scripter
Update v0.8.16 -- Added --order for pushing tokens to the front or back (Thanks Nosaj !): !token-mod --order tofront For to front, use one of: tofront, front, f, top For to back, use one of: toback, back, b, bottom
The Aaron said: Update v0.8.16 -- Added --order for pushing tokens to the front or back (Thanks Nosaj !): !token-mod --order tofront For to front, use one of: tofront, front, f, top For to back, use one of: toback, back, b, bottom Beautiful! Thanks so much Aaron! I use some 70x140 token sizes quite a bit and this makes it much easier to keep the board looking nice! :D
1451935793

Edited 1451935845
vÍnce
Pro
Sheet Author
Nice addition. &nbsp;Not to create more work for you Aaron, but is there anything else left to do on tokens(current state) or has TokenMod covered it? &nbsp;Awesome work.
1451937389
The Aaron
Pro
API Scripter
Well, assigning control is something that can't be done via token mod currently but could be. &nbsp;It's kind of a crossover to the near-mythical CharMod, which has prevented me from doing it.&nbsp;
1452882545

Edited 1452882584
vÍnce
Pro
Sheet Author
Can we use TokenMod to remove represents? ( <a href="https://app.roll20.net/forum/post/2830982/macro-to" rel="nofollow">https://app.roll20.net/forum/post/2830982/macro-to</a>... ) &nbsp;Thanks
1452884048
The Aaron
Pro
API Scripter
Update v0.8.17 -- Added support for blanking represents by using --set represents| (Thanks Vince )
1452884502
vÍnce
Pro
Sheet Author
I knew there was something you hadn't done to this script... now what? &nbsp;;-P
1453057161
The Aaron
Pro
API Scripter
Better reporting... =D
Oh thank you so much! This was also something I requested somewhere in the depths of this forum!
1453144094
The Aaron
Pro
API Scripter
Oh! &nbsp;Sorry I dropped the ball on that when you asked about it Wandler! &nbsp;But I am glad it's working for you now. &nbsp;Do I have any other dropped balls out there?
1453152550
Ziechael
Forum Champion
Sheet Author
API Scripter
*cough* CharMod *cough*
1453154681
vÍnce
Pro
Sheet Author
Ziechael said: *cough* CharMod *cough* Yea, CharMod would be a great "additional feature" for TokenMod. &nbsp;;-}
1453177416
The Aaron
Pro
API Scripter
Soon... =D
No problem. I merely wanted to say thank you and not complain "why haven't you done that earlier" :) No sane person would dare to do the latter in front of the Scriptomancer :P
1453226996
Ziechael
Forum Champion
Sheet Author
API Scripter
Wandler said: No problem. I merely wanted to say thank you and not complain "why haven't you done that earlier" :) No sane person would dare to do the latter in front of the Scriptomancer :P Behind his back however it is all &nbsp;we do ;)
1453228107
The Aaron
Pro
API Scripter
Oh, you do it to my face PLENTY!! =D
1453237370
Alicia
Sheet Author
The Aaron said: Soon... =D I swear that's been said that for about a year now....
1454763422

Edited 1454763912
When I set an aura to zero, it doesn't show an aura until I click on the token, open it up and hit save. [QUOTE]Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your scripts and click the "Save Script" button and we'll attempt to start running them again. More info... For reference, the error message generated was: /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 ^ TypeError: Cannot call method 'substring' of undefined at eval ([/QUOTE] I get this error when typing !token-mod --help
1454764147
The Aaron
Pro
API Scripter
Hmmm. &nbsp;What version of TokenMod? &nbsp;Also, do you have any other scripts running? &nbsp;What is the command you used for the aura?
The latest version, I just updated.&nbsp; Scripts running are TokenTool, isGM, 5e-scripts/monsters/spells, TurnMarker. !token-mod --set aura1_radius|5 aura2_radius|0 --on showplayers_aura2 I used that command for the aura, help is still broken though.&nbsp;
1454768076
The Aaron
Pro
API Scripter
Try disabling the other scripts and see if it's still broken. &nbsp;I suspect 5e-scripts/monsters/spells might be throwing that error. &nbsp;The only place I call substring in TokenMod has to do with status markers and is protected against undefined. Did that aura command work?
The aura command works, but the 0 aura does not appear, even though it says 0 in the token when I open it. When I open it and save it the 0 aura appears. Disabling 5e does nothing. --- Restarting sandbox due to script changes... Spinning up new sandbox... "-=&gt; TokenMod v0.8.17 &lt;=- [Fri Jan 15 2016 12:47:47 GMT-0600 (CST)]" "-=&gt; TurnMarker v1.3.1 &lt;=- [Tue Oct 13 2015 08:17:46 GMT-0500 (CDT)]" /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 ^ TypeError: Cannot call method 'substring' of undefined at eval ( --- All I typed was !token-mod --help
1454776998
The Aaron
Pro
API Scripter
Ah. For the aura 0, try 0.000001. Setting to 0 via the API turns it off, but 0 in the UI makes it have 0 radius.&nbsp; Did it still give the crash with all other scripts disabled?
Yes, it still crashes as the sole one enabled. Your 0.000001 bandaid works.