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.

Thank you very much for your time that works great.
1460718498
The Aaron
Pro
API Scripter
No problem, happy rolling!
1460852322

Edited 1460852375
Hi, I'd like to modify the statusmarker values. But operations are not working properly for me. I'm using this macro !token-mod {{ --set statusmarkers|bolt-shield:+2 --ids @{selected|token_id} }} but it doesn't add 2 to the statusmarker, but other ¿random? numbers. This is the results I'm getting depending on the nº of execution of the macro and the status of the marker in the first place: Statusmarker at the beginning 1st execution 2nd execution 3rd execution Not visible or 0 4 8 9 1 5 9 9 2 6 9 9 3 7 9 9
1460853617
The Aaron
Pro
API Scripter
9 is the maximum value so adding to it at that point won't go any higher.  Aside from that, I notice it's adding 4 each time.  Is it possible you're running it twice without realizing it?  It should eliminate duplicate token_ids (it does for --ids) but it's possible it's getting the id you're passing in (for the selected token) and also using the selected token (which it does by default). Try leaving off the --ids argument: !token-mod {{ --set statusmarkers|bolt-shield:+2 }} or telling it to ignore the selected token: !token-mod {{ --set statusmarkers|bolt-shield:+2 --ids @{selected|token_id} --ignore-selected }}
It must be that! I run it once for sure. And now it works with both codes you posted. Thank you!
1460857375
The Aaron
Pro
API Scripter
Sweet!  I'll be sure to check that the ids are unique across selected and --ids in a future version. Happy Rolling!
1462137552

Edited 1462139566
Silly question, would there be an easyway to add a pre-written JSON to the GMnotes of a token? or in fact anything to the gmnotes
1462140068
The Aaron
Pro
API Scripter
Interesting question.  There isn't currently a way to use TokenMod to set GMNotes entries.  Certainly, specifying the data would be challenging.  (The easiest would be to base64 encode it, but that has other problems.)  I could see adding a method to append a string, or possibly detect that there is a block following within multiline {{ }} specifiers.  What use case are you considering?  It might be easier to just write another script with that special purpose.
with the new its a trap, i was going to be lazy.  add json to gmnotes via a query, add cobweb and bleeding eye, move to the gmlayer all with one easy macro
This question is related to the the "World Map Discovery" script available in the API.  I apologize in advance if this seems to be a basic question but I looked through all ten pages of the forums and did not see an answer.  I am a first time DM on Roll20 and am running a "practice" campaign for my users.  I would like to take advantage of the API installed script but do not understand the instructions completely.  I understand that I have to set the properties of "white tower status" and the aura radius but am not sure how exactly do so and how to confirm that the status is set correctly so that my players can "discover" the locations on the world map.  Any greater clarification that you can provide would be greatly appreciated.  Thank you so much for your help and work on these scripts!!!!
1463315892
The Aaron
Pro
API Scripter
Hi x01853, If you haven't seen it, here's the original post about that script:&nbsp; <a href="https://app.roll20.net/forum/post/2391505/slug" rel="nofollow">https://app.roll20.net/forum/post/2391505/slug</a>} If you want to use TokenMod to setup a token for discovery, it would be something like this: !token-mod --set statusmarkers|white-tower aura1_radius|?{radius|10} layer|gmlayer (I'll check that a bit later as I'm on my phone, but that should be pretty close)
The Aaron - The link you provided was perfect.&nbsp; I had seen that forum before but not realized that clicking on the picture provided and animated walk through. Everything is up and working perfectly at this point.&nbsp; Thank you so much for your help!
1463357533
The Aaron
Pro
API Scripter
No problem! &nbsp;Definitely feel free to ping me if you have any other problems. =D
1463893741
Andrew R.
Pro
Sheet Author
Following on from the thread about handling Invisibility, could TokenMod help with setting the list of players who can control a MOOK token? I suspect the answer is no.&nbsp;
1463933041
The Aaron
Pro
API Scripter
I haven't implemented setting the controlled by yet. &nbsp;It hadn't come up and has some slight difficulty because it's not something you can reference easily like @{target|token_id}. &nbsp;I could probably do some sort of matching on the name of the player similar to how I've matched character names in other scripts. &nbsp; Do you think that would be useful?
1463936324
Andrew R.
Pro
Sheet Author
I went and wrote myself Token_Init and Token_Mook scripts so that's the only manual step left. I don't really need it, but it would be more useful for those in the position of the original Invisibility question.&nbsp;
1463936460
The Aaron
Pro
API Scripter
Fair enough. &nbsp;I'll try and get that wrapped in soon, though that will likely be july or later because of my impending move.
Great news on including "controlled by" in token mod. This will simplify the face-to-face shared monitor vision sharing and individual views discussed in another thread.
Really loving the flexibility this provides, especially since I have a character that toggles on and off certain markers and auras regularly.&nbsp; Two questions, though: 1) I have a pair of NPCs that are being played as sharing a single HP pool.&nbsp; I can select them manually each time, but it'd be great if there were a way to get their token ID by their character name.&nbsp; Am I just completely missing this ability? 2) For the status markers, prefacing a marker with ? makes it disappear when it reaches 0... but what about making it appear when it gets set to 1+? Great script, thanks again regardless.&nbsp; ^^
1467737261
The Aaron
Pro
API Scripter
Hi, sorry for the delay, busy summer and all.. 1) &nbsp;I'm not completely sure what you are asking, but if you want to get the token_id fro a particular token, you could do something like this: /w gm @{target|token_id} Note that tokens and their IDs are unique to a particular page, so depending on what you want to do, you might not get satisfactory results. 2) Hmmm... I don't think I've considered that case. &nbsp;It would be something like: !token-mod --set statusmarkers|?blue:+[[1]] And if blue isn't on, it would turn it on? &nbsp;Does that not work already?
1) &nbsp;I'm not completely sure what you are asking, but if you want to get the token_id fro a particular token, you could do something like this: 2) Hmmm... I don't think I've considered that case. &nbsp;It would be something like: And if blue isn't on, it would turn it on? &nbsp;Does that not work already? 1 - No, the @target commands work great, I'm looking to not have to target them every single time.&nbsp; I'd like to make a macro like: !token-mod --ids @{character_name|token_id} --set bar1_value|?{Whatever} Rather than having to indicate who I'm using by either selecting them ahead of time, or indicating them with a click after starting the macro. 2 - It's actually not, so far as I could tell.&nbsp; It was removing the token just fine, but I couldn't get it to show it when it was hidden.
1468112924

