GameMaker: Studio

GameMaker: Studio

View Stats:
Gergely Nov 19, 2014 @ 10:21am
I need help writing INI files! [DONE]
I actualy only own the pro Game Maker 8, but I noticed about this place. I JUST CAN'T WRITE INI FILES. I try the tutorial of the trial version of THIS game maker, and I doing everything the tutorial tels but I can't create the 3th level. The room does not duplicating, and nothing tells what is the problem. I tired of copying everything into a Game Maker 8 project, but the tutorial don't tells anymore.
Can someone give me a sample of saving/loading a single variable? Or any clue what's wrong in it?

Writing:
{ ini_open(myini); ini_write_real("section","myvariableS",myvariable); ini_close(); }

Reading:
{ ini_open(myini) myvariable = ini_read_real("section","myvariableS",0); ini_close() }
Last edited by Gergely; Nov 20, 2014 @ 9:16am
< >
Showing 1-8 of 8 comments
Daynar Nov 19, 2014 @ 12:15pm 
Assuming myini is a variable containing the filename then that should work :/
Gergely Nov 19, 2014 @ 12:42pm 
It all means:
myini = File
section = Section in the file
myvariable = the variable what I want to save and load.
myvariableS = the variable inside the file.
It don't work... :(

Please send me an exaple that should work...

