Navigation

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

    Array of structure

    Coding
    5
    11
    528
    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.
    • T
      Thierry last edited by

      Hello
      I am French , sorry for my english
      I want to make a array of two dimensions of structure ( 2 , 10) for a adventure game.
      I dont know , if it is possible and I dont know the syntax.

      Struct TypeRoom
      int north ,
      int south ,
      int west ,
      int south ,
      string description
      Endstruct

      TypeRoom Room

      array Room [ 2 ] [ 10 ]

      Room [0] [ 5] .North = 1 for example

      I want to know the correct syntax.

      Thank.

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

        Someone correct me if I'm wrong, but I think the syntax should be:
        TypeRoom Room[2][10]

        Jongjungbu 1 Reply Last reply Reply Quote 1
        • Jongjungbu
          Jongjungbu F @Nisse5 last edited by

          @Nisse5 said in Array of structure:

          Someone correct me if I'm wrong, but I think the syntax should be:
          TypeRoom Room[2][10]

          That’s exactly how I do it 👍🏻

          1 Reply Last reply Reply Quote 0
          • T
            Thierry last edited by

            Thanks, but i have problems again.

            Struct TypeRoom
            int north
            int south
            int west
            int south
            string description
            Endstruct

            TypeRoom Room [2] [10] // OK

            room [0] [0].north = 1 // OK

            int x
            x = room [0] [0].north // KO

            I have this errror message with this line

            => LINE 7
            FUNCTION N/A

            UNRECOGNIZED TYPE : 4

            1 Reply Last reply Reply Quote 0
            • R
              rdurbin F last edited by

              It may be a scoping issue. Is room declared as a global or near start after endstruct? If it was created in a function or loop, its only usable in that function or loop

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

                This is gonna sound silly, but you have a string in your Struct you’re not using. And I’ve found this will cause an error even though you’re not actually using it.

                So, try assigning a value to your unused string “description”, anything, even if only =“” and it ought to work. (or delete the string for now)

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

                  @Jongjungbu Sounds like a bug. Have you reported that one?

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

                    @pianofire Of course not. I never report any bugs even though I should be. 😱😁

                    1 Reply Last reply Reply Quote 0
                    • T
                      Thierry last edited by

                      THANK YOU VERY MUCH Jongjungbu, you have found my bug.
                      You are a good programmer.
                      I think in fuze basic in a array of structure we must initialize all fields of the structure .
                      My mistake was to declare 20 structure ( TypeRoom Room [2] [10] ) and initiliaze only one for testing.
                      I have changed my code in TypeRoom Room [0] [0] , declaring one structure and initialize one structure . It's work
                      After I have changed my code in TypeRoom Room [2] [2] , declaring 4 structure and initialize 4 structure . It's work

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

                        I will raise this as an issue

                        Jongjungbu 1 Reply Last reply Reply Quote 2
                        • Jongjungbu
                          Jongjungbu F @pianofire last edited by

                          @pianofire it counts that I reported a bug now? 😁

                          @Thierry Glad that worked out for you, and thanks for the compliment!

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