Global value to INI

This forum is currently in read-only mode.
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • I can't seem to get INI to accept a value from a global variable. I am quite tired and frustrated so there is every chance I am doing something wrong, but if anyone could test it to see if it is just me being an idiot, or make an example I would appreciate it.

    I have tested it by making a new global variable, setting its value by key presses, and then 'writing' this 'value' to a new 'group' and 'item' within the INI. The new 'group' and 'item' are created within the INI, but the value is ALWAYS 0. I am baffled.

    I have tried with and without "question marks". That usually gets me. I have tried 'start of layout' 'value is different to other value' 'end of layout' 'ALWAYS' etc

    Nothing I have tried will write the global variable to the INI file.

    I am very tired. Thank you for any help chaps, goodnight!

  • I think I've got it. I tried to do the same thing you did writing it as a value and I kept getting zero as well.

    So instead, I tried writing it as a string and it did send the Global Variables value to the ini file. Check it out:

    <img src="http://farm4.static.flickr.com/3276/5722180552_f81f186789_z.jpg">

    In the ini file it wrote:

    [Hello]

    Name3=1

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I wonder why it is not working under value. Either way, cheers for the help! It is terribly frustrating having to give up on something simple when I have to go to work the next day and won't be able to work on it.

  • It works under value, I do it all the time.

    Just make sure that when you read and write from the .ini, you use the appropriate write action. There's one for string and one for "values" (numbers). I think I've run into this confusion before.

  • ^^^ I just went back and tested "write as value" again and it did register. Maybe the mix up could've been that when I tried to write it as a value on my first attempt the expression wasn't written exact and I didn't realize it at that moment, but the second time when I wrote it as a string I wrote it exactly.

    EDIT: Yep. I just retraced my steps with 'undo', and the above is exactly what I did. Perhaps Steven did the same?

    Now I'm wondering; since my example shows it working written as a string, are there any pros and cons to writing it as a string? Or is it a situation where using either one would be okay?

  • Ok so I have figured out what I was doing wrong thanks to the tips from you chaps. I was using the wrong action. My values were more often than not decimals, and so I needed to use float.

    I think that float is for decimal stuff right? I have a vague knowledge of value, string, float terms.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)