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

[script] Custom status markers

1442019766

Edited 1484335266
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Here is a script that allows you to draw custom status markers to put on tokens. Here it is from the Roll20 API script repo, with the most up-to-date documentation: <a href="https://github.com/Roll20/roll20-api-scripts/tree/" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/tree/</a>... It is also available from the One-Click installer. Demo: Since this thread has been closed for a while, if you experience any issues using this script, feel free to PM me about it. When you describe your issue to me in your PM, please include the output from your API console, a list of steps to reproduce the issue, and a list of other API scripts you are running. If you have suggestions on how the script can be enhanced, feel free to PM me about that too.
1442026302
The Aaron
Pro
API Scripter
Clever!
Clever script! had hoped it would use images as well though.
1442077620
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Support for image-based status markers sounds like a good addition to the script. I'll see about adding that in soon for a version 1.1 release.
1442094688
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Version 1.1 released (currently just on my fork). It now supports Graphic-based status markers.
1442117014
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Version 1.2: Added '!listMarkers' command, which lists all the saved custom status markers for the campaign. Fixed some image bugs for Graphic-based status markers.
Awesome! As a note though, doesn't do well pulling images from the Roll20 database (Which most things don't seem to do). Though things from online. Perfect.
1442152924
Ada L.
Marketplace Creator
Sheet Author
API Scripter
It's not going to pull from the Roll20 database unless those graphics are uploaded in your graphics library. See:&nbsp;<a href="https://wiki.roll20.net/API:Objects#imgsrc_and_avatar_property_restrictions" rel="nofollow">https://wiki.roll20.net/API:Objects#imgsrc_and_avatar_property_restrictions</a>
1442192966
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
NICE!
1442250727

Edited 1442251168
DK Heinrich
Marketplace Creator
Sheet Author
getting an error when I try to use the link provided to get Path Math, and getting an error with the script (assuming because I dont have Path math installed). (From Custom status markers Error): (GM) (GM) bad command: !setMarker asleep edit: trying to use an image (it is in my personal roll20 library). have image on my map, have it selected, type the above, and get that error.&nbsp;
1442270408
Ada L.
Marketplace Creator
Sheet Author
API Scripter
DK: Yes, you're getting the error because you don't have the Path Math script installed. The README seems to have a bad link in it. Here's a working link to the Path Math script: <a href="https://github.com/Roll20/roll20-api-scripts/tree/master/PathMath" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/tree/master/PathMath</a>
This is way cool! I'm an API newbie, so maybe&nbsp;I am missing something obvious: How do I delete saved markers?
1442284729
Ada L.
Marketplace Creator
Sheet Author
API Scripter
There currently isn't a delete marker command. You can however overwrite markers by using the same name.
1442319871

Edited 1442319934
DK Heinrich
Marketplace Creator
Sheet Author
Thanks Stephen, I will screw around with it today :) And then I will make my request to have this and !token-mod work together somehow lol
1442320654

Edited 1442321922
DK Heinrich
Marketplace Creator
Sheet Author
"ERROR: Please use the 'thumb' size for imgsrc properties." not sure how to do this, maybe I am still tired.&nbsp; I have the image in my library drag it from library to VTT set to 'as drawing' (seems logical, get error if I do this or not) click on it type !saveMarker asleep get message that it is saved correctly check the !listMarkers and it exists click on token type !setMarker asleep... get error above.&nbsp;
1442322254
The Aaron
Pro
API Scripter
Line 402 gets the imgsrc from the selected image. &nbsp;The API can only create thumb versions of the images, but the UI will create versions at different scales. &nbsp;Trying to use those imgsrc URLs directly leads to the above error. &nbsp;I wrote a function that cleans the imgsrc: <a href="https://wiki.roll20.net/API:Cookbook#getCleanImgsr" rel="nofollow">https://wiki.roll20.net/API:Cookbook#getCleanImgsr</a>... It, or something like it can be incorporated into that script to fix this problem. In the interim, try copying the image on the VTT and using the copy. &nbsp;I believe the VTT always uses the thumb size for copied tokens, so it should work.
1442323752
DK Heinrich
Marketplace Creator
Sheet Author
the copy of the image works like a charm. Thanks again good sir.
I really like this script.&nbsp; I have a lot of Roll20's Cookbook stuff (that The Aaron linked) in a Cookbook script that I use.&nbsp; So for me it was changing Line 402 to use Cookbook.getCleanImgsrc. I did notice that once the API restarts, the images are all detached from the tokens though which is kind of a pain.&nbsp; I was thinking of doing an on load function that would clean up and reattach based on the tokens on the map.&nbsp; My thinking was to use this would be to just use the GM notes on the object that is created to associate it with a token...and then loop through those.&nbsp; Though, if someone else is already working on this or has a better way.... :)
1442461497
The Aaron
Pro
API Scripter
That is because the script stores them as a property of the Token Object in the API. &nbsp;However, on restart of the API, that object is recreated without that property and the property is not persisted. &nbsp;Really, the mapping should be written into the state object.
Thanks!&nbsp; The state object makes a lot of sense, I just kind of hack around right now so knowing that as a "best practice"&nbsp;and having now read the wiki on it&nbsp;really helps.
1442680368