{ //Send it in a box like this.// }
Blind Nov 19, 2014 @ 12:59pm 
Just in case... myini needs to be a string. "myini", so if myini is a variable which is calling a value which is a string, you need to convert it.
Gergely Nov 19, 2014 @ 1:01pm 
myini = argument0
Daynar Nov 19, 2014 @ 2:27pm 
Alright so this is some code ripped from my ios app for saving/loading settings

In the creation code of the first room.
ini_open("BuBHS"); //ensures highscores from older versions are not deleted if ini_section_exists("Highscore")=false{ global.highscore=ini_read_real("Bubble","Score",0) highscore_add("",global.highscore)} for(i=0;i<10;i++;) { highscore_add(ini_read_string("Highscore","Date"+string(i),""),ini_read_real("Highscore","Score"+string(i),0)) } global.highscore=highscore_value(1) global.EnableGameCenter=ini_read_real("Bubble","EnableGameCenter",1) global.mVolume=ini_read_real("Bubble","musicV",1) global.eVolume=ini_read_real("Bubble","musicE",1) global.StatusText=ini_read_string("Bubble","StatusText","Simple") global.ControlMethod=ini_read_string("Bubble","ControlMethod","Snap to") global.val=ini_read_real("Bubble","val",150) global.sat=ini_read_real("Bubble","sat",200) global.CirclePrecision=ini_read_real("Bubble","CirclePrecision",32) global.BGCirclePrecision=ini_read_real("Bubble","BGCirclePrecision",8) global.CircleY=ini_read_real("Bubble","CircleY",display_get_height()-floor(90*display_get_height()/480)) global.FastStart=ini_read_real("Bubble","FastStart",0) global.PointPopups=ini_read_real("Bubble","PointPopups",0) global.DynamicColor=ini_read_real("Bubble","DynamicColor",1) global.ShrinkPulse=ini_read_real("Bubble","ShrinkPulse",1) global.InnerPulse=ini_read_real("Bubble","InnerPulse",0) global.WallExplosion=ini_read_real("Bubble","WallExplosion",0) ini_close()

Upon exiting the settings menu
ini_open("BuBHS"); ini_write_real("Bubble","musicV",global.mVolume) ini_write_real("Bubble","musicE",global.eVolume) ini_write_string("Bubble","StatusText",global.StatusText) ini_write_string("Bubble","ControlMethod",global.ControlMethod) ini_write_real("Bubble","val",global.val) ini_write_real("Bubble","sat",global.sat) ini_write_real("Bubble","CirclePrecision",global.CirclePrecision) ini_write_real("Bubble","BGCirclePrecision",global.BGCirclePrecision) ini_write_real("Bubble","CircleY",global.CircleY) ini_write_real("Bubble","FastStart",global.FastStart) ini_write_real("Bubble","PointPopups",global.PointPopups) ini_write_real("Bubble","DynamicColor",global.DynamicColor) ini_write_real("Bubble","ShrinkPulse",global.ShrinkPulse) ini_write_real("Bubble","InnerPulse",global.InnerPulse) ini_write_real("Bubble","WallExplosion",global.WallExplosion) ini_write_real("Bubble","EnableGameCenter",global.EnableGameCenter) ini_close()

contence of the ini file
[Bubble] Score=0.000000 EnableGameCenter=1.000000 WallExplosion=1.000000 InnerPulse=1.000000 ShrinkPulse=1.000000 DynamicColor=1.000000 PointPopups=1.000000 FastStart=1.000000 CircleY=394.000000 BGCirclePrecision=8.000000 CirclePrecision=32.000000 sat=200.000000 val=150.000000 ControlMethod=Snap to StatusText=Detailed musicE=0.417411 musicV=1.000000 Practice=0.000000 OwlMode=1.000000 ShowAds=1.000000 [Highscore] Score0=2693.000000 Date0=Jul 7 2014, 10:16pm Score1=2693.000000 Date1=Jul 7 2014, 10:16pm Score2=2693.000000 Date2=Jul 7 2014, 10:16pm Score3=2693.000000 Date3=Jul 7 2014, 10:16pm Score4=2693.000000 Date4=Jul 7 2014, 10:16pm Score5=2693.000000 Date5=Jul 7 2014, 10:16pm Score6=2693.000000 Date6=Jul 7 2014, 10:16pm Score7=1134.000000 Date7=Sep 14 2014, 3:25pm Score8=1016.000000 Date8=Aug 24 2014, 1:56pm Score9=932.000000 Date9=Aug 3 2014, 8:54pm
Gergely Nov 20, 2014 @ 12:49am 
I can see how many variables you can save, but I thinking with ones and zeros. It can have single variable enought to save everithing. Every diferent value is opens a diferent combinations of levells solved from a game, where every level is unlocked. I know it's going to be dificult.
Levels 1 and 3 is solved, but Level 2 is not. This makes 5.
And if the solved levells are: 1,4,6,7,9,15,16, but the others aren't solved, the value saved must be: 49513

Please send me a usable example saving and loading only SINGLE variable.
In the examples you sent had many things in them, and the important thing is lost.
Is there any important thing in the saving/loading program that must be knowed?
Does it needs to create a file in an undefined event? If it creates a file, where it does put it?
I can't even check if it saved well. I'm sorry if keep wasting your time. I know almost everything about Game Maker 8 pro, I can make 3D games well, but the only thing I can't do, is saving/loading progress

I have another thing spotted: In the saving event, I put a "display message" right after the code, but in the game it don't displays any message. But in the loading event it displays the loading message well, and changes the value to the value I did entered in the default section. I also noticed about that the game is freezing a bit while the saving event. I found it out with a mouse following object. Saving and loading parameters are right, but somewhere the value is lost.

Actualy code:
//Saving// { var t; t = myvariable ini_open(argument0); ini_write_real("Gameplay","prg",t) ini_close() } //Loading// { var t; ini_open(argument0) t = ini_read_real("Gameplay","prg",0) ini_close() myvariable = t }
Daynar Nov 20, 2014 @ 8:52am 
Any event should work. It saves to local appdata (open a windows explorer window type %appdata% and then navigate to local you may have to go up a directory if it puts you in roaming)

Edited it down to only one variable.
In the creation code of the first room.
ini_open("BuBHS"); global.mVolume=ini_read_real("Bubble","musicV",1) ini_close()

Upon exiting the settings menu
ini_open("BuBHS"); ini_write_real("Bubble","musicV",global.mVolume) ini_close()
Last edited by Daynar; Nov 20, 2014 @ 8:53am
Gergely Nov 20, 2014 @ 9:15am 
Thanks!!! It WORKS!!!
Last edited by Gergely; Nov 20, 2014 @ 9:15am
< >
Showing 1-8 of 8 comments
Per page: 1530 50

Date Posted: Nov 19, 2014 @ 10:21am
Posts: 8