Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    Last button pressed in game is processed by editor too

    Bug Reporting (FUZE 4 Nintendo Switch)
    4
    7
    273
    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.
    • F
      Factory121 last edited by

      I wrote a loop which waits for a button press before exiting my program. If I press the B button to exit my program, the editor does a backspace, modifying my source code. To reproduce, move the editor cursor to the end of a line so the backspace will actually do something. You can use the editor's undo feature to repair the damage.

      loop
        update()
        ctrl = controls(0)
        if ctrl.b then
          break
        endif
      repeat
      
      F 1 Reply Last reply Reply Quote 0
      • Discostew
        Discostew F last edited by

        Looks like a bug to me. For the time being, I guess you could add a sleep call at the end to give you enough time to release the button before it goes back to the editor.

        1 Reply Last reply Reply Quote 0
        • H
          hammy_ last edited by

          another solution could be waiting until the button is released before exiting out to the editor, it would stop any issues but might make it feel less responsive

          1 Reply Last reply Reply Quote 0
          • F
            Factory121 last edited by

            Oh, geez, I didn't even think of that. I need to loop until the button is no longer pressed. Thank you.

            1 Reply Last reply Reply Quote 0
            • H
              hammy_ last edited by

              no problem, normally if you were using a button to exit a menu it would exit as soon as you pressed it but lock that button's input until you released it, but the code editor isn't part of your program so sadly you can't change that, so i'd definitely like to see a "fix" to this, as it were

              1 Reply Last reply Reply Quote 0
              • F
                Factory121 @Factory121 last edited by

                News and improved:

                pressed = false
                loop
                  update()
                  ctrl = controls(0)
                  if ctrl.b then
                    pressed = true
                  else
                    if pressed then
                      break
                    endif
                  endif
                repeat
                
                1 Reply Last reply Reply Quote 0
                • Martin
                  Martin Fuze Team last edited by

                  You've stumbled upon something that I found on I think my 2nd night. If you for example increment a counter and print the result on screen when a button is pressed then you'll be expecting it to increment by 1 each press but the loop is so fast that it'll go up by quite a lot. So as you now know you keep checking until you know the button WAS pressed but isn't any more. THEN you do you action and you're golden. It might seem like a quirk but it's actually perfectly normal having to "debounce" a button.

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