Edited 1442680757
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Update: v1.3 (currently only on&nbsp; my fork ) Added !delMarker {statusName} command for deleting saved custom status markers. The idea for using the state object to track status markers on tokens sounds good. So I'll try to include that in the next update. While doing some testing, I encountered a problem that can arise if there are too many saved status tokens: there seems to be a size limit for setting the 'notes' field of handouts. I might try to get around this by persisting status marker templates in the state instead of in a handout.Of course, I will provide a command to transfer v1.3- status markers in the new state store.
1442696891
The Aaron
Pro
API Scripter
Interesting. &nbsp;There is a limit on the size of the state as well. &nbsp;If you run into problems with that, I have a few ideas on how you could store them to get around those issues. &nbsp;=D
1442697121
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
State. Aaron wore me down on State.... so the preaching of the converted is "state."&nbsp;
1442714935

Edited 1442716461
Ada L.
Marketplace Creator
Sheet Author
API Scripter
I was thinking of making multiple handouts to store the status data in to get around the character limit on notes, but then the Journal tab would end up cluttered with status token handouts (since the API doesn't currently allow creation/manipulation of handout folders). Edit:&nbsp; I just had another idea. What limits are there on the number of Attributes a Character can have? I'm thinking that a Character and a set of Attributes could possibly be used as a store of status markers. The name of these attributes would be some function of the name for the status, and the value would just be the status marker's JSON definition.
1442725415
The Aaron
Pro
API Scripter
Yeah, that was my idea too. State should be sufficient though.&nbsp;
1442746540

Edited 1442746657
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Stephen L. said: I was thinking of making multiple handouts to store the status data in to get around the character limit on notes, but then the Journal tab would end up cluttered with status token handouts (since the API doesn't currently allow creation/manipulation of handout folders). Edit:&nbsp; I just had another idea. What limits are there on the number of Attributes a Character can have? I'm thinking that a Character and a set of Attributes could possibly be used as a store of status markers. The name of these attributes would be some function of the name for the status, and the value would just be the status marker's JSON definition. I have been down these sorts of paths before....&nbsp; I think you will be better served and better future-proofed with state. You can set up one state object &nbsp;that is used to store all the defined custom status (even create an export to share between "games.") And one that tracks which which token has which custom status active. I resisted state for long long long long time..... but even a broken clock (due to improper winding) like Aaron.... is right twice a day. PS: This script is a really great idea... great Idea... can't say that enough. I just think state will let you take it all the way.
1442751078
The Aaron
Pro
API Scripter
Stephen S. said: &nbsp;but even a broken clock (due to improper winding) like Aaron.... is right twice a day. Unless it's one of those rare 24-hour analog clocks, then it's only right once a day. =D &nbsp; Have you ever considered that many kids growing up today probably don't understand that expression? &nbsp;"When it's broken, none of the little numbers show up?" &nbsp;=D
This is an error i'm getting nodejs: ../src/node_object_wrap.h:60: static T* node::ObjectWrap::Unwrap(v8::Handle&lt;v8::object&gt;) [with T = node::Buffer]: Assertion `!handle.IsEmpty()' failed. &lt;/v8::object&gt;
1442885280
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Sorry, but that error tells me nothing useful. Explain the context under which you encountered the error.
1443305903

Edited 1443306155
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Version 1.4 is out! The script now tracks its token data and persists its saved marker templates using the 'state'. There is also a new !clearMarkersState command for clearing the module's state. Markers created using the old system will be automatically transferred to the new system. Also included in this update is a small collection of pre-made status markers I've drawn for my games. Please feel free to use them! These changes are currently only on my fork.
Love the script! But... is there any way to use your custom status icons with a script that manages and tracks your status' like this?&nbsp;<a href="https://wiki.roll20.net/Script:Initiative_Tracker" rel="nofollow">https://wiki.roll20.net/Script:Initiative_Tracker</a>
1443835827
Ada L.
Marketplace Creator
Sheet Author
API Scripter
That is beyond the scope of this script's job to provide the ability to create and set markers for custom statuses. However, the script also exposes an API to several of its functions through a CustomStatusMarkers object. This could be used to extend it in another script to create this sort of functionality. ;)
Praise the Sun it's Finally a thing! Custom status effects have been asked for since status effects were introduced, and while I'm quite enjoying things like dynamic lighting and the transmogrifier, this is feels like something I'll use day to day In game rather then only during game prep. It seems like a simple to use work around, though my players will just have to deal with my poor drawing skills. From myself and my players to you, Thank You very much!
1444224529
Natha
KS Backer
Sheet Author
API Scripter
Excellent. (not usefull response/post, but enthusiastic :) )
1444275466
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Zenofire, if you need some good icons, you can find several at&nbsp; game-icons.net . ;)