Global value to INI

For questions about using Classic.

Post » Sun May 15, 2011 11:01 am

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!
B
9
S
2
G
4
Posts: 346
Reputation: 2,726

Post » Sun May 15, 2011 12:19 pm

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:



In the ini file it wrote:

[Hello]
Name3=1
B
12
S
4
G
3
Posts: 426
Reputation: 2,458

Post » Sun May 15, 2011 7:55 pm

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.
B
9
S
2
G
4
Posts: 346
Reputation: 2,726

Post » Sun May 15, 2011 9:27 pm

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.
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Sun May 15, 2011 10:02 pm

^^^ 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?
B
12
S
4
G
3
Posts: 426
Reputation: 2,458

Post » Mon May 16, 2011 4:58 am

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.
B
9
S
2
G
4
Posts: 346
Reputation: 2,726


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests