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] TurnMarker1 - Turn Token Highlight, Round Counter, Player Advance Command, Turn Announce + spiny graphics if you want them!

1402808231

Edited 1473730350
The Aaron
Roll20 Production Team
API Scripter
Update v1.3.4 --&nbsp;GMs can now click the image in the announcement to be ping-pulled to the token in question. Update v1.3.2 &nbsp;-- TurnOrder now pops to the first character when notified of a turn change by GroupInitiative and displays the Player Turn Announce if you have that option enabled. (Thanks Lucian H. !) Update: v1.24 -- Fixed crash with custom turnorder entries when advancing the turn order with !eot. Update: v1.23 -- Fixed crash because of manually emptying the turnorder before closing it, Take 2! Update: v1.22 -- Fixed crash because of manually emptying the turnorder before closing it. Update: v1.21 -- Fixed crash in other scripts because of adding properties to the Array Prototype! Update: v1.20 -- Fixed startup crash in a brand new campaign due to turnorder being '' instead of []. Update: v1.19 -- Update checking for isGM in the on('ready',...). Update: v1.18 -- Added support to call Reset() on my Mark script if you're using it. Update: v1.17 -- Fixed crash bug when announce-player is on, but the token with the turn has no player controlling it. I started off using Honey Badger's Initiative highlight script [ <a href="https://app.roll20.net/forum/post/447239/script-hi" rel="nofollow">https://app.roll20.net/forum/post/447239/script-hi</a>... but wanted some different behavior. Along with requests and suggestions from Jarret B., it has grown into quite a bit of script. Features Automatic creation of marker token if not already present on the page. Scaling of marker to show up even under opaque square tokens. Marker follows token with current turn if moved. Automatic adding of Round marker to initiative order. Round announce in chat. [Optional] Announcement of tokens ending their turns and tokens beginning their turn. [Optional] Player name whose turn it is in turn announcement. [Optional] Automatic skipping of hidden token's turns. [Optional] Marker is hidden for hidden token's turns. (if not auto-skipped) Automatically hides the marker when the Turn Order box is closed. Turn marker animations [Optional] Spinning marker [Optional] Pulsing aura 1 on marker [Optional] Pulsing aura 2 on marker (different phase) [Optional] !eot command to advance the turn order, but only if the player controls the current token or is a GM. !tm command usable by GM only to configure TurnMarker. Git:&nbsp; <a href="https://github.com/shdwjk/Roll20API/blob/master/TurnMarker1/TurnMarker1.js" rel="nofollow">https://github.com/shdwjk/Roll20API/blob/master/TurnMarker1/TurnMarker1.js</a> Support my work on If you use my scripts, want to contribute, and have the spare bucks to do so , go right ahead. However, please don't feel like you must contribute just to use them! I'd much rather have happy Roll20 users armed with my scripts than people not using them out of some sense of shame. Use them and be happy, completely guilt-free! Disclaimer: This Patreon campaign is not affiliated with Roll20; as such, contributions are voluntary and Roll20 cannot provide support or refunds for contributions.
Great to see you posted it finally. Great script. I think it's the best initiative script.
Looks fantastic! Thanks
Wow looks intense. Gonna give it a roll. :)
I love it, I seem to have somehow killed the marker functionality. How do I make it pop up again?
1402858184
The Aaron
Roll20 Production Team
API Scripter
If you deleted the marker token, it should recreate it the next time you switch initiative, or when you close and reopen the turn tracker. If you closed the turn tracker and it went away, that's just because it moved to the upper left corner of the GM layer.
1402858244
The Aaron
Roll20 Production Team
API Scripter
Also, if you're just playing around with it and moved to a different page but didn't move the players to that page, it won't show up when you're advancing the turn order.
Haha, the latter seems to be the case here. I try to avoid moving the players around as I flit between pages because not everything is hidden/dynamically lit as it ought to be for player viewing. Thanks!
1402860668
The Aaron
Roll20 Production Team
API Scripter
Ha. I can't count the number of times I had that exact problem during development. I ended up adding log() statements all over to try and track it down and then felt like an idiot each time it turned out to be that behavior. Currently, the script respects the player page in the Campaign, but Jarret B. pointed out to me that if you split the party, you might want the token to show up on their page. I might look into refactoring the script a little and have the marker show up on that page for the players and creatures that are on that page, it might not even be that hard to do...
I'm trying to get the script to run but I get the following error message the moment anything in the Initiative changes. TypeError: Cannot call method 'get' of undefined at evalmachine.&lt;anonymous&gt;:529:32 at Function._.each._.forEach (/home/symbly/www/d20-api-server/sandcastle/node_modules/underscore/underscore.js:81:22) at Object.TurnMarker._HandleAnnounceTurnChange (evalmachine.&lt;anonymous&gt;:508:8) at Object.TurnMarker.TurnOrderChange (evalmachine.&lt;anonymous&gt;:617:15) at evalmachine.&lt;anonymous&gt;:675:16 at eval ( I got the isGMModule script installed and it seems to be running
1402874058
The Aaron
Roll20 Production Team
API Scripter
Hmm.. I'll assemble a debugging script and PM you in a little bit.
1402874390
Alex L.
Pro
Sheet Author
I highly recommend doing correct sanity checks on any object you try to get from the API, normally checking it is defined and has the get function is enough.
1402874822
The Aaron
Roll20 Production Team
API Scripter
Thanks Alex. Any specific locations you see where I missed that?
1402877332
The Aaron
Roll20 Production Team
API Scripter
Ok, I think I found the issue. I bet you have a custom marker in your initiative right after the round marker. Try the updated version and see if that fixes the issue for you? Sorry!
1402877450
The Aaron
Roll20 Production Team
API Scripter
On a side note Alex, what would good validation look like? var myObj = getObj('graphic',someID); if(undefined != myObj && _.has(myObj,'get')) { // use object safely } Look reasonable?
Any tips on how to change out the icon?
1402887290
The Aaron
Roll20 Production Team
API Scripter
I've got a version with commands for setting the token made for you, but I'm having some issues with it. There are problems when you create tokens with an image url that isn't in a personal library and the image library seems to have issues right now. In the interim, you can edit the script and change the tokenURL (line 24) to the url of a token in your library, then change the version number (line 8) to force it to reset the state.
Aaron C. M. said: Ok, I think I found the issue. I bet you have a custom marker in your initiative right after the round marker. Try the updated version and see if that fixes the issue for you? Sorry! Well, it seems to fix the issue, thank you! However, no, I did not have any custom markers in the initiative at all. I hat in fact emptied it out and then added 4 tokens to it. That's it. But I noticed something else odd. Not sure it's a bug, but it's weird behavior: - have a few tokens on it, and be in Round &gt;0, let's say 5. - I empty the turncounter with the "Remove all turns (Clear List)" option. It will now automatically, almost instantly re-add the Round counter, and leave it under the last person who's turn it was. If I close the turn counter and re-open it again, it will have moved the token to the GM layer and upper left corner, and keep it there. However that seems like a weird behavior. What I'd expect to happen is: - List is cleared and utterly empty (not a single item on it) - Token is moved to GM layer and upper left corner. - Token is reset to Round 0 automatically (this one can be an option, but I don't see why anyone would clear the entire list mid-combat) - Token is NOT automaticaly re-added until there's at least one other token on there again. Actually Round might start at 1, otherwise I get this behavior: - I clear list. Token gets added again. (either immediately like it is now, or after first token, like mentioned above doesn't matter) - Reset token. - add icons - sort list - Token is now last, due to -1 initiative, and at Round 0. So it will announce Round 1 is starting, once Round 1 is over. Alright, that might actually be wanted like that, so Round 0 is the Surprise Round in D&D type games, but to me it feels unintuitive. I can easily imagine "Round 1 is the surprise round if it applies" instead of having to go once through the entire turnorder thing to start. Two ways I can see how to "fix" this: - start with Round 1. - Start with Round 0, but an initiative of 99 or 999 instead of -1 or so. What happens with the second option: - player gets added - token gets added after (assuming the change from above that it won't be added till then) - more players get added with their initiative, supposedly below 100 (value could be changed somewhere I guess) - List is sorted - Round token is sorted to 1st position, triggers a round update from 0 to 1 and announces that Round 1 is starting. I'm sorry, long text, and I hope what I was trying to say makes sense. If anything is unclear, let me know.
1402898734
The Aaron
Roll20 Production Team
API Scripter
All good thoughts. :) I think you're right about the round starting at 1. Also, I like your suggestion regarding not adding the marker unless there is already another turn on the turn order. I'll try your scenario with removing all and see what I can do about that. Thanks for trying it out!
Every time it reaches the round counter it bugs out and just dosen't pass it or increase the round count. Meaning I usally delete the tokem from the iniative, just before it reaches it's turn. Here's the error that occurs. Do you know what causes this exactly? TypeError: Cannot call method 'get' of undefined at evalmachine.&lt;anonymous&gt;:815:73 at eval (
1403527111
The Aaron
Roll20 Production Team
API Scripter
Hmm. I can't tell from that error. What do you have in the turn order?
Ah I figured out what I was doing wrong, forgot to use the !eot command and did it manually instead. I'll keep that in mind from now on. This works perfectly now and now I'm just trying to figure out what background colour would be best, instead of purple. If it's possible to change the color of course. Thanks though anyway.
1403534683
The Aaron
Roll20 Production Team
API Scripter
You should be able to advance the turn as normal. The !eot is just a convenience function to allow players to advance as well. The error you posted indicates there is some object I'm getting and using without checking that it's valid. I'll try and find that and fix it. (You don't happen to be using an older version of the script, do you? I fixed a few of those bugs once already). As for color, it's certainly changeable, but there isn't currently an interface for doing that. I'll add one!
THis is on 1.16. Well essentially looking at what'#s happening on it, it reaches the round token at the bottom of the list, at -1 and just errors out once it reaches itself doesn't pass it, doesn't increase the round and unless I reactivate it, it won't work anymore. !eot stops this from happening atleast so I can work it as intended, I'll get a screenshot of the error occurring soon. An option for color would be a addition too I feel. Keep up the good work.
1403544875

