Description
When a constant number input is passed into the <key () pressed?>
block like this:
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;
Because the + block turns the 90 into a number. TurboWarp's behavior depends on costume and sound names because this line:
scratch-vm/src/compiler/jsgen.js
Line 444 in ef871f7
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.