Jump to content


Photo

reading, creating, and checking ini files.


  • Please log in to reply
2 replies to this topic

#1 nikkolausc

nikkolausc

    GMC Member

  • New Member
  • 6 posts

Posted 11 June 2012 - 09:54 PM

To start off, i have alot of experience in game maker, and im pretty good in programming the majority of things except for ini files, which i'm incredibly new to. I was looking for a better way to save (so i could update the game without hurting save files) when i came accross these magical ini files. However, my codes not working, and it said its trying to read from an undefined INI file. Any decent coder can see what i'm trying to pull off with my code here, and if not, then i'm simply checking how many accounts are saved, and creating an array for each account name.


if ini_section_exists('main')
{
global.accnumber=ini_read_real('main','accnumber',0)
}
else
{
global.accnumber=ini_write_real('main','accnumber',0)
}
var t;
t=global.accnumber
if t>0
{

repeat(global.accnumber)
{
global.account


i dont have a save function yet, but this code runs at the very start of the game.
  • 0

#2 whothat

whothat

    GMC Member

  • New Member
  • 18 posts
  • Version:GM8

Posted 11 June 2012 - 10:48 PM

you need to open the ini file before you can edit it

ini_open('save.ini'); // will open the file save.ini or create it if it doesnt exist

and then when you're done load/saving things remember to use

ini_close();
  • 0

#3 nikkolausc

nikkolausc

    GMC Member

  • New Member
  • 6 posts

Posted 11 June 2012 - 11:01 PM

it was that simple? well that deffinately solves ALOT of problems. thanks a million
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users