Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Hey there,

    I cant figure out how to store a floating value to a number array - it seems to round off the decimal.

    Currently, I've got an editbox that allows the user to input numbers - those strings are converted to numeric values and stored into the appropriate index of my array.
    I tried multiplying my user input value by 1.0 before storing it to the array, but it still rounds off the decimal.

    Any thoughts?

  • If i remember correctly floats aren't supported in arrays. You can however store it as a string and then convert back to a float.

    Alternatively you could either convert the float to an int using Store Float Object (this wouldn't make 10.3f = 10 as an int. It would return 1092930765/0x4124CCCD as an int). This value can then be converted back to a float and then used. Or use another extension that supports storing floats.

  • danworth - I appreciate you taking the time to reply!

    Its kind of a bummer that fusion doesn't natively support floats in arrays (**cough** feature request **cough**).
    I ended up using your advice and storing them as strings - then parsing them to values and storing them in a counter (as I needed to perform some math with that float data).

    Thanks again for your help, it worked out perfectly!!!

  • Glad I could help. One thing to keep in mind though is that string arrays are considerably larger than integer arrays. There shouldn't be an issue if the array is relatively small. If you do run into memory usage issues you could always convert the float into an int using the "Store Float Object" for storage.

    Technically arrays in MMF are capable of storing a float it just lacks the ability to convert the bytes. Because both INTs and Floats both use 4 bytes. Which is why the "Store Float Object" would enable you to do this.

  • Thanks for the heads-up!

    I've never used the "Store Float Object" before, I'll have to look into this.
    Is this supported by all of the various runtimes? I really wanted to try and do this without the use of any extensions, as I wanted to have the option to port this application to various platforms.

  • Its quite an old extension so I suspect it only supports windows. It is possible to convert a float into a byte array without extensions. It is quite complex to do with math though. but it would ensure that it would work on all runtimes.

    Although if I remember correctly there is a binary object that supports multiple runtimes. This would allow you to store a float and retrieve as an int. Or even store your data in the binary object and do away with the array maybe

  • Another tip if you know roughly the range of numbers you're dealing in is to just multiply them by 1000 or so in the array, so instead of 1.077 you'd have 1077 listed and then you can just divide when you handle the data.

    For a list of my achievements, hit up Please login to see this link..com/
    Unless you want to party, then go to Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!