Edited 1468112951
You could use @{target|token_id} on the Token, copy the Token ID from the Text Chat, and then replace the Attribute calls with the IDs. (This would only work for that Token, as each Token has a unique ID.)
1468241292
The Aaron
Pro
API Scripter
I see what you're saying @Aquaricat. &nbsp;I think the best thing would be if I added an argument for character ids, which would then find all tokens matching that ID and apply the same change to all of them. With #2 above, I'll take a look at expanding ? to work in that way.
Is it possible to edit character Attribute values with this macro. I don't think it does, but maybe I didnt look hard enough. SO if I want to have a macro that sets up Bar values and a bunch of sheet attributes, can this do that? Or is there another that will do it? &nbsp;Ta.
1468846414
Jakob
Sheet Author
API Scripter
Kevin Flynn said: Is it possible to edit character Attribute values with this macro. I don't think it does, but maybe I didnt look hard enough. SO if I want to have a macro that sets up Bar values and a bunch of sheet attributes, can this do that? Or is there another that will do it? &nbsp;Ta. I've written a (very very basic) script that allows you to modify a character's attributes via API commands (quite flexibly). I'll share it on this forum once it's ready and mostly bug-free. TokenMod can set up your bars and all kinds of other token properties for you, but it won't edit your sheet's attributes.
1468849917
The Aaron
Pro
API Scripter
Kevin Flynn said: Is it possible to edit character Attribute values with this macro. I don't think it does, but maybe I didnt look hard enough. SO if I want to have a macro that sets up Bar values and a bunch of sheet attributes, can this do that? Or is there another that will do it? &nbsp;Ta. As Jakob pointed out, there isn't a way to do that with TokenMod. &nbsp; I have a snippet I threw together that should let you do it though, see&nbsp; GroupSetAttr .
@The Aaron …&nbsp;is there a way to add something to the GM notes of a token via token-mod ? I'm using a macro in combination with token-mod and it's a trap to quickly set up traps "on the fly". The macro puts together the needed JSON string and sends it as a string to the GM in the chat. Unfortunately, all inline rolls are executed when whispering, so I as a workaround I leave the square brackets open/incomplete. Then I copy the string manually into the GM notes, fix the brackets and the trap is set. But that isn't really elegant. In a perfect world, I'd drop a trap token on the GM layer, run the script, fill in all the parameters that the macro asks for, and end up with a ready-set trap in an instant. Any chance that this will make it into a future version of token-mod ?
1472237598
The Aaron
Pro
API Scripter
hmm.. it doesn't currently, but there's no reason it couldn't in a future version. I'll try to add that at some point.
The Aaron said: hmm.. it doesn't currently, but there's no reason it couldn't in a future version. I'll try to add that at some point. Ah, that would be sweet. :)
1473808653

