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

utilities: fix some blocks breaking if specific costumes exist #1119

Merged
merged 3 commits into from
Oct 30, 2023

Conversation

CST1229
Copy link
Collaborator

@CST1229 CST1229 commented Oct 30, 2023

Resolves #Clamp bug

For some weird, inexplicable reason that I do not know why it happens, ArgumentType.NUMBER arguments are auto-casted to number, but only if a costume with that name does not exist.
This breaks a few math-related blocks in Utilities under specific circumstances (for example, clamp 30 between 25 and 100 returns 25 if costumes named 25 and 100 exist).
This PR fixes that, by casting the arguments to numbers in clamp and using Scratch.Cast.compare on isLessOrEqual and isMoreOrEqual. exponent's arguments are also casted now just to be safe.

@GarboMuffin
Copy link
Member

extensions are supposed to cast all of their inputs themselves, for example when someone drops in a variable you don't know what you're going to get. in this case not casting inputs to numbers if it matches the name of a costume fixes compatibility bugs with "set costume to (...)" blocks

@GarboMuffin GarboMuffin merged commit e9a5fb8 into TurboWarp:master Oct 30, 2023
@CST1229 CST1229 deleted the utilities-fix-clamp branch March 10, 2024 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants