Navigation

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

    Where does print() print to?

    Help
    6
    12
    478
    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.
    • J
      Jack_Blue last edited by

      Hi!

      I usually program with Python, using the Pycharm IDE (please no lectures about the laziness of using an IDE; I like it!).

      I fix bugs by putting print() statements throughout the section of code that I'm looking at, to see what the values of each list and variable are at every stage in the program, and so work out where the program isn't functioning the way I want it to.

      I want to be able to do this with Fuze4, but can't, because I don't know where print() prints out to! Sometimes the error prompts are helpful, but often they don't make much sense (e.g. 'unrecognised type: 4' - I'm creating another post to ask what that means).

      If it's any help, I have a Nintendo Switch Lite.

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

        print() like all draw commands by default prints to the framebuffer which is a buffer used to hold the screen contents.

        This is written to the screen when update() is called. This is used to reduce the amount of screen updates and to ensure that programs run at the same speed.

        Update() will only refresh the screen every 1/60th of a second so that your program will run at 60fps (the frame rate will drop if you do too much work between update calls)

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

          There is a good debug function here: https://fuzearena.com/forum/topic/123/debugger-support/4

          1 Reply Last reply Reply Quote 0
          • spt games
            spt games last edited by

            I think "Unrecognised type" is when Fuze cannot convert your data into the string type needed by the print() function. I've encountered this when trying to print out a file handle (see "File Handling" commands in Fuze Help). It crashes the program.

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

              I have just had a look and type 4 seems to be a void (or nil pointer) which basically means an undefined or unassigned value

              1 Reply Last reply Reply Quote 1
              • J
                Jack_Blue last edited by

                Using print() has never printed anything to my screen!

                pianofire 1 Reply Last reply Reply Quote 0
                • PickleCatStars
                  PickleCatStars F last edited by

                  I’ve just been making all my variables global and drawtext() ing them right at the end before my update(), otherwise it seems they just got covered up. In 2d, you could do the same with print(), probably, but it might be smarter to write a debug() function with a list that you just add whatever you want to that all gets printed out right at the end..

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

                    @Jack_Blue On it's own it doesn't:

                    try the following:

                    loop
                      clear() 
                      print("Hello World")
                      update()
                    repeat
                    

                    clear() - clears the frame buffer

                    print() - prints a message to the framebuffer

                    update() - outputs the framebuffer to the screen every 1/60 th of a second

                    1 Reply Last reply Reply Quote 1
                    • J
                      Jack_Blue last edited by

                      Thanks!

                      What if I want to do this:

                       loop
                            clear()
                            for i = 0 to 100 loop
                                 print(i)
                            repeat
                            update()
                       repeat
                      

                      Not all of this will be able to fit on the screen at once!

                      Martin 1 Reply Last reply Reply Quote 0
                      • Martin
                        Martin Fuze Team @Jack_Blue last edited by

                        @Jack_Blue said in Where does print() print to?:

                        What if I want to do this:

                        That will work fine

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

                          So you can use printat(x,y, value) to print at a particular screen location:

                           loop
                                clear()
                                for i = 0 to 100 loop
                                     printat( i % 10 * 5, int ( i / 10), i)
                                repeat
                                update()
                           repeat
                          
                          1 Reply Last reply Reply Quote 1
                          • P
                            petermeisenstein F @Jack_Blue last edited by

                            @Jack_Blue pycharm is good so print does the same like in Python but its more like the print from python 3 and you have to use update()
                            To update your screen.

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