gms_ini_player_write

Usage: gms_ini_player_write ( section, key, value )

Description

Saves the given value to the given section and key.

Replies (68)

Last message on 21 Jul 2020

BabyGolden12 on 16 Jul 2020, 19:02:05
Say If I Wanted To Make a system where people saved a map they built and then they people can play on their map how would it work
Size43 (Administrator) on 21 Jul 2020, 17:39:31
You'll want to share maps via the BDB system rather than INIs, since BDBs are loaded on-demand rather than on login. You can take a look at the Blocks example included in the download to see how you can write and read from BDBs, as well as manage a session system.

The difference for pre-made maps would just be that rather than editing the map on the go, you can write everything to the BDB beforehand and you can just have all players load it before starting the game.
TheRetroBoy on 31 Jul 2019, 02:08:10
Okay so, I've had this same problem but, it's going back to 0 every time the thing loads, but I realized when it saves it goes to zero. So I have no idea what is happening.
Size43 (Administrator) on 10 Aug 2019, 21:52:03
Try adding show_message/show_debug_message statements every time you save to print the value that is saved. That should help narrow down where the 0 gets written.
TheRetroBoy on 20 Sep 2019, 00:14:13
Hi there, I'm not working on that game but I just realized i did

if (!gms_ini_game_exists("PLAYER","COINS")) -- this is to check
{
save_player_ini()
}

instead of

if (!gms_ini_player_exists("PLAYER","COINS"))
{
save_player_ini()
}
TheRetroBoy on 11 Apr 2019, 06:43:09
I can use this, but one problem is that when I draw let's say... "LVL" on the hud, when I do the "LVL" resets back to 1, please help!
TheRetroBoy on 11 Apr 2019, 06:57:47
If I do anything with a variable that was saved via INI, then it'll reset!
Size43 (Administrator) on 24 Apr 2019, 11:50:52
How are you saving / loading INI variables?
TheRetroBoy on 18 Jul 2019, 17:32:47
That was a while ago, I fixed it on that one, but my drive died so my data about that game is long gone, so sorry about bugging you about this.
pulpincoco on 20 Nov 2018, 20:55:45
sorry if im too stupid but what's that key and section D:
Size43 (Administrator) on 22 Nov 2018, 20:48:09
GameMaker Server's INI files work a lot like normal INI files. If you've never worked with them before, the offical manual does a pretty good job of explaining what INI files are:http://docs.yoyogames.com/source/dadiospice/002_reference/file%20handling/ini%20files/index.html
In short, a section is a part in an INI file that contains multiple values. For example, you might make different sections for the player's inventory, skills and position. Each section then contains a few keys and values.
Dublann on 3 Mar 2017, 20:55:53
Hi Size, it seems that the INI files can be read but cant be written since 1 week ago. Before it was working great.

I have been waiting for hours but in the website it is not updated.
Size43 (Administrator) on 5 Mar 2017, 17:17:16
Are they updated in-game?

Did you try logging out of this site and back in again?
Dublann on 5 Mar 2017, 18:45:16
I have just logged out and logged in, and it was updated. Thx!
Dublann on 13 Mar 2017, 09:43:32
Hi Size!

Im having the same problem. Yesterday afternoon I was playing and Ini data was not read / written. I waited time, I logged out and in and nothing. Today I have logged in again and Ini values are not updated. Sometimes It happens and I dont know why.

Thx!!!!
Dublann on 13 Mar 2017, 11:30:40
Also (I forgot to mention), highscores are not read, just in case It has a relation with the Ini issue.
Dublann on 15 Mar 2017, 19:15:37
Hi Size!
Today everything is working very well (I have not changed the code).

Is possible that if the server is plenty of people, the reading of INIs are not done/worse done?

THX
Size43 (Administrator) on 22 Mar 2017, 18:44:02
There might be a bigger save queue if the server is busy. Are you losing any save data, or just unable to see it on the site sometimes?
Zekronz on 1 Oct 2015, 12:15:56
Hi! I'm having problems with writing strings to a INI file. Whenever i try to read the INI file it just returns a bunch of numbers.
Size43 (Administrator) on 3 Oct 2015, 19:16:24
What version of the extension are you using?
Zekronz on 5 Oct 2015, 22:24:28
Don't worry. I think i fixed it. I'll send a message if it happens again. :)
Size43 (Administrator) on 7 Oct 2015, 15:22:32
Alright, good to hear!
BulleTechGames on 16 May 2015, 11:13:29
Game Maker: Studio v1.4.1567
Extension: 1.8.5b All

1. Using gms_ini_game_write() takes hours to update on the site

2. Both ini_game_write() and ini_player_write() can only handle variables as the value. When placing a set/predetermined value such as gms_ini_player_write("Section","Key",100); a runtime error is caused.

