Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

actor variable in script macros always refers to base, world actor rather than the selected token's synthetic actor #9158

Closed
Fyorl opened this issue Apr 3, 2023 · 3 comments
Assignees
Labels
breaking Issues which cause breaking changes to the API bug Functionality which is not working as intended macros Issues related to Macros and the Hotbar.

Comments

@Fyorl
Copy link
Contributor

Fyorl commented Apr 3, 2023

Originally reported by Mana#4176 https://discord.com/channels/170995199584108546/956306859491471420/1084545676307878049

ALL MODULES DISABLED? true
OS, Hosting, Browser (if applicable): any
Short Description of bug: actor in script macros points to source actor even when a token is selected (instead of the synthetic actor as one would expect)
Simple steps to reproduce the bug:

  1. Make following script macro:
ui.notifications.info(actor.uuid);
  1. Use this macro for bunch of unlinked tokens from same actor.

I at least would expect this to refer to the actor of the selected token, so if you happen to update or pull data from the actor, it to be relevant to the token. But it's obviously not.

This is also against the documentation of what actor is supposed to refer to.

@Fyorl Fyorl added bug Functionality which is not working as intended macros Issues related to Macros and the Hotbar. labels Apr 3, 2023
@Fyorl Fyorl added this to the Version 11 - API Development 2 milestone Apr 3, 2023
@Fyorl
Copy link
Contributor Author

Fyorl commented Apr 19, 2023

I can definitely understand the expectation that actor would be the token actor if a token is selected when executing the macro, but changing this behaviour now has the potential to break a lot of pre-existing macros that might have been depending on it. I feel that most macros that expect to be interacting with a token can just use token.actor if they want to be sure.

@Fyorl Fyorl added the breaking Issues which cause breaking changes to the API label Apr 19, 2023
@krbz999
Copy link

krbz999 commented Apr 19, 2023

I have to say I don't think I've ever seen anyone write a hotbar macro that specifically uses the current logic to apply to the "prototype" actor despite selections. In fact most aren't aware of it, this might just fix more than it breaks.

@aaclayton
Copy link
Contributor

I think I'm inclined to agree that - with our improvements to token actors - it would probably be best if actor in macro scope refers to the unlinked token actor rather than the base.

@Fyorl Fyorl self-assigned this Apr 20, 2023
@Fyorl Fyorl closed this as completed Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Issues which cause breaking changes to the API bug Functionality which is not working as intended macros Issues related to Macros and the Hotbar.
Projects
Status: Done
Development

No branches or pull requests

3 participants