Low Caliber Forum
Saving variables to .ini

This topic can be found at:
http://lowcaliber.com/eve/forums/a/tpc/f/3886011002/m/7696019034

Thu September 18 2003, 10:14 PM
Methril
Saving variables to .ini
Alright I have my record mutator working as shownames with Scores/Deaths beside the name text above a player. It works great I belive^^. Now the next step is for me to create a .ini file in my system folder that stores everyones name and Score/Deaths. My question is, how would I go about saving and recalling the name, scores and death variables ?
==================================================
PScore = P.PlayerReplicationInfo.Score;
PDeaths = P.PlayerReplicationInfo.Deaths;
PText = "/";
PName = P.PlayerReplicationInfo.PlayerName; PName = P.PlayerReplicationInfo.PlayerName;
Canvas.SetPos(SX-(32*scale)*0.5, SY-(32*scale));

if(scale>0.3)
Canvas.Font = Canvas.MedFont;
else
return;
Canvas.DrawText(PName @PScore@PText@PDeaths);
==================================================
anyone? Eek

thanks
Fri September 19 2003, 02:19 AM
Unter den Uebrigen
It's a three step process; first, declare your class to be “config”, followed by the name of the *.ini in parentheses:
class myClass extends someClass config(myConfig)
Next, declare your variables correctly:
var() config float mvVar;
And at some arbitrary point in your class, run the SaveConfig() function.  LoadConfig() calls the variables from the *.ini.
function PostBeginPlay() {
	Super.PostBeginPlay();
	SaveConfig();
}

Fri September 19 2003, 11:07 AM
Methril
Loadconfig doesnt compile
==================================================
class ladder extends Mutator config(ladder);

var() config string PName;
var() config int PScore ;
var() config int PDeaths ;


// Called before gameplay starts
function PostBeginPlay() {
Super.PostBeginPlay();
SaveConfig();
}


// Called each time there is a kill
function ScoreKill(Pawn Killer, Pawn Other)
{
Super.ScoreKill(Killer, Other);
LoadConfig();
}
==================================================


Fri September 19 2003, 02:49 PM
Methril
under info statlog there are a lot of good examples you can use too

helpful
Fri September 19 2003, 07:12 PM
Unter den Uebrigen
Originally posted by Methril:
Loadconfig doesnt compile
Whoops; ResetConfig().  See object.uc, line 350.