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

[Bug]: Strange case sensitivity in token-finding functions #5061

Open
kwvanderlinde opened this issue Nov 20, 2024 · 0 comments
Open

[Bug]: Strange case sensitivity in token-finding functions #5061

kwvanderlinde opened this issue Nov 20, 2024 · 0 comments
Labels

Comments

@kwvanderlinde
Copy link
Collaborator

Describe the Bug

Most macro functions are case-insensitive, and it seems to be the goal for all of them to be. But there are several functions related to finding tokens that are only recognized with correct case, such as getSelected(). Here's the complete list:

  • getSelected
  • getSelectedNames
  • getImpersonated
  • getImpersonatedNames
  • getPC
  • getPCNames
  • getNPC
  • getNPCNames
  • getTokens
  • getTokenNames
  • getExposedTokens
  • getExposedTokenNames
  • getWithState
  • getWithStateNames
  • getOwned
  • getOwnedNames
  • getVisibleTokens
  • getVisibleTokenNames
  • getTokenName (strict about getToken part)

In all of these, the case sensitivity only applies to the prefix that is common between the *Names and non-*Names variants. Changing the case after that common prefix will result in the function name being recognized, but the behaviour is forced to that of the non-name variant. So, for example:

  • getTokens gets matching token IDs
  • getTokenNames gets matching token names
  • getTokenNameS acts like getTokens instead of getTokenNames
  • getTokenS acts like getTokens
  • gettokens is rejected.

There is one tag-along case that I don't know what to do with: getTokenName. The name suggests and wiki documents it as behaving much like getName, but in reality it will behave as getTokenNames if correctly capitalized and getTokens if not.

To Reproduce

  1. Select a token.
  2. Type this into chat to see the token ID printed: [r: getSelected()]
  3. Type this into chat to see an error: [r: getselected()]
  4. Type this into chat to see the token name printed: [r: getSelectedNames()]
  5. Type this into chat to see an error: [r: getselectedNames()]
  6. Type this into chat to see the token ID printed: [r: getSelectedNameS()]

Expected Behaviour

All of these functions can be recognized regardless of case, and their behaviour is the same regardless of case. The *Names variants should always return token names, and the other variants should return token IDs.

Screenshots

No response

MapTool Info

1.15.2

Desktop

Linux Mint 22

Additional Context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant