Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: INI file problem  (Read 1959 times)

0 Members and 1 Guest are viewing this topic.
INI file problem
« on: May 26, 2012, 07:23:13 pm »
  • *
  • Reputation: +2/-0
  • Offline Offline
  • Gender: Male
  • Posts: 269
Hello. so i just wrote a big topic and then my internet died, so i have to rewrite this. if i have to little info just ask because im running low on sleep and trying to remember what i wrote. alright in my game you press the save button, and it saves certain global.variables to the INI.

Code: [Select]
ini_open("SaveGame.ini")
ini_write_real("In Game Variables", "0000000001",variable_global_get(global.hp))
ini_write_real("In Game Variables", "0000000002",variable_global_get(global.maxhp))
ini_write_real("In Game Variables", "0000000003",variable_global_get(global.rownum))
ini_close()
so it saves some variables into the INI. the big random numbers are for an early encrypting process im trying. whenever i open up the INI however, all the values = 0. i think its something with variable_global_get that im doing wrong.. anyone have suggestions?

Logged

DaSpirit

The Quiet
Re: INI file problem
« Reply #1 on: May 26, 2012, 07:29:01 pm »
  • The Mad Programmer.
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 87
Why are you using variable_global_get() instead of just using the global variable?
Code: [Select]
ini_open("SaveGame.ini")
ini_write_real("In Game Variables", "0000000001",global.hp)
ini_write_real("In Game Variables", "0000000002",global.maxhp)
ini_write_real("In Game Variables", "0000000003",global.rownum)
ini_close()
variable_global_get takes a string, not a constant anyway.
Code: [Select]
variable_global_get("hp") // instead of variable_global_get(global.hp)
« Last Edit: May 26, 2012, 07:31:34 pm by DaSpirit »
Logged
I support:
Re: INI file problem
« Reply #2 on: May 26, 2012, 07:38:12 pm »
  • *
  • Reputation: +2/-0
  • Offline Offline
  • Gender: Male
  • Posts: 269
It works like that? By brother who used to use ini files in game maker said that it would set it to global.hp, but now that i think about it i think thats what happens if you use ini_write_string.. Well thanks! I knew there was something off, but i didnt know what it was.
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.076 seconds with 43 queries.

anything