Navigation

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

    Function causes a crash

    Bug Reporting (FUZE 4 Nintendo Switch)
    crash bug function
    8
    48
    3448
    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.
    • PickleCatStars
      PickleCatStars F last edited by

      I had ’unrecognised type’ error before when accessing an array. Martin said to change the iterator Name to something unique (the ’x’ in ’for x = 0 to..’), and that worked. It was a fuze bug, not something I’d done that time...

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

        @Gothon Wouldn't I get an error if it was out of bounds ? Because the crash only occurs like 20 seconds in the game, way after the array gets completely filled with 50 values...

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

          @Hector1945 I agree that Fuze should give you an out of bounds error, but when Fuze itself is crashing it is difficult to know what to expect. It can be tricky to trace back to the cause of undefined behaviors.

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

            If I do the len(trail)-2 it does not crash but the trail doesn't display properly

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

              Oh ok it just didn't execute the command because len(trail)-2 = 0 if trail has 2 values

              1 Reply Last reply Reply Quote 2
              • spikey
                spikey F @Hector1945 last edited by

                @Hector1945 Glad you solved it , the unrecognized type 4 error probably went from adding a value to a not properly initialized array (or reading from a such). (Because of wrong dimension, index). Is it technically a 'void' type? What means its just pointing to a place in memory, but its not clear yet, what the bytes mean there: number, string, array. If somebody knows for sure please comment on this. It would be nice to know for sure.

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

                  Oh no it isn't solved ! I now have a lead though, because apparently it does come from the trail[0] = [{ball.x,ball.y},moving] because if I replace that line by trail[0] = 5 or any random int, then it doesn't crash ! I just don't know how to solve it, because when I try I get an unrecognised type 4 error.

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

                    Ok, is moving a global variable? To test if this is the problem, add a line before:
                    moving = false
                    Which will make sure it is declared implicitly as a boolean and defined as false.

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

                      I tried, and it still crashes.

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

                        What is trail[0] = [{ball.x,ball.y},moving] supposed to accomplish anyway?

                        It looks like you are assigning an array containing a vector and something else to trail[0]?

                        And then you treat the result as an int?

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

                          No I treat the result as an array of a vector and a boolean. The vector is used to log the 50 most recent positions of the ball, in order to make a trail that follows the exact path of the ball, like in the reference video. The "moving" boolean is used to determine if a trail should actually be drawn to that point. There might be a better way of doing this, but I haven't figured it out.

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

                            Sorry, I didn’t read the code properly. Now I see how you do it.

                            Not sure if it would help, but maybe using a struct would be better and then having an array of structs instead?

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

                              Did you change the loop? Backwards loops in Fuze do not work as one would suspect.

                              I find it is always better to use a while loop instead and handling the counter yourself in those cases.

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

                                You mean making a for() loop as a while() ?

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

                                  Yes, exactly.

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

                                    Wait, I'll try the structure idea first.

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

                                      Another thing I would try is to use a struct, and instead of line 70, do

                                      trail[i + 1].location = trail[i].location
                                      trail[i + 1].isMoving = trail[i].isMoving
                                      
                                      

                                      ...or similar.

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

                                        Ok, so switching to a structure doesn't appear to change anything and I still get the crash, so now I try the while()

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

                                          I hope something works. I’m not close to my Switch at the moment (not until next Monday actually 😢), so can’t really try out any ideas.

                                          Maybe you can share your program, and I’m sure there is someone who can figure it out?

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

                                            Yes I think that's what I'm going to do, because I'm really starting to run out of ideas of what could cause this...

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