Navigation

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

    About advanced features I'm curious if Fuze supports?

    Advanced
    5
    6
    439
    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.
    • RodrigoDavy
      RodrigoDavy last edited by

      Fuze is great and I'm in love with it, but it noticeably comes with some limitations I'm sure you stumbled into, so I'm curious about some stuff whether you can do officially or by workarounds

      I'm new here, so sorry if some of this stuff was already discussed somewhere here :)

      First one is about structure, it's great that I can do something like

      my_struct = [ .a = 1,
                            .b = 2]
      
      print(my_struct.a)
      

      But I was wondering whether it's possible to access a struct's value dynamically, something like:

      function something(attribute_name)
          value = my_struct[attribute_name]
      return value
      

      Another thing is about libraries, from what I gathered Fuze works with a single file which greatly simplifies thing and makes it easier for someone to read someone else's code without having to search things in a file hierarchy

      It'd be great though to have code that is going to be common in your projects (like controller handling, for example) to be available to your other projects. Is there someway to do that? Or to just copy a part of your code from one project to another?

      Last thing that comes to mind, it'd be great if there was a way to be able to be able to write code in my computer and upload it to the Switch. I'm guessing Fuze does not allow that because I'm sure Nintendo would be concerned because hacking, but just in case, do you guys code everything on the Switch itself?

      PB____ Gothon 2 Replies Last reply Reply Quote 0
      • PickleCatStars
        PickleCatStars F last edited by

        I dunno about the first one, but yes, it is possible to copy&paste code between projects. I don’t know how big the clipboard is exactly, but it is pretty big.

        There’s no transfer between other devices and switch. You have to do it all on switch.

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

          The Switch is a closed platform so as @toxibunny says, there is no way to import from PC at the present time. Never say never and all that, but that's certainly the way it is at the moment.

          Also there are no plans that I'm aware of to add multiple files per project or shared libraries but there's nothing stopping you from having a project full of library functions and copy / pasting them into other projects. I imagine it's probably just as easy to copy one of your existing projects to a new project and then delete everything you don't need when starting a new project though. That's another option.

          Finally, I'm also not aware of a way of doing what you want with structs. Maybe the example is over-simplified but in the example you give you can do the same thing by simply passing in the value of the struct member. In the next version you can even explicitly choose whether you want to do that by value or reference.

          1 Reply Last reply Reply Quote 2
          • PB____
            PB____ @RodrigoDavy last edited by PB____

            @RodrigoDavy said in About advanced features I'm curious if Fuze supports?:

            function something(attribute_name)
                value = my_struct[attribute_name]
            return value
            

            To my knowledge (as a fellow Fuze user), there is no native support for dictionaries / mutators in Fuze.

            A solution that has been used for file storage, is to maintain an array of key/value pairs, and for read/write actions you find the value for the matching key dynamically. Of course that solution is not scalable, but I think that's the best available in Fuze so far...

            edit: a link to a similar question asked earlier: https://fuzearena.com/forum/topic/1058/are-tuples-list-and-dictonaries-in-fuze

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

              @RodrigoDavy said in About advanced features I'm curious if Fuze supports?:

              But I was wondering whether it's possible to access a struct's value dynamically, something like:

              function something(attribute_name)
                  value = my_struct[attribute_name]
              return value
              

              While there may not be a way to do this with a struct, this may be a good way to use the variable type arrays of Fuze. Each array element can have a different type from the others, and array elements can be referenced by their index. You can also make a struct of constants (like an enum) to give each array index a name. Ex:

              var ele_name = [ .a = 0, .b = 1 ]
              
              var my_array = [ 1, {2, 1} ]
              
              function something(attribute_index)
                  value = my_array[attribute_index]
              return value
              
              loop
                  clear()
                  print(something(ele_name.b))
                  update()
              repeat
              
              1 Reply Last reply Reply Quote 3
              • RodrigoDavy
                RodrigoDavy last edited by

                Thanks you all for the answers, it cleared up things for me! :D

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