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.

1438244820

Edited 1438261946
Ziechael
Forum Champion
Sheet Author
API Scripter
Greg B. said: 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. :) Of course i'll share, it's what Roll20 is all about =D This is what i've come up with so far (it's set to the vision system for 3.5 but could be tweaked for most systems, its also arranged in the most commonly used for my campaign): please note the html code for | is needed to set the radius since using a pure | would break the query !token-mod --set ?{Vision|Torch,light_radius|40 light_dimradius|20 light_hassight|yes light_losangle|360|Lantern,light_radius|30 light_dimradius|15 light_hassight|yes light_losangle|360|Bullseye Lantern,light_radius|120 light_dimradius|60 light_losangle|60 light_hassight|yes|Hooded Lantern,light_radius|60 light_dimradius|30 light_hassight|yes light_losangle|360|Sunrod,light_radius|60 light_dimradius|30 light_hassight|yes light_losangle|360|Candle,light_radius|5 light_dimradius|0 light_hassight|yes light_losangle|360|No light source,light_radius|10 light_dimradius|-10 light_hassight|yes light_losangle|360|Blinded,light_hassight|no light_losangle|360} It isn't quite perfect yet, i've yet to get the -10 for no light source to play nice, it just -10 from the current value rather than set the value to -10 and i can't seem to get it to do otherwise (Aaron?), also for some reason setting the line of sight angle to 360 just turns it off (Aaron?). Once those bugs are worked out i'll edit this post with the updated version... it's currently unusable due to the line of sight issue but i don't have any more time to spend on it right now :( Once i've got that figured i'll be building one to apply certain statuses easily, then some others for the features i use often, then shoving all of them into a menu using API buttons... adding that as a macro to my macro bar and my work will be complete ;)
1438258403
The Aaron
Pro
API Scripter
Yeah, known bugs those... Need to fix them...  
Ziechael said: Greg B. said: 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. :) Of course i'll share, it's what Roll20 is all about =D This is what i've come up with so far (it's set to the vision system for 3.5 but could be tweaked for most systems, its also arranged in the most commonly used for my campaign): please note the html coded | to set the radius since using a pure | would break the query !token-mod --set ?{Vision|Torch,light_radius|40 light_dimradius|20 light_hassight|yes light_losangle|360|Lantern,light_radius|30 light_dimradius|15 light_hassight|yes light_losangle|360|Bullseye Lantern,light_radius|120 light_dimradius|60 light_losangle|60 light_hassight|yes|Hooded Lantern,light_radius|60 light_dimradius|30 light_hassight|yes light_losangle|360|Sunrod,light_radius|60 light_dimradius|30 light_hassight|yes light_losangle|360|Candle,light_radius|5 light_dimradius|0 light_hassight|yes light_losangle|360|No light source,light_radius|10 light_dimradius|-10 light_hassight|yes light_losangle|360|Blinded,light_hassight|no light_losangle|360} It isn't quite perfect yet, i've yet to get the -10 for no light source to play nice, it just -10 from the current value rather than set the value to -10 and i can't seem to get it to do otherwise (Aaron?), also for some reason setting the line of sight angle to 360 just turns it off (Aaron?). Once those bugs are worked out i'll edit this post with the updated version... it's currently unusable due to the line of sight issue but i don't have any more time to spend on it right now :( Once i've got that figured i'll be building one to apply certain statuses easily, then some others for the features i use often, then shoving all of them into a menu using API buttons... adding that as a macro to my macro bar and my work will be complete ;) Nice! Glad to hear its moving along. :)
1438278990
Ziechael
Forum Champion
Sheet Author
API Scripter
The Aaron said: Yeah, known bugs those... Need to fix them...   Well if you will go off having fun at GenCon...! ;)
Lol
Hey The Aaron, I'm having trouble using the '--set represents' command. I'm trying to set up a set of macros that will toggle a set of tokens "represents" field to either the character they represent, or a "Null" character sheet (that no one controls, and therefore no one can see through the token).  The purpose is to toggle sight-lines on another window where I'm logged in as a player.  I'm trying to use Roll20 in an in-person setup, and I'd like to toggle between each player's token during their turn. Here's what I've got so far: !token-mod --ignore-selected --set represents|@{Jack|character_id} --ids|-Jvuyo2XIke0dX5Qz7re !token-mod --ignore-selected --set represents|@{Null|character_id} --ids|-JvuypCM82Lc5zCU1egb My intention with the above macro is that Jack's token is set to represent Jack's character sheet, while the other token on the map is set to the Null character sheet.  However, the macro appears to do nothing.
1438745435
The Aaron
Pro
API Scripter
The issue looks to be that --ids takes a white space delimited list, but you have a pipe (|) character in there. Try these: !token-mod --ignore-selected --set represents|@{Jack|character_id} --ids -Jvuyo2XIke0dX5Qz7re !token-mod --ignore-selected --set represents|@{Null|character_id} --ids -JvuypCM82Lc5zCU1egb Just a side note, ids are token specific by page, so the above will only work on those 2 specific tokens. Also, if you copy the Game or transmogrify the page, it likewise will not work. You should be fine otherwise. 
Hey The Aaron, I'm getting the following error in my API console. I don't know for sure if it's the TokenMod script, but I've only had TokenMod and isGM enabled for the past couple of months. I was hoping you might be able to make heads or tails of it? events.js:72   throw er; // Unhandled 'error' event      ^ Error: listen EADDRINUSE   at errnoException (net.js:904:11)   at Server._listen2 (net.js:1023:19)   at listen (net.js:1064:10)   at Server.listen (net.js:1132:5)   at Sandbox.start (/home/symbly/www/d20-api-server/sandcastle/lib/sandbox.js:35:15)   at Object.<anonymous> (/home/symbly/www/d20-api-server/sandcastle/bin/sandcastle.js:11:9)   at Module._compile (module.js:456:26)   at Object.Module._extensions..js (module.js:474:10)   at Module.load (module.js:356:32)   at Function.Module._load (module.js:312:12)   at Module._compile (module.js:456:26)   at Object.Module._extensions..js (module.js:474:10)   at Module.load (module.js:356:32)   at Function.Module._load (module.js:312:12)   at Module._compile (module.js:456:26)   at Object.Module._extensions..js (module.js:474:10)   at Module.load (module.js:356:32)   at Function.Module._load (module.js:312:12) I've actually been getting errors pretty often, although before the interface overhaul it was always just "unexpected token s". Any thoughts?
1439569418
The Aaron
Pro
API Scripter
This EADDRINUSE error is not related to the scripts directly, just like the unexpected token s problem.  I've brought it up to the devs and I'll mention it to them again now.  It seems to be some sort of resource contention inside the javascript sandbox they use to run the API scripts.  Some past cases of this have appeared to be double execution of scripts, but it's hard to say what is causing it now.
Hi, guys. Posted this originally in Specific Use questions, as it really isn't a TokenMod specific question, but was told I should probably post it here. I'm using TokenMod to set status markers for tokens for various states and loving that functionality. I've started to think of new things I can do since I've managed to standardize my markers by doing that, though, and wondered: is there a way to tell Roll20 to read token status markers, like you can tell it to read attributes from a character sheet? i.e. If I need to know whether a given token has "back-pain" set to "yes", is there a way to ask Roll20 for that, like you could ask it the value of a given character attribute? Basically this is what I'm thinking: Say I have a status effect called "Weakness" that gives -4 to attack. If I do that on the character sheet, I'd set up a field that can be Yes or No, with Yes being 1 and No being 0. Then, in my macro, I'd have a line like [[1d20-(@{target|Target1|Weakness}*4)]] or something along that line. But, that would require me to make an additional copy of the character journal entry for each copy of the character (in case of monsters I'm using copies of, like a few orc warriors). Otherwise, when I set Weakness on one, I'd set it on all. So, if I could instead make Weakness represented by a token status icon, such as back-pain, and have the macro read that...is there any way to have @{target...} or @{selected...} or some such read token status icons? (Or to do it another way?)
1439576691
The Aaron
Pro
API Scripter
There is not, sadly.  I've thought about writing a script that would keep track of the status markers on a character's token by adding attributes to the character to tell you if they had it, and what it's value is, but haven't done it for pretty much the reason you listed. Certainly, that information is available to scripts, and if you had some feature you thought would work well for doing this, we could probably write you a script that would use that information.  It could even act as a proof of concept for a suggestion.  (I'd vote for it!)
Dang! I've got a lot of things that I could use that for, but...don't want to make people write scripts just for me. If you want something for Proof of Concept, though--to prove that we could use the ability to do this with @{target...} and such, I guess? (I'm thinking just make it @{target|Target1|token_back-pain} would make sense.) Maybe we can come up with something--I'll PM you so I don't fill this thread with my jabbering. :-P
1439577298
The Aaron
Pro
API Scripter
Sounds good, looking forward to it. =D
On a semi-unrelated note...am I understanding properly that by setting players able to use ids in this script, I could make a player able to trigger an ability on their character that asks for a target, then sets a status marker on that target?
1439579028
The Aaron
Pro
API Scripter
Without "Players Can IDs", a player can adjust any token they have control of by selecting it.   !token-mod --set statusmarkers|blue:2 With "Players Can IDs", players can use the --ids parameter and supply one or more token_ids via !token-mod --set statusmarkers|blue:2 --ids @{target|token_id} This includes their tokens, other player's tokens, monster tokens, etc.  It is off by default because of allowing those changes on tokens the player can't explicitly control.  With it on though, your players can use TokenMod to heal other players, or add/remove status markers on monsters they affect, etc.  I make great use of it in the games I play in.  =D
I think I love you, man.
1439584512
The Aaron
Pro
API Scripter
Yeah, I get that a lot. =D
That worked, but I see what you mean about token_IDs being specific by page.  I got it working on one page, but when I copied the tokens to another page, their token_ids were different, and none of the macros worked.  *sigh*.
Ziechael said: ... for some reason setting the line of sight angle to 360 just turns it off ... I'm also working on a light macro w/API buttons, and ran into this - any progress on this after Gen Con?
1439808966
Ziechael
Forum Champion
Sheet Author
API Scripter
The Aaron July 30 (2 weeks ago) said: Yeah, known bugs those... Need to fix them...   It's almost as if he doesn't care about us at all... ;)
1439810908
The Aaron
Pro
API Scripter
Oww! No, I've been sick and lazy.  Btw, you can multi line TokenMod commands the same way you do power cards. 
1439839007

Edited 1439839107
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} might be useful for some, but I wanted to be able to add a value for some of my statuses. Just add this code to the end of Aaron's code above. Keep in mind with the status limitations it can only be a number ranging from 0-9 :?{Add a value?|0}
1439843090
The Aaron
Pro
API Scripter
Cool. :).  I'm pretty sure it will bound to the end, do putting 20 will get you 9. 
Robert M. said: i.e. If I need to know whether a given token has "back-pain" set to "yes", is there a way to ask Roll20 for that, like you could ask it the value of a given character attribute? Basically this is what I'm thinking: Say I have a status effect called "Weakness" that gives -4 to attack. If I do that on the character sheet, I'd set up a field that can be Yes or No, with Yes being 1 and No being 0. Then, in my macro, I'd have a line like [[1d20-(@{target|Target1|Weakness}*4)]] or something along that line. So, if I could instead make Weakness represented by a token status icon, such as back-pain, and have the macro read that...is there any way to have @{target...} or @{selected...} or some such read token status icons? (Or to do it another way?) @ Robert M - I am using the  conditions script to carry off this basic idea, and it works pretty well. You can create a set of conditions and assign values to them, adjusting character sheets and adding any icon markers to tokens. So for example, I have a condition called "Intoxicated," which applies a -2 Dex penalty to the character (It's stored and calculated, so the character's original stats remain in memory). It is also set to apply the |drink-me| icon to the token. I've got a macro to apply it and one to clear it. I believe you can add auras and the whole bit, so it is very flexible. There's a console you can use to list all the active conditions to review them. Very powerful. 
1440087359
DK Heinrich
Marketplace Creator
Sheet Author
first - can I reduce the number(s) on status markers globally with a command? (end of the round all status markers have duration reduces by 1) second - and if it reduces to 0 it removes the status marker?   my game system does not use initative (well not traditional method) so I cant use anything that triggers off the tracker starting a new round because we don't use the tracker
1440087949
The Aaron
Pro
API Scripter
Hmm.  You could certainly select everything and issue: !token-mod --set statusmarkers|blue:-1 There isn't automatic deletion of the status though. I intend to add better selection beyond --ids at some point, which would remove the necessity to have something selected.  I can also add semantics for removing the status when it gets to 0. In the interim, there isn't a more automated way of handling this that I know of.
1440088516
DK Heinrich
Marketplace Creator
Sheet Author
that should work for what I need I think, thanks! 
1440091028
DK Heinrich
Marketplace Creator
Sheet Author
!token-mod --ids @{target|token_id} --set statusmarkers|+?{Pick one|ASLEEP, sleepy|BLINDED, bleeding-eye|FATIGUED, back-pain}:?{Duration in Rounds?|6} trying to have the drop down menu show what the marker represents in game terms (ASLEEP, BLINDED, FATIGUED), and then call the actual name of the marker (sleepy, bleeding-eye, back-pain) into the macro. Target works, drop down works, duration works, no statusmarker pops up after marco runs. 
1440093056
The Aaron
Pro
API Scripter
Try it without the ! And see what comes up. You might need to take the space out after the ,
@ Robert M - I am using the  conditions script to carry off this basic idea, and it works pretty well. You can create a set of conditions and assign values to them, adjusting character sheets and adding any icon markers to tokens. So for example, I have a condition called "Intoxicated," which applies a -2 Dex penalty to the character (It's stored and calculated, so the character's original stats remain in memory). It is also set to apply the |drink-me| icon to the token. I've got a macro to apply it and one to clear it. I believe you can add auras and the whole bit, so it is very flexible. There's a console you can use to list all the active conditions to review them. Very powerful.  Hey, Chris--yeah, others have pointed me there. It does look very nice, but the concern I have is that if I'm understanding that correctly, that's still modifying journal entries / character sheets rather than tokens, which means that if I have, say, 5 orc soldiers, if I'm getting that correctly I'd need 5 orc soldier journal entries to make that work? The advantage of the token approach, if it ends up possible, is that you can run all identical enemies off of a single character entry in the journal. I tend to run a lot of large battles, with the characters up against waves of enemies, so this would be very valuable to me. Still, I will definitely take more of a look at the conditions script--in a pinch, I could always start making the player journals only contain handouts for the enemy data they're getting, so it's only my journal that gets clogged with lots of character entries.
1440095472
DK Heinrich
Marketplace Creator
Sheet Author
The Aaron said: Try it without the ! And see what comes up. You might need to take the space out after the , space removal did it, thanks! I thought about that but every drop down roll query that i have that works had the spaces so I left them in :(
1440097094
DK Heinrich
Marketplace Creator
Sheet Author
!token-mod --set statusmarkers|sleepy:-1|bleeding-eye:-1|broken-heart:-1|half-haze:-1|screaming:-1|broken-skull:-1|radioactive:-1|back-pain:-1|black-flag:-1|grab:-1|fishing-net:-1|aura:-1|skull:-1|interdirection:-1|snail:-1|lightning-helix:-1|spanner:-1|pummeled:-1 this does successfully reduce all statusmarkers by 1 for any and all tokens selected. However - it also adds a 'no-number' statusmarker for each one that is not already present on the selected token(s). example: BadGuy has bleeding-eye:4 and screaming:4 statusmarkers  -- hitting the above macro will drop those both to :3 and add no-number markers for the other 17 options in the list.  Is it currently possible to only lower the ones that exist?  Maybe this is something for the next iteration of token-mob... :)
1440099132
The Aaron
Pro
API Scripter
Token-mob, I like it. =D I was a little afraid that might happen.  I'll see if I can add a syntax to only change existing.
1440160845
DK Heinrich
Marketplace Creator
Sheet Author
nothing like typos that end up making some sense lol - and cool! I look forward to seeing what you come up with.
1440183885
vÍnce
Pro
Sheet Author
"Token-mob" is a script Aaron is releasing to coincide with Halloween.  You set a target token and then set one or more tokens as the "mob" that will advance toward the target token at a set rate each round.  Mob will advance on the target using the shortest path and circumvent barriers.  Great for zombie hords...
1440187085
The Aaron
Pro
API Scripter
That sounds awesome. That would be right up Stephen's ally...  He'd probably change the name to Smear-Vince though!  =D
1440235479
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Any time Vince's character dies, is a good time. I will get started on the right away!
1440643395
vÍnce
Pro
Sheet Author
I know you are a busy man(x100) Aaron, but any chance you can throw light_hassight_angle and light_hassight_multiplier in the next update?  Not even sure if the API has access to these yet...?  Thanks
1440643461
vÍnce
Pro
Sheet Author
Stephen S. said: Any time Vince's character dies, is a good time. I will get started on the right away! Is that "Incendiary" language I'm detecting?
1440660781
Ziechael
Forum Champion
Sheet Author
API Scripter
Vince said: I know you are a busy man(x100) Aaron, but any chance you can throw light_hassight_angle and light_hassight_multiplier in the next update?  Not even sure if the API has access to these yet...?  Thanks Not 100% sure but the hassight_angle is light_losangle ?
1440671450
vÍnce
Pro
Sheet Author
You're correct.  My bad Ziechael.   Strange though, I can get this to work; !token-mod --ids @{target|token_id} --set light_losangle|0 but not this !token-mod --ids @{target|token_id} --set light_losangle|360
1440673572
The Aaron
Pro
API Scripter
Vince said: You're correct.  My bad Ziechael.   Strange though, I can get this to work; !token-mod --ids @{target|token_id} --set light_losangle|0 but not this !token-mod --ids @{target|token_id} --set light_losangle|360 Yeah. Bug I need to fix there...
1440680143
DK Heinrich
Marketplace Creator
Sheet Author
The Aaron said: Token-mob, I like it. =D I was a little afraid that might happen.  I'll see if I can add a syntax to only change existing. just checking back on this to see where it is on the list of ten thousand things you have going :)
1440684346
The Aaron
Pro
API Scripter
I really need a better bug tracking solution...   Hopefully this weekend.
1440684601
The Aaron
Pro
API Scripter
I guess I'll embrace the GitHub issue tracker. <a href="https://github.com/shdwjk/Roll20API/issues/8" rel="nofollow">https://github.com/shdwjk/Roll20API/issues/8</a>
1440684737
The Aaron
Pro
API Scripter
Here's one for the losangle 360 bug: &nbsp; <a href="https://github.com/shdwjk/Roll20API/issues/9" rel="nofollow">https://github.com/shdwjk/Roll20API/issues/9</a>
What do we do with that?