3. They also can't handle calculations either, such as gms_ini_game_write("Section","Key",variable*2);

4. They also can't handle strings. gms_ini_player_write("Section","Key","stringvalue");

5. They also return a runtime error when using string() or real() with the value

The execution error is caused at gml_Script_XGms_ve_getBestWayToSend (line 96) - return (0 << 7) | (VT_SPECIAL << 3) | num;
BulleTechGames on 16 May 2015, 13:15:12
6. If the variable is storing a number higher than 63 it causes a runtime error as well
score = 64
gms_ini_player_write("Section","Key",score);
BulleTechGames on 17 May 2015, 15:26:47
FIXED AS OF 1.8.5c
puzzle on 12 Dec 2014, 09:16:35
sorry for my bad english.

gms_ini_game_write can do with my game.
but Does not work gms_ini_player_write.

While it until you log out has been saved.
but It is not save when you log in again.

please help.
Use:GameMeker8.1.141 Standard
Size43 (Administrator) on 12 Dec 2014, 14:40:46
Does gms_info_isloggedin return true when you try to write to the INI file?
puzzle on 12 Dec 2014, 15:26:43
gms_ini_player_write returned 1
gms_info_isloggedin returned 1

//code
gms_ini_player_write("a","a",1)
b=gms_ini_player_read("a","a")
//-----
return:b=1

//code
gms_ini_player_write("a","a",1)
//-----
ReLunch&Login
//code
b=gms_ini_player_read("a","a")
//-----
return:b=-1
puzzle on 13 Dec 2014, 00:45:30
Apparently it seems the same phenomenon in all games that use the GameMakerServer is happening.

Verification:Pokemon Social,I wanna Login
Size43 (Administrator) on 13 Dec 2014, 15:55:00
Can confirm that this is a bug. I'm close to releasing 1.8, so unfortunately I can't update the server right now to fix it. This bug will be fixed as soon as possible.
Size43 (Administrator) on 13 Dec 2014, 18:29:45
I've just updated the server. Please let me know if you're still having these problems. (If I just introduced some other problem, please let me know too!)
puzzle on 14 Dec 2014, 01:21:01
Thank you for support.
puzzle on 14 Dec 2014, 02:44:34
Also seems to be happening.
puzzle on 14 Dec 2014, 08:16:48
There is a case in which is not possible to save.

The saved data does not come out in the INI's. (GameINI & PlayerINI)
Size43 (Administrator) on 14 Dec 2014, 19:02:18
Would you be able to mail me a gmk/gmz (to gamemakerserver@outlook.com) that'll allow me to reproduce the issue?
puzzle on 15 Dec 2014, 08:09:29
Music and some were sent what you have deleted the heavy code (font loading of mbtext).
Size43 (Administrator) on 18 Dec 2014, 15:19:38
Hey,

Sorry for the delay. I've been busy doing real life stuff, which obviously has to get priority. I'll be looking at your gmk as soon as I can.

