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] Initiative highlighter

May 08 (11 years ago)

Edited August 11 (11 years ago)

Edit: Adjusted link to point to the new version, which hopefully fixes the issues people have reported.

Perhaps you want to do something based on which person currently has the initiative? This script uses the API to find the token currently up in the initiative order and toggles an aura2 on them every 1.5 seconds. 

https://gist.github.com/rlittlefield/5538171?1=4

While the initiative tracker does a fine job of helping you identify who's turn it is, this can help in situations where you need to keep things moving. It doesn't change the players' abilities to see the aura, so you will have to change that per-token. This was intentional (although could be changed easily) because you may not want to draw attention to your nefarious plans for some tokens.

May 08 (11 years ago)
Alex L.
Pro
Sheet Author

This would be more useful if it was modified to use a separate token to give off the aura and moved to the location of the current token. Mainly because I have had situations where I have needed all the auras.

May 08 (11 years ago)

If you're going to use a separate token, you may as well make the initiative token a drawing that is 80px x 80px and put some kind of pattern as a border around the edge.

May 08 (11 years ago)
Alex L.
Pro
Sheet Author

HoneyBadger said:

If you're going to use a separate token, you may as well make the initiative token a drawing that is 80px x 80px and put some kind of pattern as a border around the edge.

Yes you could do that as well.


May 08 (11 years ago)
Konrad J.
Pro
API Scripter

Alex L. said:

This would be more useful if it was modified to use a separate token to give off the aura and moved to the location of the current token. Mainly because I have had situations where I have needed all the auras.

Or if you could initiate a ping on the token.  I think that might be the easiest to see?  But then when do you end it?  it would get annoying for the thing to be pinging away while you are doing your turn? :)

May 08 (11 years ago)

I hate the ping. It doesn't last very long and I often miss it since I'm looking at something else. When I get around to scripting an initiative highlighter, I'll use a slightly larger token, place underneath the target and make it a bright green shape/symbol or something. It'd be more awesome if we could overlay a transparent graphic on top of the token that doesn't prevent selecting the token.

check out Josh's movement tracker. its a good example of what you are talking bout here, i'm sure you could modify some of his code, or get an idea of what could work for you. And keep an eye out for Konrads implementation, he is working on something similar as well, and they are big on sharing ideas and coding, from all I have read

June 07 (11 years ago)
Alex L.
Pro
Sheet Author

Michael H. said:

check out Josh's movement tracker. its a good example of what you are talking bout here, i'm sure you could modify some of his code, or get an idea of what could work for you. And keep an eye out for Konrads implementation, he is working on something similar as well, and they are big on sharing ideas and coding, from all I have read

or you can look in my 4e helper script that has a fully working initiative tracker in it.

I'm sorry for the noobish question. I just started using the API and I keep getting this error while trying to use this script:


undefined:1 undefined ^ SyntaxError: Unexpected token u at Object.parse (native) at Timer.<anonymous> (evalmachine.<anonymous>:51:23) at Timer.timer.ontimeout (timers.js:247:14) 


From what I've gathered, the script is apparently digging up something during the parse that seems to be malformed. Any suggestions?

July 05 (11 years ago)
Alex L.
Pro
Sheet Author

Andre A. said:

I'm sorry for the noobish question. I just started using the API and I keep getting this error while trying to use this API:


undefined:1 undefined ^ SyntaxError: Unexpected token u at Object.parse (native) at Timer.<anonymous> (evalmachine.<anonymous>:51:23) at Timer.timer.ontimeout (timers.js:247:14) 


From what I've gathered, the script is apparently digging up something during the parse that seems to be malformed. Any suggestions?

Just a guess but remove the _ before all the turnorders.


Alex L. said:

Just a guess but remove the _ before all the turnorders.



Thanks, that did the trick.

I've tried a bunch of scripts by now (even wrote a few), but I seem to get an awful lot a lag sometimes. Is this normal?

I am having the same error, but not sure what you mean by "Just a guess but remove the _ before all the turnorders.' Thanks for your help!

July 15 (11 years ago)
Alex L.
Pro
Sheet Author

Christopher said:

I am having the same error, but not sure what you mean by "Just a guess but remove the _ before all the turnorders.' Thanks for your help!

read through the script, find the places where you have "_turnorder" and remove the _


Great script! Thank you!

August 02 (11 years ago)

This used to work for me: but now I just get 

 Unexpected identifier

. . . 

August 03 (11 years ago)

I'm trying this, and when I put it in first, it worked like a charm. (after i removed the _ before turnorder)

Now, i'm just  getting this message

evalmachine.<anonymous>:27 last_token.set({ ^ TypeError: Cannot call method 'set' of undefined at Timer.<anonymous> (evalmachine.<anonymous>:27:12) at Timer.timer.ontimeout (timers.js:247:14)

August 05 (11 years ago)

What do you mean by make it a matrix? Just add it to the end?

August 09 (11 years ago)

evalmachine.<anonymous>:63 last_token.set({ ^ TypeError: Cannot call method 'set' of undefined at Timer.<anonymous> (evalmachine.<anonymous>:63:12) at Timer.timer.ontimeout (timers.js:247:14)

... I dont know why I cant get these things to work. I do whats posted in the thread, I use the most updated version, and when I try it at first, everything works together. But now I'm getting this.

August 10 (11 years ago)

Yup, I couldn't get this one to work after trying for so long. IT was cool while it lasted. But that wasn't that long <Shrugs>

August 11 (11 years ago)

I've updated the script to hopefully fix the issues everyone has been reporting. Sorry it took so long.

September 04 (11 years ago)

Edited September 04 (11 years ago)

I ran into a problem when say you have a note in your turn orders, that isn't tied to a token, the script errors out because the token doesn't exist. Easily fixed by adding this after you get current_token

            var current_token = getObj('graphic', turn.id);  
            if (!current_token) { 
                var last_token = getObj('graphic', state.jrl_initiative_last_token);
                if (!last_token) {
                    return;
                } else {
                    last_token.set({
                        'aura2_radius': 0
                    });
                }
                return; 
            }

This should eliminate any problems with using non token entities in your turn orders.