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

TurboWarp <key () pressed?> blocks may act differently to Scratch depending on names of Costumes and Sounds #93

Open
Tacodiva opened this issue Nov 29, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@Tacodiva
Copy link

When a constant number input is passed into the <key () pressed?> block like this:
image
In Scratch, this script always says false. In TurboWarp, this script says true if you are pressing the 'Z' key (ASCII 90). This incorrect behavior stops if you have a costume or sound named '90'.

This is because when runtime.ioDevices.keyboard.getKeyIsDown gets a number as an argument it looks up the number like it's an ASCII value, but when it receives a string it just looks for a key with that name. Both TurboWarp and Scratch detect the Z key with this script;

image

Because the + block turns the 90 into a number. TurboWarp's behavior depends on costume and sound names because this line:

return new TypedInput(`runtime.ioDevices.keyboard.getKeyIsDown(${this.descendInput(node.key).asSafe()})`, TYPE_BOOLEAN);

Seems to incorrectly assume that asSafe() means constants will act as strings always. This is only true when a costume or sprite exists with that name.

@GarboMuffin GarboMuffin added the bug Something isn't working label Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants