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!

My thanks Aaron. Thank you for the help and aid. I can once more use your script! :)
1409065362
The Aaron
Roll20 Production Team
API Scripter
No problem! Let me know if you need anything else. =D
1409114356
Pat
Pro
API Scripter
Hi Aaron, Did you ever get around to adding the ability to pause the script between rounds like we discussed back on July 4th in this thread? If so, can you tell me which rev it went in? I'm thinking that maybe it slipped past me in the midst of all your other awesome changes. :) Thanks, Pat.
1409146809
The Aaron
Roll20 Production Team
API Scripter
Hi Pat, I'm still working on version 2, which should have that feature. In the interim, you can comment out line 355 and the script will pause on the turn marker: // TurnOrder.Next(); Let me know if that works for you. --aaron
Finally had time to test the updated version and got it working. It works really nice and is super useful. Thank you very much Aaron!
1409846568
The Aaron
Roll20 Production Team
API Scripter
No worries. I have 80% of a rewrite that is EVEN BETTER. =D Hopefully I'll wrap it up this weekend.
Ohhh, that sounds interesting =)
1409938776
The Aaron
Roll20 Production Team
API Scripter
;)
Not sure if others want it or if Aaron plans to make it an optional feature, but I have modified mine to center the screen on the unit at the top of the initiative.
1409948312
The Aaron
Roll20 Production Team
API Scripter
definitely a good optional feature. I'll add it to my list. Especially if it can only be targeted to specific players!
1409952428
Melanie P.
Marketplace Creator
I love this script but I can't seem to make the token marker work on any map except the starting "splash" screen. Admittedly I am a complete noob and I probably haven't tried everything, but I have tried toggling on and off the various settings... the extent of my ability to troubleshoot. What else can I do to fix it? Thanks :)
1409974806
The Aaron
Roll20 Production Team
API Scripter
Are the players on the other page? If their ribbon is on a different page, and the tokens that are in the initiative order on on another page, it's not going to show up on the page the GM is on.
1410190100

Edited 1410190245
I guess I was too eager to give compliments. I'm using it in a proper campaign but I have no other API scripts in that either. After the first combat where it worked it broke and now I'm getting this info in the sandbox: Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your scripts and click the "Save Script" button and we'll attempt to start running them again. More info... For reference, the error message generated was: TypeError: Cannot read property 'id' of undefined at Object.TurnMarker.CheckForTokenMove (evalmachine.<anonymous>:366:11) at evalmachine.<anonymous>:661:12 at eval ( I haven't had the chance to test if the problem reoccurs since I don't know how to enable the script.
1410192950
The Aaron
Roll20 Production Team
API Scripter
I'll publish a fix for that today. I believe it only happens when you clear the turn order box. I ran into the same issue Thursday night and made a fix for it, but need to test it still. If you trash people from the turn order instead of using the clear function, I shouldn't happen. Fix incoming and sorry it broke for you!
1410903546

Edited 1410903577
Paul S.
Sheet Author
API Scripter
Hey Aaron, Noticed weird behavoir with the tracker. When I closed and reopened the tracker, even after !tm reset, it would automatically send "Round 1" to the chat and index to Round 2. This without any turns being added - happened as soon as I opened the initiative tracker. Modified the code a bit to work around this (so now it sends "Round 0" to chat and indexes to "Round 1"). Below is the code section and my fix. _HandleMarkerTurn: function(){ var marker = TurnMarker.GetMarker(); var turnOrder = TurnOrder.Get(); if(turnOrder[0].id == marker.id) { var round=parseInt(marker.get('bar2_value'))+0; var round1=round+1 marker.set({ name: state.TurnMarker.tokenName+' '+round, bar2_value: round1 }); TurnMarker._AnnounceRound(round); TurnOrder.Next(); } },
1410903766

Edited 1410904071
Paul S.
Sheet Author
API Scripter
I also added the following at the bottom of the script (borrowed from the other Initiative Tracker) so that a macro can be used to auto-sort the initiative and another macro can be used to clear the initiative (!startInit , !clearInit). Perhaps you'll find it useful for your script as well? (I tried setting these up as cases which would be more elegant, but was having difficulty and left them separate). on("chat:message", function(msg) { if(msg.type == "api" && msg.content.indexOf("!clearInit") != -1) { var turnorder = []; Campaign().set("turnorder", JSON.stringify(turnorder)); var marker = TurnMarker.GetMarker(); marker.set({ name: state.TurnMarker.tokenName+' '+1, bar2_value: 1 }); } } ); function sortJSON(data, key, way) { return data.sort(function(a, b) { var x = a[key]; var y = b[key]; if (way === '123' ) { return ((x < y) ? -1 : ((x > y) ? 1 : 0)); } if (way === '321') { return ((x > y) ? -1 : ((x < y) ? 1 : 0)); } }); } on("chat:message", function(msg) { if(msg.type == "api" && msg.content.indexOf("!startInit") != -1) { var turnorder; if(Campaign().get("turnorder") == "") turnorder = []; //NOTE: We check to make sure that the turnorder isn't just an empty string first. If it is treat it like an empty array. else turnorder = JSON.parse(Campaign().get("turnorder")); //log (turnorder); var turnOrderSorted = []; turnOrderSorted = sortJSON(turnorder,'pr', '321'); var orderFinal = turnOrderSorted; Campaign().set("turnorder", JSON.stringify(orderFinal)); } } );
1410918881
The Aaron
Roll20 Production Team
API Scripter
Hey Paul, Thanks! I've got a fix for the Round 1/Round 0 thing in my new version, but I'll check through yours and see if I've missed any tricks. I'll have to look into adding the sorting as well. =D
1411704932
The Aaron
Roll20 Production Team
API Scripter
Updated to v1.22 - fixed crash with manually emptying the turnorder.
V 1.221 - No Movement tracking (stays where token started turn) <a href="https://gist.github.com/anonymous/2e33d1946a364f09" rel="nofollow">https://gist.github.com/anonymous/2e33d1946a364f09</a>...
1411754638
The Aaron
Roll20 Production Team
API Scripter
You should just fork mine directly, then you can pull updates automatically. =D
1412534230

Edited 1412538452
Will
Pro
Aaron, First of all, let me say how much I love your scripts and appreciate all the effort that you put into them. Secondly, I have encountered an issue with this script, and I was wondering if you could help with it. While playing, the group finished a combat encounter and I cleared the initiative list like I always do then reset the turn, and then closed the window. When I did this, the turnmarker icon disappeared completely from the map and I can't get it back. When I reopen the turn list, and the turn order automatically advances 2 turns in the chat window, but no icon appears. It also crashes the API randomly too. The script is almost completely broken on this map, and it is only on this map that it has errors, I can reset the API and load up previous maps and the icon is in its normal place and the script works fine. I have tried disabling the script, completely deleting the script and reinstalling, but to no avail. Any assistance you could offer would be fantastic. Here is a list of scripts I am running: isGM, Automatic Status Markers, TurnMarker Script, 4e Power Cards, MarkStatus Manager, D&D 4e Monster Importer, D&D 4e Character Importer, Carrying Tokens v2 (currently disabled due to crashing the API, still trying to figure this one out too.) Edit: After playing with it for a bit, the script is "working" however there is still no token. I can add PCs to the list and advance the turns, and the chat notifications work fine, just no token. Is there any way to re-add the token to the map?
1412542186
The Aaron
Roll20 Production Team
API Scripter
@Bryce, thanks for the kind words! If you want to invite me to that campaign and GM me, I can try to figure out what the issue is. Are you using the latest version? I fixed a bug with manually emptying the turn order a short while ago.
Aaron: I sent the invite, and yes I have version 1.22 installed.
1412781653
The Aaron
Roll20 Production Team
API Scripter
Fixed. As best I can tell, something about that script got corrupted when placed in the API Page. I did a bunch of logging that didn't reveal anything. Eventually, I deleted the script, and placed a fresh copy in, and it worked perfectly. I've had some issues in the past with pasting scripts into the API and they get interpreted strangely (HTML Entities like &amp;gt; get translated into &gt; and thereby break the HTML), but haven't actually run across a case where the script stopped working in such a bizarre fashion. It issue was tied up in the creation of new objects (the marker, specifically), so perhaps the regex in fixNewObject() got mangled. Regardless, it is working now! Happy gaming!
I always grab scripts from the raw page on github hoping to avoid that sort of problem.
1412801605
The Aaron
Roll20 Production Team
API Scripter
Me too. In this case though, I suspect it has more to do with the saving of the script on the API page than the copying of it from a source location.
Aaron, you are the best! Thanks for figuring that out for us. The group has the big boss fight coming up, and combat just doesn't feel the same without this script!
1412822820
The Aaron
Roll20 Production Team
API Scripter
No problem! =D
Hey Paul, I'm interested in using your two script adds above (!startInit and !clearInit), but I'm not understanding where to properly put them so they work. You mentioned putting them at the end of Aaron's script, but I'm not having any success. Did you make these separate scripts, or do I need to append them before an end of file marker or something? I'm not skilled in the ways of you Jedi. ;) Thanks!
1413305746
Paul S.
Sheet Author
API Scripter
Just paste them in at the end of Aaron's script. They function independently so don't need to be integrated anywhere.
1413745558

