For some reason the following code crashes the site:
when [any] key released
set [#] to ("0")
repeat("10")
if <key (#) is pressed> then
set [type] to (#)
end
change [#] by ("1")
end
For some reason the following code crashes the site:
when [any] key released
set [#] to ("0")
repeat("10")
if <key (#) is pressed> then
set [type] to (#)
end
change [#] by ("1")
end
@ek43680-wdmcs can you send a picture of the blocks? The get scripts for sprite is useful but doesn’t include stuff like parentheses for ordering
@ek43680-wdmcs recreating it and dissecting, the issues appears to be the change variable by block sets the variable to a number value, the set makes it a string, the change var by block works with turning numbers that are currently a string to a number and increasing (a string is what a program lets be any text incase somebody reading doesn’t know), but it turns the variable output into a number, so any string inputs (I tried fixing it with uppercase/lowercase of text and it froze it running that alone) just freeze when given a forced number value (the variable after a change by block is ran is turned from a string into a number)
As of typing I have found that the join block fixes this, so replace the lone # in the key # pressed block with a join (#) () block and it’ll work the exact way as it would of without the join but without freezing
Thanks @Tyller_
That’s correct. Currently, the “key ( ) is pressed” block expects a string, so plugging in a variable causes it to fail. We will release a hotfix for it later today. Sorry about that.
And joining the variable with an empty string would fix that issue for now.
In addition, @ek43680-wdmcs , in your original code, the code is triggered by “when [any] key released” event, which needs to be changed to “when [any] key pressed”. That’s because the “when [any] key released” block runs when the key has been released already, so the “key () is pressed” block will not find any key in the “pressed” state.
Here is the corrected program:
Here is the project:
https://play.creaticode.com/projects/65677a359037505e69aa1bed
FYI the issue with the “key ( ) is pressed” block has been fixed. Thanks for reporting the issue.