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] Facing - Facing indicator for tokens

May 02 (10 years ago)

Edited April 16 (8 years ago)
The Aaron
Pro
API Scripter
Creates a facing indicator for the selected token(s). The indicator is on the top of the map layer, so won't interfere with tokens on the object layer. If the Token is on the GM layer, the indicator will be on the GM layer as well, at the very bottom. The indicator maintains it's relationship to the token through moves, scales, etc. Additionally, if a token represents a character, Facing will create an attribute on that character that has the current facing angle.

Commands:

  • !facing -- toggles the facing indicator on and off for a token
  • !zero -- aligns the indicator to north when you've got it just a few degrees off or are using absolute direction mode.





By default Facing uses relative rotation, which means that if you rotate the token 45 degrees, the indicator will rotate 45 degrees as well. (Hint: watch the resize indicator box that is on the indicator to line things up.) You can switch off Relative Rotation in which case the direction you point the rotation handle will be the direction the indicator points. However, there is no way to point the rotation handle up, so you will need to use !zero to face the token north in that case.

You can select your own Direction Indicator. Just put it on the table and push the Pick button and then click on the graphic. You must use a graphic in a User Library. MarketPlace assets cannot currently be created by the API. After setting a new Direction Indicator, you can adjust the scaling to get the indicator token to fit correctly.

Facing creates an attribute on the character associated with a token that has the rotation stored in it for reference in macros. The name of that attribute can be set by clicking the Set Name button.


(Click to watch animation)



GIT: https://github.com/shdwjk/Roll20API/blob/master/Fa...
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.
May 02 (10 years ago)
Gen Kitty
Forum Champion
Nicely done, T'Aaron.
May 02 (10 years ago)
Coal Powered Puppet
Pro
Sheet Author
...that was amazingly fast.

Might I suggest a script to balance the national (or Global) budget next? I would expect this to take you a few days.
May 02 (10 years ago)
The Aaron
Pro
API Scripter
Ha! I think I'd sooner tackle a script to check if the API will crash... =D
May 02 (10 years ago)

Edited May 03 (10 years ago)
When I read that facing thread I knew you were going to make this exact thing/script, Aaron. It's pretty awesome and makes me want to add facing/portrait tokens to my own game just so I have a reason to include it lol
May 02 (10 years ago)
The Aaron
Pro
API Scripter
Hahaha. Yeah, it's not perfect, but it does the job pretty well. It would be nice if we had more seamless ways of attaching objects to one another in the API. The drag-lag is slightly distracting, but we do what we can with what we have. =D

I would have liked it if the absolute angle worked out better as it's much more intuitive to point the rotation handle in the direction you want to point, but I couldn't come up with a way to make it point up. I suppose I could have it reset to 0 if you pointed it in the same direction twice, but I'm not sure that would be any better. The Relative Rotation works really well, particularly if you're only interested in 45º angles. It doesn't take long to get used to looking at the corner/side resize box that is under the direction indicator and use that to point at what you want.

I'll be curious to see if anyone has a use for the facing attribute. I threw that on because I could and it seemed like the kind of thing someone might have a use for, though I can't actually think of one of the top of my head.

Hope it finds a bunch of use and I'm looking forward to feedback on how it's working out. =D
May 04 (10 years ago)

Edited May 04 (10 years ago)
AAAAAMMMMAAAZZZZINNNNNNGGGGGGG!!!!!!!!!!

Aaron, I see you are a mentor. Why, may I ask, is Roll20 not paying you instead?!?!
May 04 (10 years ago)
The Aaron
Pro
API Scripter
Hahaha. Glad you like it.

I think they'd need a lot more mentors, I have a pretty good job already. I'd move in a heartbeat, but I don't think it's in the cards right now...
May 05 (10 years ago)
Wow! I just checked back and saw this was made already. Bravo!

I'm gonna use it, and I'll probably have some feedback for you, too. Thanks!
May 05 (10 years ago)
The Aaron
Pro
API Scripter
Great, thanks! I hope you like it!
May 07 (10 years ago)
Toby
Pro
I love this API! You rock! However, three suggestions that would make something already awesome even more awesome! First, Could you add a way to 'offset' the health/armor/misc circles and bars for health and resource monitoring. The token ring has a tendency to make it hard to see. Also, would it be hard to add a way to create a portrait border for hex shaped or square shaped. Sometimes the circle causes issues with clipping the token art.

Also, would it be possible to set up the token's vision angle to go off the token ring which would make the angle more useful without editing every single token so the facing would line up properly.

All three of these suggestions are icing on the cake, your api skills are legendary!
May 07 (10 years ago)
The Aaron
Pro
API Scripter
1) Offsetting the Bubbles -- I'm afraid I don't have access to the offset of the bubbles, however you could adjust the scale so that the circle is further out from the token, allowing the bubbles to be inside it.
2) Portrait border for Hex or Square -- You could definitely create a Hex or Square shaped disk to use for your direction indicator. Alternatively, you could bump the scale up a bit like in 1 so that the indicator is beyond the hex/square.
3) I was actually thinking about this while working on it. Thats why I chose North as the default orientation in fact. I'll see about adding it in a future version. =D
May 08 (10 years ago)
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
did I missing some special trick to activating the facing?
May 08 (10 years ago)
The Aaron
Pro
API Scripter
I'm not sure. You rotate the master token to some angle, and the script rotates the indicator and the reverts the master token back to upright.
May 09 (10 years ago)
Toby
Pro

The Aaron said:

1) Offsetting the Bubbles -- I'm afraid I don't have access to the offset of the bubbles, however you could adjust the scale so that the circle is further out from the token, allowing the bubbles to be inside it.

Your answer still applies probably, but for clarification, I was actually referring to the bars that appear when you use the min/max values. the Red one (third bar I think) always displays on top of the token for me. And the blue one always displays on the edge of the token. Which means I effectively only have use of one bar.
May 09 (10 years ago)
The Aaron
Pro
API Scripter
Hmm. Probably I'd give the same answer. Can you post a pic?
May 09 (10 years ago)

Edited May 09 (10 years ago)
Toby
Pro


This. The lowest of the bars is completely on the token.
May 09 (10 years ago)
The Aaron
Pro
API Scripter
Ah. Probably you could use a more high contrast direction indicator, or make the direction indicator scale larger to alleviate the issues. There's nothing I can do about that placement.