Edited 1403544945
" Marker follows token with current turn if moved. " Is there a way to have turn off the box moving with the player whose turn it is???? The main reason I use this is to show where the player started their turn!!!
Or have a separate box with a different color for where the player started???
1403546678
The Aaron
Roll20 Production Team
API Scripter
Interesting! There isn't a setting for this, but you can comment out line 592: on("change:graphic", function(obj,prev) { // TurnMarker.CheckForTokenMove(obj); }); As for toggling that, or marking where the current token started, that's definitely doable. I'll add it to my enhancements list. =D
1403546812
The Aaron
Roll20 Production Team
API Scripter
Incidentally, as long as the tokens move in a single action, you can highlight them and hit 'space' to see their path from source to destination (and waypoints if they hit 'space' between begin and end to mark them).
Aaron said: Incidentally, as long as the tokens move in a single action, you can highlight them and hit 'space' to see their path from source to destination (and waypoints if they hit 'space' between begin and end to mark them). I'm familiar with that, but right, it has that restriction. Sometimes players move multiple times, sometimes use arrow keys, etc. The box solves my age old problem of "where did I start this turn from? Do I have any movement left???"
1403547488
The Aaron
Roll20 Production Team
API Scripter
Yeah, totally get it. I have one player who is legally blind, so I can see how that would be useful.
Tried it. Loved it. It shall join my script family for rpgs. :)
1403694350
The Aaron
Roll20 Production Team
API Scripter
Great!!
@Aaron - really nice script! I also really like Bryan K.'s idea about having a configuration that shows where someone started from. There are times where players move, then decide they would have rather moved a different way and "forget" where they started from :).
1403697046

Edited 1403710572
Alex L.
Pro
Sheet Author
First off really great script, as i have now started using it i went through and added a few more sanity checks to prevent things like crashing if there are no objects in the turn order when called, I have put my changes in a fork feel free to copy them orver if you want. gist.github.com/pigalot/b8ec216aff2bcfc42416
1403699647
The Aaron
Roll20 Production Team
API Scripter
@Kevin - thanks! I'm going to work on that soon, hopefully over the weekend. @Alex - Awesome! I appreciate the benefit of your experience! I'll pull in your changes this weekend!
1404219531

Edited 1404219569
Really love this script but having the strange problem of it breaking the carry tokens script when I use it. TypeError: Object function (count) { var len = this.length &gt;&gt;&gt; 0, count = count &gt;&gt; 0; unshift.apply(this, splice.call(this, count % len, len)); return this; } has no method 'set' at evalmachine.:1646:21 at eval ( Carry token script works fine if I disable the Turnmarker script so something between the two of them isnt playing nice. Does anyone have thoughts as to what? If it helps the error gets thrown when I move a token that is carrying something. The act of adding a token to be carried seems to work fine. <a href="https://app.roll20.net/forum/post/201089/script-carrying-tokens#post-221845" rel="nofollow">https://app.roll20.net/forum/post/201089/script-carrying-tokens#post-221845</a>
1404238995

Edited 1404239021
The Aaron
Roll20 Production Team
API Scripter
Weird. I'll install that script and try it out. I've got some mods to add, and Alex pointed out a few bugs fixes I need to roll in. I'll try to fix this bug too! The fact at it is on move implies it has to do with the call back to cause the highlight to follow the token with the current turn. If you have a minute and some JS savvy, you could try commenting out line 592 (see post above: Disabling Marker follows Token Moves. ) and see if that prevents the error. That would at least be a good data point in the search for a fix.
1404241364

Edited 1406069646
The Aaron
Roll20 Production Team
API Scripter
Ok, the problem when used with that CarryTokens script has to do with the method that Stephen L. is using to traverse the members of the carry array. In javascript the for( property in object ) method of traversing an object iterates not only over the object's properties, but the properties of it's prototype as well. This meant it was getting objects (like rotation ) that didn't have a set() method, and threw an exception. For convenience, I add a method to the Array Prototype which allows rotation of an array. This greatly simplifies treating an array like a ring list, as the turn order does. The proper way to iterate an array is to use for ( var idx=0; idx &lt; array.length; ++idx). (I'm not just saying that, I just read it in Javascript: The Good Parts by Douglas Crockford!) I've modified his script to iterate in this manner, and added my check for isGM() to it (since I know you have that installed and I think it's much more convenient than expecting the user to modify the script with that data). I'll PM Stephen and tell him what I ran across. Here's my modified version of Stephen L.'s Carry Token Script: <a href="https://gist.github.com/shdwjk/48370c09788e11263d3" rel="nofollow">https://gist.github.com/shdwjk/48370c09788e11263d3</a>...
Thanks Aaron! That has fixed it, one thing though I had to remove an extra } from the line below /** Do the carrying logic when the carrier tokens move. */ on("change:graphic", function(obj, prev) {}
1404244814
The Aaron
Roll20 Production Team
API Scripter
Updated! I hate editors that insert closing } for you. =D
1404244855
The Aaron
Roll20 Production Team
API Scripter
It would be nice to have a version of this script that has a !ride command and puts characters on a horse or other mount. =D
Or even better !ride summons a companion to bang coconut shells together :)
1404253964
The Aaron
Roll20 Production Team
API Scripter
I think that would be !coconut, or perhaps !porter. =D
1404255770

Edited 1404257145
OK. So, I'm having a little trouble. I'm practicing it on my entire party and when everyone puts in their initiative, round 1 is automatically skipped and it goes right into round 2. Any fix around that? edit 3: Lol...now it starts at -1 and does round 0 first. I tried putting in "Round 1" on the initiative turn table and still no dice... edit 4: Looks like the round 0/round 1 has been discussed before. Any way around this fix without having to do end turn until round 1?
1404260045
The Aaron
Roll20 Production Team
API Scripter
You can select the marker token, and set the blue bubble to the round you want. I'm going to get a better interface for that soon. =D
1404260093
The Aaron
Roll20 Production Team
API Scripter
Let me know if you need help with anything else!
1404260252

Edited 1404260428
Are you talking about where people can manually put in their initiatives (that number)? If so, I've tried doing that but it's the actual word where it says: "Round 0" which then changes to "Round 1". Can't change the actual name of it. :\ (BTW, the script otherwise is freaking amazing) edit: I found out that if I click on "Descending -&gt; Ascending -&gt; Descending" it will actually go to the correct round. However, it does spam the chat a few times.
1404260992
The Aaron
Roll20 Production Team
API Scripter
No, I'm talking about the blue bubble that represents the blue bar on the orange round token.
Sorry...I'm really stupid. :\ The blue bubble that is next to the blue and green one, right? Do I manually put in "1" and then just +1, etc? Again, so sorry for the stupid questions. ;\
1404263171
The Aaron
Roll20 Production Team
API Scripter
No worries. =D Note that I have the orange token selected, not the player. You can change this to any number you like, just like with other tokens. So +1 it if you want a 1, or -3 it if you're on 4 and want 1. The display in the Turn Order will update when it's next turn comes up, and then everything will be in sync. I hope that helps. Thanks for using my script and let me know if you have any more questions. Worst case, I'll be happy to jump into one of your games and give you an in person tutorial. =D
Excellent, thanks much. It worked. Just an FYI, I don't know if it's just me or if it's supposed to happen...but, the green bubble goes in increments of 1 all the way to 300 and then resets back down to 1. Very, very fast.