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.

1435521453
Alicia
Sheet Author
I'm finally getting around to playing with this and I can't seem to get the bar link function working: After selecting the tokens I want to link (they have a character ID assigned already), I ran this !token-mod --set bar1_link|npc-reflex bar2_link|npc-dt bar3_link|HP HP links fine, but I'm wondering if maybe the attributes with the dashes in them just aren't being supported by the API and thus aren't recognized? Also, I wonder if it's because they're values from auto-calculated fields since HP is one that gets filled in. Just don't know enough to understand why it isn't working... BTW . is there a way to get the help box come up in chat that I see in the post before this?
1435543460
The Aaron
Pro
API Scripter
It likely is because they are auto call fields. Mark pointed out how to work around that to me but I need to come back around and test it. Most, if not all of my scripts support the --help parameter to show that box for them: !token-mod --help
1435640519
Pat
Pro
API Scripter
Hi Aaron, Can TokenMod jam text into the GM Notes? I don't see it a called out, so I'm guessing this is an enhancement request for your backlog. :) Thanks for this awesome utility! Pat
1435670821
The Aaron
Pro
API Scripter
hmm... Seem to have missed that one... have to think about how I might do that since it's a block of text rather than a single bit of data.
You can copypaste into the pop ups that ask you to input something. Type !token-mod -gmnotepaste then ti could pop up, an idea anyway
1435678316
The Aaron
Pro
API Scripter
Yeah, the Dice Query syntax would need to be handed on the client side, but it's a valid point. I'm thinking more along the lines of multi line support with the {{ }} as well as operations like concatenation with what's already there (append and prepend) and possible find/replace. The uses people put the notes section to are usually different than a simple field, at least for tokens. (Character attributes are a whole other story...)
1435690334
Alicia
Sheet Author
The Aaron said: It likely is because they are auto call fields. Mark pointed out how to work around that to me but I need to come back around and test it. Most, if not all of my scripts support the --help parameter to show that box for them: !token-mod --help I hope to see support for this soon! I know you're busy though with other things, but being able to use all Attributes just makes sense.
1435691595
The Aaron
Pro
API Scripter
Yeah, I agree. I'll try to look at it very soon. =D
1435723284
Pat
Pro
API Scripter
Hi Aaron, The parser doesn't seem to support calls to rollable tables. This works: !token-mod --set name|[[d4!]] This doesn't: !token-mod --set name|[[1t[Chaotic-Features]]] I tried quotes and no quotes. Can't seem to find a combo that works. Any suggestions? Thanks, Pat.
1435723923
The Aaron
Pro
API Scripter
Ah, I bet I know the issue. Should be an easy fix once I've got a bottle in this baby...
1435728521
The Aaron
Pro
API Scripter
Update v0.8.8 -- Added expansion of Rollable Tables. You can now specify rollable tables in places you would use text: !token-mod --set name|"[[ 1t[ClueNames] ]]" Be sure to put " " around the call if you have multi word results. (Thanks Pat!)
1435728595
The Aaron
Pro
API Scripter
Alicia G said: I hope to see support for this soon! I know you're busy though with other things, but being able to use all Attributes just makes sense. I tried to get this into v0.8.8, but its going to take a bit of experimentation so I had to wait. Sorry for the delay. =/
1435744624
Alicia
Sheet Author
The Aaron said: Alicia G said: I hope to see support for this soon! I know you're busy though with other things, but being able to use all Attributes just makes sense. I tried to get this into v0.8.8, but its going to take a bit of experimentation so I had to wait. Sorry for the delay. =/ Thanks for the update! I appreciate you taking the time to look into it.
1435808862
Pat
Pro
API Scripter
Thanks for the quick fix to support Rollable Tables Aaron. Works like a charm. Pat.
1435843428
The Aaron
Pro
API Scripter
No problem! =D
1437244409
vÍnce
Pro
Sheet Author
Good day Aaron. Are there any plans to include a toggle for Has Sight / Angle / Multiplier? Is this even accessible to the API? Thanks
1437248712
Ziechael
Forum Champion
Sheet Author
API Scripter
Hi Vince, try light_hassight - boolean light_angle or light_losangle - degrees Not sure about the multiplier though... its all in the slightly blurred help section in the OP
1437250328
vÍnce
Pro
Sheet Author
I did a search on the thread for "has sight"... foolish me. Thank you Ziechael, I will try that when I get home. Cheers
1437261546
Ziechael
Forum Champion
Sheet Author
API Scripter
No problem, i have fallen prey to that exact issue before now myself lol
1437403546
The Aaron
Pro
API Scripter
Thanks for covering for me Z! I was out camping (in 98º weather!?!?!). You can always access a list of options in the help... =D !token-mod --help
1437409303
Ziechael
Forum Champion
Sheet Author
API Scripter
98 degrees... that's almost the boiling point of water =O how did you survive!! Also, no problem, it's the least i can do for all the hassle you put up with from me ;)
1437410937
The Aaron
Pro
API Scripter
Sorry, I should have specified 98° F for you internationals... =D
1437426305

