Navigation

    CreatiCode Scratch Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode

    Key pressed bug

    Feedback
    3
    5
    333
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      Ethan K last edited by

      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
      
      Tyller_ 1 Reply Last reply Reply Quote 0
      • Tyller_
        Tyller_ Best Forum Helpers last edited by

        @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

        <div component="post/signature" data-uid="255" class="post-signature">Check out my chat room project so you ppl can not use forums as chat rooms! https://play.creaticode.com/projects/66f2e1dcd1be43d82b886fbd?version=1 <p dir="auto">
        </div>

        1 Reply Last reply Reply Quote 0
        • Tyller_
          Tyller_ Best Forum Helpers @ek43680-wdmcs last edited by

          @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

          <div component="post/signature" data-uid="255" class="post-signature">Check out my chat room project so you ppl can not use forums as chat rooms! https://play.creaticode.com/projects/66f2e1dcd1be43d82b886fbd?version=1 <p dir="auto">
          </div>

          info-creaticode 1 Reply Last reply Reply Quote 0
          • info-creaticode
            CreatiCode @Tyller_ last edited by

            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:

            5f4e86a9-d47a-478b-8061-18e438add045-image.png

             
            Here is the project:

            https://play.creaticode.com/projects/65677a359037505e69aa1bed

            info-creaticode 1 Reply Last reply Reply Quote 0
            • info-creaticode
              CreatiCode @info-creaticode last edited by

              FYI the issue with the “key ( ) is pressed” block has been fixed. Thanks for reporting the issue.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post