Edited 1413745763
Will
Pro
Aaron: I'm still having the same problem on a regular basis. For reference, the error message generated was: TypeError: Cannot call method 'replace' of undefined at fixNewObject (evalmachine.&lt;anonymous&gt;:2129:19) at Object.TurnMarker.GetMarker (evalmachine.&lt;anonymous&gt;:1533:20) at Object.TurnMarker.Start (evalmachine.&lt;anonymous&gt;:1601:33) at Object.TurnMarker.DispatchInitiativePage (evalmachine.&lt;anonymous&gt;:2033:18) at Sandbox.&lt;anonymous&gt; (evalmachine.&lt;anonymous&gt;:2122:20) at eval ( I am constantly having to delete and recreate the script, and sometimes even that doesn't work. I created a new map last night, and logged in this morning to test the macros and such, and the script is broken again. I have already recreated it a bunch of times, pulling the code directly from gisthub, however, I can not get the it to work on that map. It works fine on other maps where the Marker is already created. Is there some super secret step I am missing? What can I do to fix this?
1413746707
The Aaron
Roll20 Production Team
API Scripter
Hmm.. Please PM me a new invite, I'll see what I can figure out...
Invite sent. Also: I copied versions of the code from my API page and from the gisthub into Notepad++ and compared the two. It only finds a difference on line 65: "showplayers_name: true," but the code is identical in both versions. Not sure why it sees this as a difference.
Problem found and verified with Aaron's help: The Automatic Status Markers script ( <a href="https://app.roll20.net/forum/post/138621/script-au" rel="nofollow">https://app.roll20.net/forum/post/138621/script-au</a>... ) does not play nice with this script. Aaron was kind enough to suggest another script that does. Perhaps he can provide a link to it as I cannot find it in the forums. Thanks again for your help Aaron!
1413902289
The Aaron
Roll20 Production Team
API Scripter
No Worries. It's this one: <a href="https://gist.github.com/shdwjk/baab586565149fe0fca5" rel="nofollow">https://gist.github.com/shdwjk/baab586565149fe0fca5</a>
Is there a way you can add maybe a !tm begin and a !tm end for when your in combat and out of combat... After combat i have to put the turn marker token on the gm layer and then clear the turn order manually, then run reset on a new combat instance. If i dont don't do all that it will crash all my scripts and disable. It would be nice to just run 1 command that turns it off and gets rid of the turn marker, and then 1 command that turns it all on and adds the turn marker back.
1414266123
The Aaron
Roll20 Production Team
API Scripter
Hi Bruin, The token should move to the GM layer at the upper right corner whenever you close the Turn Order window. I've been noticing that crash you are describing lately. I need to track it down. Does it still crash if you use the remove all button int he Turn Order menu? I can definitely add a command that does what you are suggesting, I'll try to look into that this weekend. I have a new version of this script started, but I just need to sit down and finish it.
1414266172
vÍnce
Pro
Sheet Author
Add Paul S. script from earlier in this post <a href="https://app.roll20.net/forum/post/931415/#post-1181997" rel="nofollow">https://app.roll20.net/forum/post/931415/#post-1181997</a> I made a macro for the !startInit and !clearInit. Works nice. I also added the following at the bottom of the script (borrowed from the other Initiative Tracker) so that a macro can be used to auto-sort the initiative and another macro can be used to clear the initiative (!startInit , !clearInit). Perhaps you'll find it useful for your script as well? (I tried setting these up as cases which would be more elegant, but was having difficulty and left them separate).
I'm sorry i didnt realize hitting the X sent it to GM layer, ok that works good. Does it also reset the combat round when you bring it up? Ill keep testing to see how i got it to crash everything and get back to you. I know it had something to do with the marker being deleted from the page.
1414604319
The Aaron
Roll20 Production Team
API Scripter
Great! No worries, it's not completely obvious. It does not reset the counter, but you can reset it with: !tm reset I'll see about adding automatic reset to the options in the new version.
Hey Crunchy Peanut Butter, Could you add a way to track game time, players conditions, with an in chat reminder? Jim
1415287416
The Aaron
Roll20 Production Team
API Scripter
=D By game time, do you mean "the party rests for 1 hour, it is now 7:43pm"? I've got that in my new Calendar script which sits perpetually 70% finished on my hard drive.. As for statuses, I was just reading your post on the PowerCards thread. I've been thinking about adding a feature like that (I played with the new Custom Turn Counters the other night). I would likely add it as a separate script, but i'm game. =D
1415944642
The Aaron
Roll20 Production Team
API Scripter
Update: v1.23 -- Fixed crash because of manually emptying the turnorder before closing it, Take 2! Finally tracked this problem down and fixed it!!
1415945864
vÍnce
Pro
Sheet Author
Thank you Sir.
1415946061
The Aaron
Roll20 Production Team
API Scripter
No problem! =D
You may have to start putting the version numbers in the coding remarks, so we know if we are updating the the right fixes.
1415982875

Edited 1415982910
The Aaron
Roll20 Production Team
API Scripter
If it helps, the version number is recorded in the script and show sup at the top of the help: =D !tm
Thanks for killing this bug =)
1416232933
The Aaron
Roll20 Production Team
API Scripter
I have this mental image now of a "code exterminator" fumigating software... :)
1416508699

Edited 1416508966
I'm using version 1.23 with autoskipHidden set to false. It seems to crash at the Object.TurnMarker.RequestTurnAdvancement.get method on Custom Items added from the settings window. Getting a "TypeError: Cannot call method 'get' of undefined" With autoskipHidden set to true, the new increment/decrement feature for Custom Items is ignored.