Navigation

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

    Debugger Support?

    Comments & Feedback
    4
    8
    462
    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.
    • mixaal
      mixaal F last edited by

      Hi Guys,

      is there a way how to debug a function? Mainly inspect variables at certain point? I tried to create a global variable into which I tried to assign values from the function but they seem to be strictly in a function local-scope, I even tried the global "keyword" which didn't produce any syntax errror but didn't have any effect.

      Thanks for any help.

      Cheers,
      Michal

      1 Reply Last reply Reply Quote 1
      • N
        Nisse5 F last edited by

        I simply use "print" to get the variable status each time every update.

        1 Reply Last reply Reply Quote 0
        • Dave
          Dave Fuze Team last edited by

          JonBoy uses a really handy debug function in his programs. Here's an example:

          function breakPoint( info )
              press = false
              while !press loop
                  j = controls(0)
                  if j.x then 
                      press = true
                  endif
                  clear()
                  print( "Breakpoint: ", info )
                  print( "Press X to continue" )
                  update()
              repeat
              sleep( 0.2 )
          return void
          

          You can use this function wherever you like in your program. Simply pass it the value you want to check at the point you want to check it, and you'll get a display of the value at that exact point in the program flow.

          I will be working on a debugging tutorial in future updates to get this info into the product formally.

          Hope this helps!

          pianofire 1 Reply Last reply Reply Quote 5
          • pianofire
            pianofire Fuze Team @Dave last edited by

            @Dave That looks like one for the "hints and tips" post!

            1 Reply Last reply Reply Quote 0
            • Dave
              Dave Fuze Team last edited by

              Yes! I'll do another post there.

              1 Reply Last reply Reply Quote 1
              • mixaal
                mixaal F last edited by

                Wow, nice tip. Thanks a lot !

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

                  Hi @Dave I really like your posted solution, it's really nice and flexible since it displays the variable at any point in time.

                  Thanks!

                  1 Reply Last reply Reply Quote 1
                  • Dave
                    Dave Fuze Team last edited by

                    No problem! Really I can't take the credit as I got it from @Jonboy :)

                    This function will be added to the tutorials in an update some point in the future.

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