Edited 1473808680
Hi The Aaron, I'd like to combine your TokenMod with some script for automatic temp hp management . I tried two scripts; Eric D.'s and DamnedMage's . They work well when I subtract HP manually from token, but ignore the HP subtraction when TokenMod does it. I suppose the on("change:token",... of temp hp's script doesn't detect the change made by TokenMod. Or does it late. It would be great to have both working, is there any chance for me to do something?
1473809660
The Aaron
Pro
API Scripter
You surmise correctly. &nbsp;Changes by the API do not cause events for other API scripts. &nbsp;Such things can be done manually in the code. &nbsp;I I don't have enough time to do it right now (moving 2 weeks from tomorrow), but after I get where I'm going (around the first week of October) I'll be diving back into my backlog of things and can likely get you a solution. &nbsp;If you're Javascript savvy and feel like taking a stab, feel free to PM me and I can give you some pointers and examples. &nbsp;=D
Thank you The Aaron, I'll PM you :)
1475364844
Tetsuo
Forum Champion
Can this be used to set the GM notes for a token?
1475377446
The Aaron
Pro
API Scripter
Not currently, but it's on my list to add this functionality. It will require a bit of thought and rewrite to the command parser as the needs of setting freeform/longform text are quite different than the other settings on a token.
1475458606

Edited 1475459473
Hello,&nbsp; I am attempting to switch showing nameplates on and off using the flip command but it does not work. !token-mod --ids @{selected|token_id} --flip showname I have&nbsp;showplayers_name on, and have tried these and they worked:&nbsp; !token-mod --ids @{selected|token_id} --on showname &nbsp; &nbsp;&&nbsp;!token-mod --ids @{selected|token_id} --off showname Not sure what is wrong - thank you for any suggestions edit #1: &nbsp;interestingly this does work:&nbsp; !token-mod --ids @{target|1|token_id} @{target|2|token_id} @{target|3|token_id} --flip showname showplayers_name
1475493770
The Aaron
Pro
API Scripter
TokenMod adds the Token IDs of selected tokens automatically. &nbsp;Because of the way it's setup, it processes the selected IDs in one batch and the specified (--ids) IDs in another. &nbsp;For each batch, it removes duplicates. &nbsp;What is happening is, you effectively are flipping it twice; once as part of the selected set and once as part of the specified (--ids) set. &nbsp;I'll add this to my bug list to fix very soon. &nbsp;In the interim, you can use one of these to get the desired effect: !token-mod --flip showname !token-mod --ids @{selected|token_id} --flip showname --ignore-selected &nbsp;Happy Rolling!
1478727439
The Aaron
Pro
API Scripter
New Thread with Updates!: &nbsp;<a href="https://app.roll20.net/forum/post/4225825/script-update-tokenmod-an-interface-to-adjusting-properties-of-a-token-from-a-macro-or-the-chat-area/?pageforid=4225825#post-4225825" rel="nofollow">https://app.roll20.net/forum/post/4225825/script-update-tokenmod-an-interface-to-adjusting-properties-of-a-token-from-a-macro-or-the-chat-area/?pageforid=4225825#post-4225825</a>