Size43
puzzle on 24 Dec 2014, 17:52:33
Hi,Size
Is my problem to solve likely?
Was changed to local save until failure is corrected.
Size43 (Administrator) on 24 Dec 2014, 18:14:51
I'm doing my best to see if I can get the 1.8 update out today (don't get your hopes up, it's more work than I thought), after that I'll take a look at you gmk. It'll be fixed ;)
puzzle on 25 Dec 2014, 13:49:28
It was repaired by updating to 1.8!
Thank you all!
Katliyam34 on 5 Jul 2014, 15:29:41
Hi , i need help. i am new user game maker server. i don't know section and key , please example
Size43 (Administrator) on 5 Jul 2014, 20:32:57
GameMaker Server's INI files work a lot like normal INI files. If you've never worked with them before, the offical manual does a pretty good job of explaining what INI files are (http://docs.yoyogames.com/source/dadiospice/002_reference/file%20handling/ini%20files/index.html)

In short, a section is a part in an INI file that contains multiple values. For example, you might make different sections for the player's inventory, skills and position. Each section then contains a few keys and values.
Katliyam34 on 5 Jul 2014, 22:32:41
Hi , sorry for my bad english. i need help for send variable and call variable , i no want log in or register system or high score system. i am use write_ini system but I could not.. my game is similar gladiatus browser game and build android platform.. i need send variable and call variable..
Size43 (Administrator) on 6 Jul 2014, 11:37:49
GameINIs are readable & writeable without being logged in. Please make sure you've got a "GMS" object like in the GM:Studio example placed in the first room, and that your game is registered on the site.
Katliyam34 on 6 Jul 2014, 14:37:23
yes , i know. i have "GMS" object. but not can send variable and call variable
Katliyam34 on 6 Jul 2014, 14:38:54
my game is registered site
Katliyam34 on 6 Jul 2014, 14:40:32
Please , gameini for send variable and call variable example
Size43 (Administrator) on 6 Jul 2014, 15:03:12
A value can be written to a GameINI like this:

gms_ini_game_write("Some", "Variable", some_variable)


It can then be read like this:

some_variable = gms_ini_game_read("Some", "Variable")
Katliyam34 on 6 Jul 2014, 15:08:15
Thx.

some_variable=20;
gms_ini_game_write("Life", "ZombieLife", some_variable) ;

return;

Zombielife = 20 ;

variable2= gms_ini_game_read("Life", "ZombieLife")

return;

variable2=20;

Is it true ?
Size43 (Administrator) on 6 Jul 2014, 15:09:49
If you want to save the variable Zombielife to the INI, you'll need to replace some_variable with Zombielife :)
Katliyam34 on 6 Jul 2014, 15:16:34
this is example :D , my game is similar gladiatus ( bitefight , barafranca ) , i send global.playerid and global.life ( or global.gold... ) and i call but i no want log in or register system
Size43 (Administrator) on 6 Jul 2014, 15:18:52
If you want to save variables that are different for every player, but you don't want them to have to log in you could generate a random username for them, and log them in automatically.

If you do want to save the variables to a GameINI, I'm afraid I do not understand what you're trying to do...
Katliyam34 on 6 Jul 2014, 15:23:51
Yeap , i am generate random playerid ( global.playerid=random(9999999) ) i no want log in and register system. sorry my bad english.

first ;

global.playerid=random(99999);

return ; global.playerid=9;

i want player9 , global life , gold , ammo send and later call.
Size43 (Administrator) on 6 Jul 2014, 15:27:02
You could append the playerID to the section if you really want to use gameINIs:
gms_ini_game_write("Life" + string(global.playerid), "ZombieLife", some_variable) ;
Katliyam34 on 6 Jul 2014, 15:30:03
Thank you , but how to read ? , first check up player id but i dont know can
Size43 (Administrator) on 6 Jul 2014, 16:02:38
You'll need to save the player id locally, in a normal INI file or something like that :)
Katliyam34 on 6 Jul 2014, 18:32:41
I was doing experiments on example , but error ;
http://i.hizliresim.com/Z2Ng10.png :(
Size43 (Administrator) on 6 Jul 2014, 18:54:30
gms_settings(...) must be called before any other GameMaker Server function, but after gms_init. You're probably calling gms_ini_write or gms_ini_read before gms_settings is called. gms_settings needs to be the first GameMaker Server function that's called.
Katliyam34 on 6 Jul 2014, 19:07:50
Oh , i dont know. i am try but i dont know use gms_settings.. are you give me example ?
Size43 (Administrator) on 6 Jul 2014, 19:17:03
It's only about the order in which the functions are. You've probably got something like this:

gms_ini_write...
gms_ini_write...
gms_ini_write...
gms_settings(...)


Change it to this:
gms_settings(...)
gms_ini_write...
gms_ini_write...
gms_ini_write...
Katliyam34 on 6 Jul 2014, 19:24:17
are you help me on teamviewer ? http://i.hizliresim.com/bQ88JV.png
Size43 (Administrator) on 6 Jul 2014, 19:31:05
The connection to the server may not be established in the create event. Try moving your gms_ini functions to an alarm that's set to 30 steps :)
Katliyam34 on 6 Jul 2014, 20:32:04
Yes , i can but error :D ,http://i.hizliresim.com/bQ8QBd.png
Katliyam34 on 7 Jul 2014, 13:06:37
my test project help me please ,http://s3.dosya.tc/s...u2.gmx.rar.html , rebuild for me please :)
Size43 (Administrator) on 7 Jul 2014, 14:26:01
You should add the extension as an extension, not just load the scripts. Adding an extension to your game is described in this tutorial.

It's also quite important that you put the GMS object in the first room. Furthermore, you should not put the "other player object" in a room. That's automatically done by the extension.

Lastly, if you're disabling simple mode (gms_settings), you can also just enter -1 for the player and other player object, since disabling the simple mode will turn off a lot of the useful features. (read: you should probably use simple mode)
Katliyam34 on 7 Jul 2014, 22:38:22
i send " gms_ini_game_write("Paralar", "Para", global.para) ; " and call " global.para=gms_ini_player_read("Paralar", "Para"); " but return 0 variable (global.para) not 0 why ?
Katliyam34 on 7 Jul 2014, 22:39:46
oh , i send game ini but i call player ini sorry , i try :D
Katliyam34 on 7 Jul 2014, 22:43:32
it was thx. :)