Edited 1437426333
I've been getting an "Unexpected token s" error with this script, mind helping me out Aaron please? x.x
1437428784
vÍnce
Pro
Sheet Author
Benson Y. said: I've been getting an "Unexpected token s" error with this script, mind helping me out Aaron please? x.x Is this the only script you are using Benson? Unfortunately, the dreaded "Unexpected token s" error is rampant among nearly all users of the API. Usually you can simply "save" the script and all is well. Some think it may have something to do with how all the scripts are combined when you load the campaign or possibly collateral damage from a security update that still hasn't been traced.
1437429016
The Aaron
Pro
API Scripter
What Vince said. =D
Any info on when light_angle and light_losangle will be able to be set/reset to 360º :) Then this: will be completely functional !!!
1437434668
vÍnce
Pro
Sheet Author
oooooooooooooh. That's so much nicer than my DM token full of ability macros.
1437434833
The Aaron
Pro
API Scripter
OOOH! That's spectacular! Will do it tonight!
Vince said: oooooooooooooh. That's so much nicer than my DM token full of ability macros. Right, mine too. Would love that code!
1437439307
vÍnce
Pro
Sheet Author
I'm thinking this is all we need to make the cool buttons... <a href="https://app.roll20.net/forum/post/1708283/#post-17" rel="nofollow">https://app.roll20.net/forum/post/1708283/#post-17</a>...
I got my info here. The inspiration for a chat box menu from this&nbsp; video . Also, a LOT of advice in these forums via The Aaron! Here are the codes using the 5e character sheet default template and the !token-mod script. /w gm &{template:5eDefault} {{title=Token Modifications}} {{freetext=**Vision** [On](!token-mod --on showname light_hassight) [Off](!token-mod --off light_hassight) [90°](!token-mod --set light_losangle|90) [120°](!token-mod --set light_losangle|120) [180°](!token-mod --set light_losangle|180) [360°](!token-mod --set light_losangle|360) **Infravision** [30'](!token-mod --set light_radius|30 light_dimradius|15 aura1_radius|30 aura1_color|) [60'](!token-mod --set light_radius|60 light_dimradius|30 aura1_radius|60 aura1_color|) [90'](!token-mod --set light_radius|90 light_dimradius|45 aura1_radius|90 aura1_color|) [120'](!token-mod --set light_radius|120 light_dimradius|60 aura1_radius|120 aura1_color|) **Directional Adjustments** [Flip-V](!token-mod --flip flipv) [Flip-H](!token-mod --flip fliph) **Layer** [GM](!token-mod --set layer|gmlayer) [Token](!token-mod --set layer|objects) [Map](!token-mod --set layer|map) [DL](!token-mod --set layer|walls) }} /w gm &{template:5eDefault} {{title=Light Sources and Direction}} {{freetext=**Source of Light** [Candle](!token-mod --set light_otherplayers|yes light_radius|5 light_dimradius|2.5 aura1_radius| aura2_radius| aura1_color|) [Torch](!token-mod --set light_otherplayers|yes light_radius|15 light_dimradius|10 aura1_radius| aura2_radius| aura1_color|) [Lantern](!token-mod --set light_otherplayers|yes light_radius|30 light_dimradius|15 aura1_radius| aura2_radius| aura1_color|) [Light](!token-mod --set light_otherplayers|yes light_radius|30 light_dimradius|30 aura1_radius| aura2_radius| aura1_color|) [Continual Light](!token-mod --set light_otherplayers|yes light_radius|60 light_dimradius|60 aura1_radius| aura2_radius| aura1_color|) [Campfire](!token-mod --set light_otherplayers|yes light_radius|35 light_dimradius|17.5 aura1_radius| aura2_radius| aura1_color|) [Bonfire](!token-mod --set light_otherplayers|yes light_radius|50 light_dimradius|25 aura1_radius| aura2_radius| aura1_color|) **Direction of light projection** [30°](!token-mod --set light_angle|30) [90°](!token-mod --set light_angle|90) [120°](!token-mod --set light_angle|120) [180°](!token-mod --set light_angle|180) [360°](!token-mod --set light_angle|359) **Other functions** [LightsOut](!token-mod --set light_radius| light_dimradius| aura1_radius| aura2_radius|) }}
I wanted to have buttons that would have a query for filling/updating each one of the three bars/bubbles, but could not get it to work other than when you first initiate the macro. I read that you could do this, but it may be due to me having it in a whispered template.
OldSchoolChris, that's awesome! ^^ I'm a huge fan of macros and playing with the character sheet, I'll come back here and show off what I got in a bit. ^^ Aaron though, is there a command to turn off all status markers on a token?
1437443665
The Aaron
Pro
API Scripter
Yup. Basically, you have to set a single status then remove it: !token-mod --set statusmarkers|=blue|-blue
Sweet, thanks, thought I had to do that. xP Also, this isn't a common request but there's currently no way to modify the GM Notes of a token at this time right? I'm currently using the Way Point Patrolling API (which probably needs an update xP) and it uses the GM Notes to specify speed and the path and other items such as that. If there was a way I could modify that via this or perhaps find a new script for patrolling tokens, that would be awesome as well. <a href="https://app.roll20.net/forum/post/615410/script-way-point-patrolling" rel="nofollow">https://app.roll20.net/forum/post/615410/script-way-point-patrolling</a>
1437446295
vÍnce
Pro
Sheet Author
Thanks for sharing OldSchoolChris. You to Aaron. ;-P
1437448688
The Aaron
Pro
API Scripter
yup. I'll try to get this change out in the morning or early tomorrow. Very, very tired. =/
No problem man, get some sleep. xD Night!
Vince said: I'm thinking this is all we need to make the cool buttons... <a href="https://app.roll20.net/forum/post/1708283/#post-17" rel="nofollow">https://app.roll20.net/forum/post/1708283/#post-17</a>... If I am reading the above thread correctly, those create buttons in handouts?
1437503167
The Aaron
Pro
API Scripter
Correct. &nbsp;You'd need an api script to add them in, I believe, but you might be able to type the commands in a URL for a link and get basically the same effect.
Is the command there for inputting to GM Notes? I didn't see it
1437845866
The Aaron
Pro
API Scripter
It is not. &nbsp;Since that tends to be a multiline thing, I had left it off. &nbsp;I can think of a few ways to approach adding it, I'll probably look into doing that as soon as I finish up the CharMod script. &nbsp;I'll likely rewrite TokenMod with some of the things I've developed from CharMod.
1437938033
The Aaron
Pro
API Scripter
Update v0.8.9 -- Added the argument --ignore-selected which allows writing macros that won't change any tokens that happen to be selected. !token-mod --ignore-selected --set statusmarkers|red:3 --ids -Jny0PfbtztLnCQv4M5y This is most useful when you are using hidden tokens as a backing store for state information (time, rounds, money, etc). (Thanks OldSchoolChris!)
1438044356
The Aaron
Pro
API Scripter
Using the new Roll Query Dropbox Option: !token-mod --ids @{target|token_id} --set statusmarkers|+?{Status|red|blue|green|brown|purple|pink|yellow|dead|skull|sleepy|half-heart|half-haze|interdiction|snail|lightning-helix|spanner|chained-heart|chemical-bolt|death-zone|drink-me|edge-crack|ninja-mask|stopwatch|fishing-net|overdrive|strong|fist|padlock|three-leaves|fluffy-wing|pummeled|tread|arrowed|aura|back-pain|black-flag|bleeding-eye|bolt-shield|broken-heart|cobweb|broken-shield|flying-flag|radioactive|trophy|broken-skull|frozen-orb|rolling-bomb|white-tower|grab|screaming|grenade|sentry-gun|all-for-one|angel-outfit|archery-target}
+1
The Aaron said: Using the new Roll Query Dropbox Option: !token-mod --ids @{target|token_id} --set statusmarkers|+?{Status|red|blue|green|brown|purple|pink|yellow|dead|skull|sleepy|half-heart|half-haze|interdiction|snail|lightning-helix|spanner|chained-heart|chemical-bolt|death-zone|drink-me|edge-crack|ninja-mask|stopwatch|fishing-net|overdrive|strong|fist|padlock|three-leaves|fluffy-wing|pummeled|tread|arrowed|aura|back-pain|black-flag|bleeding-eye|bolt-shield|broken-heart|cobweb|broken-shield|flying-flag|radioactive|trophy|broken-skull|frozen-orb|rolling-bomb|white-tower|grab|screaming|grenade|sentry-gun|all-for-one|angel-outfit|archery-target} Cool!&nbsp; Will that work with multiple selected tokens?
1438054476
The Aaron
Pro
API Scripter
No, the @{target} will cause the selected tokens to be ignored. &nbsp;But you can omit the --ids part. !token-mod --set statusmarkers|+?{Status|red|blue|green|brown|purple|pink|yellow|dead|skull|sleepy|half-heart|half-haze|interdiction|snail|lightning-helix|spanner|chained-heart|chemical-bolt|death-zone|drink-me|edge-crack|ninja-mask|stopwatch|fishing-net|overdrive|strong|fist|padlock|three-leaves|fluffy-wing|pummeled|tread|arrowed|aura|back-pain|black-flag|bleeding-eye|bolt-shield|broken-heart|cobweb|broken-shield|flying-flag|radioactive|trophy|broken-skull|frozen-orb|rolling-bomb|white-tower|grab|screaming|grenade|sentry-gun|all-for-one|angel-outfit|archery-target} If you use ! instead of +, you get a dialog that will toggle: !token-mod --set statusmarkers| ! ?{Status|red|blue|green|brown|purple|pink|yellow|dead|skull|sleepy|half-heart|half-haze|interdiction|snail|lightning-helix|spanner|chained-heart|chemical-bolt|death-zone|drink-me|edge-crack|ninja-mask|stopwatch|fishing-net|overdrive|strong|fist|padlock|three-leaves|fluffy-wing|pummeled|tread|arrowed|aura|back-pain|black-flag|bleeding-eye|bolt-shield|broken-heart|cobweb|broken-shield|flying-flag|radioactive|trophy|broken-skull|frozen-orb|rolling-bomb|white-tower|grab|screaming|grenade|sentry-gun|all-for-one|angel-outfit|archery-target}
1438069154
Ziechael
Forum Champion
Sheet Author
API Scripter
Gives me a great idea for some easily applicable settings for my players, coupled with OldSchoolChris' API button menu this is certainly going to reduce my day-job output for today ;)
Ziechael said: Gives me a great idea for some easily applicable settings for my players, coupled with OldSchoolChris' API button menu this is certainly going to reduce my day-job output for today ;) LOL! I think you're going to beat me to it Ziechael, but I hope you'll share. :)