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

Add macro functions for token Flipped X/Y/Iso settings #2879

Closed
Phergus opened this issue Aug 8, 2021 · 8 comments
Closed

Add macro functions for token Flipped X/Y/Iso settings #2879

Phergus opened this issue Aug 8, 2021 · 8 comments
Assignees
Labels
feature Adding functionality that adds value macro changes This issue adds or changes macro functions. Extra work is required (testing, wiki, code editor)

Comments

@Phergus
Copy link
Contributor

Phergus commented Aug 8, 2021

Is your feature request related to a problem? Please describe.
Currently lacking functions to get the status and flip tokens on the X/Y axis as well as for Iso grids.

Describe the solution you'd like

  • isFlippedX() - gets Token property for flipped on X axis
  • isFlippedY() - gets Token property for flipped on Y axis
  • isFlippedIso() - gets Token property for flipped for Iso grids
  • flipTokenX() - flips token on X
  • flipTokenY() - flips token on Y
  • flipTokenIso() - flips token for Iso grids

All functions to work on current token or with token id and optional map name.

Describe alternatives you've considered
None.

@Phergus Phergus added feature Adding functionality that adds value documentation needed Missing, out-of-date or bad documentation macro changes This issue adds or changes macro functions. Extra work is required (testing, wiki, code editor) labels Aug 8, 2021
@Phergus Phergus self-assigned this Aug 8, 2021
@Phergus Phergus added this to To do in MapTool 1.10.0 via automation Aug 8, 2021
@Phergus
Copy link
Contributor Author

Phergus commented Aug 8, 2021

@melek I think you brought this up. Comments?

@melek
Copy link
Collaborator

melek commented Aug 8, 2021

It is often desirable to store how a token looks so that you can reset its position later, or to otherwise set up a token's visual appearance with macros.

Flipped status is one of the only, if not the only, visual token parameter that doesn't have corresponding macro functions. Exposing flipping to macros may also enable some cool uses of flipping that we haven't thought of. :)

@Phergus
Copy link
Contributor Author

Phergus commented Aug 9, 2021

So the functions as described are good enough?

Note that the flipToken functions toggle whatever the current setting is just like the right-click menu options because they call the same code. If you want to explicitly set the flipped status then I'll have to add some new methods and update types to the Token class.

@melek
Copy link
Collaborator

melek commented Aug 9, 2021

Interesting - I think a common pattern for me would quickly emerge:

[if(isFlippedX() != MyStoredFlipStatus): flipTokenX()]

So, in that case, flipTokenX( MyStoredFlipStatus ) would be a nice little shortcut - not at all necessary, but nice. Perhaps it could work like this:

flipTokenX() --- Toggle flip
flipTokenX("") --- Toggle flip
flipTokenX(0) --- Unset flip if flipped
flipTokenX(1) --- Flip token if not flipped

Then Token ID and Map could be second and third optional paramters, like most other similar functions.

@melek
Copy link
Collaborator

melek commented Aug 9, 2021

Regarding the overall suite of functions, the basic getting and setting stuff is all there, and even if I have to check flip status before flipping with an if statement, these would do great to expose the flip settings.

If setting the flip status explicitly were an option, I don't know if separating toggling and flipping (like a flipTokenX and setTokenFlipX) would be better than a scheme like I proposed in my last comment; I kind of like using the same function for both to reduce the amount of functions, but it would work a little differently than other functions so I would trust whomever implements it to make a call.

@Phergus
Copy link
Contributor Author

Phergus commented Aug 9, 2021

I was thinking about having both toggle flip and explicit set flip functions but decided against it to avoid the bloat of extra functions. They can be added later if needed.

For now simple if() checks like you mentioned:

[h, if(isFlippedX() == 1):flipTokenX()]

will explicitly unflip and changing 1 to 0 will flip.

So all 6 functions will look like this:

flipTokenX([token name/id [, map name]])

@Phergus
Copy link
Contributor Author

Phergus commented Aug 9, 2021

Wiki docs added:
flipTokenX()
flipTokenY()
flipTokenIso()
isFlippedX()
isFlippedY()
isFlippedIso()

@Phergus Phergus removed the documentation needed Missing, out-of-date or bad documentation label Aug 9, 2021
@Phergus Phergus moved this from In progress to Review in progress in MapTool 1.10.0 Aug 19, 2021
@Phergus
Copy link
Contributor Author

Phergus commented Oct 2, 2021

No further comments. Closing.

@Phergus Phergus closed this as completed Oct 2, 2021
@Phergus Phergus moved this from Review in progress to Done in MapTool 1.10.0 Oct 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Adding functionality that adds value macro changes This issue adds or changes macro functions. Extra work is required (testing, wiki, code editor)
Projects
No open projects
Development

No branches or pull requests

2 participants