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

[Request] API for Status Markers on Tokens?

1451509361

Edited 1451509408
Hi, I'm just trying to get an API script working to place a status marker on a token (Note, not a character). I've tried using ones like the Conditions API, which suited my needs until I'd realized it required for tokens to have characters. The reason why this doesn't work is because some of the enemies in the game I'm trying to run are just generic orcs/minotaurs etc of different types, and I don't want to have to create a new character for every single generic NPC. The way that the system I have works is that we use macros for classes through a shared character that people can place on their macro bars, so I'm looking for something that would also allow people to just apply the status markers through these macros. I'm currently also using a script that automates damage on the selected target. With Conditions the way I have it set up right now is something like this: /e has used Frostover! They deal rolled damage to the target and have applied Chilled, making them unable to move more than three squares. Next turn they can use Shatter and deal additional damage without consuming their turn. (2 turn CD) !alter @{target|token_id} h -d40 !condition apply Chilled -c @{target|token_id} Is it at all possible to make a script that does something similar? We don't really need a turn tracking thing or anything too complex, just something that I can add into the macro lines that will allow Status Markers to show up and be removed when lines go off. Conditions is almost perfect to what we were looking for, though its requirement for a character is what is holding us back.
1451511064
vÍnce
Pro
Sheet Author
I would recommend Aaron's  TokenMod  script. example; !token-mod --set statusmarkers|!white-tower
Vince said: I would recommend Aaron's  TokenMod  script. example; !token-mod --set statusmarkers|!white-tower Yep that works perfectly, thank you!
1451670730
The Aaron
Pro
API Scripter
Great!  I'll just add for clarity if anyone hits this thread: This would toggle the 'Rook' piece on and off on the targeted token. !token-mod --set statusmarkers|!white-tower --ids @{target|token_id} In order for players to be able to do this, you have to turn on the setting in the TokenMod help (!token-mod --help) for "Players can IDs" (or run the command: !token-mod --config players-can-ids ). The ! on the front of the status marker is what makes it toggle.  You can just add the marker if it's not there by prepending a + to it (which is the default if you have no symbol prepended): !token-mod --set statusmarkers|+white-tower --ids @{target|token_id} Or just remove it if it's there with a prepended - : !token-mod --set statusmarkers|-white-tower --ids @{target|token_id} Additionally, you can add the digits 1-9 to it by putting :# after it: !token-mod --set statusmarkers|white-tower:3 --ids @{target|token_id} Or increment/decrement that number by prepending + or - to the number: !token-mod --set statusmarkers|white-tower:+1 --ids @{target|token_id} If you prepend a ? to the status while incrementing/decrementing a number, it will only change the marker if it is already present (and will remove it if it gets to 0): !token-mod --set statusmarkers|?white-tower:-1 --ids @{target|token_id} By adding brackets to a status marker, you can have more than one copy present.  This adds a 'Rook' piece with the number 3 on it.: !token-mod --set statusmarkers|white-tower[]:3 --ids @{target|token_id} This adjusted the second 'Rook' piece by +4: !token-mod --set statusmarkers|white-tower[2]:+4 --ids @{target|token_id} Ping me if you need any help!  =D
1451935495
vÍnce
Pro
Sheet Author
TokenMod needs it's own book Aaron. Maybe "TokenMod Visually" or better yet, "TokenMod: The Good Parts".  ;-P
1451935711
The Aaron
Pro
API Scripter
It comes pre-packaged with it's own book, accessible by: !token-mod --help =D
1451935908
vÍnce
Pro
Sheet Author
True that.
Vince said: TokenMod needs it's own book Aaron. Maybe "TokenMod Visually" or better yet, "TokenMod: The Good Parts".  ;-P Unlike Javascript, there are no bad parts to Tokenmod.  So the second title would be a misleading.
1451966340
The Aaron
Pro
API Scripter
Ha!  I can think of a few, but I'm probably the most critical of it. =D
The Aaron said: In order for players to be able to do this, you have to turn on the setting in the TokenMod help (!token-mod --help) for "Players can IDs" (or run the command: !token-mod --config players-can-ids ). I've been playing around with this, forgive the absolute noob question, but I only have to run the above command once, correct? Or, do I need to put it in the macro? Case in point, I'm writing a macro (copying mostly) for a player's ranger to Hunter's Mark (and unset) a token with the archery target. My code; !token-mod --set statusmarkers|!archery-target --ids @{target|Target 1|token_id} I also want to have global macros for players and me to set status markers for D&D 5E conditions such as poisoned, grappled, etc. I figured the above macro for each status marker I want to use for each condition, just change the archery target to one of the other marker names. Come to think of it, would a Roll Query work? This is awesome, BTW.
The Aaron said: It comes pre-packaged with it's own book, accessible by: !token-mod --help =D +1
1452004272
The Aaron
Pro
API Scripter
Doug E. said: The Aaron said: In order for players to be able to do this, you have to turn on the setting in the TokenMod help (!token-mod --help) for "Players can IDs" (or run the command: !token-mod --config players-can-ids ). I've been playing around with this, forgive the absolute noob question, but I only have to run the above command once, correct? Or, do I need to put it in the macro? Case in point, I'm writing a macro (copying mostly) for a player's ranger to Hunter's Mark (and unset) a token with the archery target. My code; !token-mod --set statusmarkers|!archery-target --ids @{target|Target 1|token_id} I also want to have global macros for players and me to set status markers for D&D 5E conditions such as poisoned, grappled, etc. I figured the above macro for each status marker I want to use for each condition, just change the archery target to one of the other marker names. Come to think of it, would a Roll Query work? This is awesome, BTW. You only need to set that once, it will be preserved in the state.  That's almost exactly the same as the command I use for hunter's mark. =D You can definitely use a Roll Query to specify the statuses: !token-mod --set statusmarkers|!?{Status:|Hunter's Mark,archery-target|Bless,angel-outfit} --ids @{target|Target 1|token_id} You may find it useful to use the alternate divider (#) for TokenMod when using Roll Queries: !token-mod --set statusmarkers|!?{Status:|Hunter's Mark,archery-target|Bless,angel-outfit#blue:4} --ids @{target|Target 1|token_id} In the above, Bless assigns both the angle-outfit and the blue marker with a 4 on it to remind players to add 1d4 to their rolls. =D
Awesome!
1452039155

Edited 1452046791
Here is what I came up with for setting/unsetting status markers on tokens based on 5E conditions, using Aaron's sage advice and Tokenmod script. It is a global macro, as token action, available to players. Feel free to use, change, share, etc. It will be interesting to see my player's feedback on this. !token-mod --set statusmarkers|!?{Status:|Blinded,bleeding-eye|Charmed,chained-heart|Deafened,screaming|Frightened,half-heart|Grappled,fishing-net|Incapacitated,broken-skull|Invisible,aura|Paralyzed,frozen-orb|Pertrified,interdiction|Poisoned,skull|Prone,back-pain|Restrained,cobweb|Stunned,pummeled|Unconscious,sleepy}
1452046915
The Aaron
Pro
API Scripter
Cool!  =D
1452068481

Edited 1452068562
Any chance you can use TokenMod along with cron to set conditions? ie: !token-mod --set statusmarkers|sleepy:3 --ids @{target|token_id} !cron -i 1 "!token-mod --set statusmarkers|?sleepy:-1 --ids @{target|token_id}" Was having trouble getting this idea to work properly (counting down the TokenMod applied sleepy timer by -1 every round.
1452087781
The Aaron
Pro
API Scripter
I've not used !cron before, I should probably try it out.  Maybe Manvetti will jump in here and talk about it...
After lots of digging, it's sounding like API calls can't make additional API calls to other scripts... ie, a PowerCards Macro triggering a TokenMod call?
1452106816

Edited 1452107210
Nosaj said: After lots of digging, it's sounding like API calls can't make additional API calls to other scripts... ie, a PowerCards Macro triggering a TokenMod call? Correct... the api cannot trigger additional api commands via sendChat. However, if you alter the scripts a little and the scripts are set up properly, you can send information from one to another. I have set up powercards so that you can send information to it via PowerCards.Process(obj, player_obj) (or something like that) so that you can write your own script to do whatever funky math or processing you want to do and then output the info to PowerCards to send it to chat. I do not know if TokenMod is capable of having info sent to it from another script. Even if it was, it would require PowerCards having a way to send that info to TokenMod somehow.
Ahh yes... was really hoping to use PowerCards for sexy formatting and conditional checking (attack roll was greater than target's will so they are now slowed) and then fire off some kind of API call for putting a marker on that target, and then... have a script handle the round to round checks on whether that effect wore off or a player or creature was rolling a new save. However, I saw in another thread you can manually use the # keys when mousing over marker icons in roll20 to sort of do your own tracking, though, so maybe just manually doing that would be the way to go for now.
1452153385

Edited 1452153437
You could looking into nesting API Command Buttons (which contain TokenMod commands) within PowerCards conditional tags.
Reviving this post for a question. Do you think it's at all possible to make a sort of turn tick down for the status marking with tokemod? At the moment I've got a set up like this: /em has used Light's Aegis! Their target does half damage on their next attack. !alter @{selected|token_id} e 1 !alter @{target|token_id} h -1d10+5 !token-mod --set statusmarkers|back-pain:1 --ids @{selected|token_id} This'll do the following for me: The casting token (in this case a paladin) gains one to their energy bar. The token being attacked will take rolled as health damage Then token mod comes in The token then gets a marker on them that indicates the reduced attack damage so the DM knows. The only problem is that we use token markers pretty liberally, so with all the tokens about people sometimes forget to set the marker down a number for the DM. Is it possible to run a check through these markers that once a certain character has gone on the turn order (we use groups to keep track of people's turns) it'd set the marker down a number? Example being: back-pain set on Orc is, for this example, at 3. Once the turn begins for Group 1, the marker sets to 2. Group 2 goes, still at 2, Group 3 goes, still at 2. Enemy turn comes, still at 2. Group one goes again, now it's at 1. When it reaches 0 the marker gets removed. Is something like this possible? Or would that require editing of the code?
1456865298
The Aaron
Pro
API Scripter
This would require editing the code, or more specifically a new set of code.  Why don't you start a new thread where we can discuss what you want to do and I'll see about teasing out requirements.  I'm swamped with some changes to the way I deploy API scripts and a few other things, but we have some great new blood here writing scripts and this sounds like something that would be right up their alley.  (Or perhaps I can knock it out pretty quickly...)
Hey Aaron, I've been picking through your code and copying some of it for my personal script, but I can't sort out how you're actually setting status markers on tokens. I was going to log the mods being set on the token so I could get a better idea, but all of a sudden there's a script error (and I tried with a fresh copy of TokenMod to make sure I hadn't messed something up). How do you get the markers set/unset in the script? Or is that more complicated than a forum response? If need be, I can try to wire my script into TokenMod, but I haven't read about how to make the scripts interact yet. Thanks in advance for any help.
1457416125
The Aaron
Pro
API Scripter
It's a little complicated, but you might find these two functions I put in the wiki simplify it greatly...&nbsp; <a href="https://wiki.roll20.net/API:Cookbook#statusmarkers" rel="nofollow">https://wiki.roll20.net/API:Cookbook#statusmarkers</a>...
Awesome, I'll check it out. Thanks again.