[UT'99] Config problem.

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Raven

Member
Jan 17, 2004
147
0
16
40
turniej.unreal.pl
I've created Hi-Score, and I want to save it in .ini. Specially for this I have created this Scripts.

Code:
class RabbitEndGameTrigger extends Triggers;


function Touch(actor Other)
{
   local RabbitScoreKeeper scoreholder;
   local string TPName;
   local int TPScore, TPDiff;  
   local RabbitHSClient RHS;
   Instigator=pawn(Other);

   ScoreHolder=RabbitScoreKeeper(RabbitPlayer(Instigator).FindInventoryType(class 'RabbitScoreKeeper'));

   TPName=RabbitPlayer(Instigator).PlayerReplicationInfo.PlayerName;
   TPScore=RabbitPlayer(Instigator).ScoreHolder.Score;
   TPDiff=Level.Game.Difficulty;
   Class'RabbitHSClient'.SaveScores(TPName, TPSCore, TPDiff);
   
   Disable('Touch');
}
Code:
class RabbitHSClient extends UMenuDialogClientWindow
	config(RabbitGame);

var config string TPlayerName[10];
var config int TPlayerScore[10];
var config string TPlayerDiff[10];
var string difficulties[4];

//This will be High Score Window. Now it can only save scores...

function SaveScores(string TPName, int TPScore, string TPDiff)
{
        local int i;
        local string TName;
        local int TScore;
        local string TDiff;

        if(TPlayerScore[9] < TPScore){
           TPlayerName[9]=TPName;
           TPlayerScore[9]=TPScore;
           TPlayerDiff[9]=difficulties[TPDiff];
        }
        
        for (i=9; i>1; i--){
             if(TPlayerScore[i] > TPlayerScore[i-1]){
                TName=TPlayerName[i-1];
                TScore=TPlayerScore[i-1];
                TDiff=TPlayerDiff[i-1];

                TPlayerName[i-1]=TPlayerName[i];
                TPlayerScore[i-1]=TPlayerScore[i];
                TPlayerDiff[i-1]=TPlayerDiff[i];

                TPlayerName[i]=TName;
                TPlayerScore[i]=TScore;
                TPlayerDiff[i]=TDiff;
             }

        }

	StaticSaveConfig();
}

defaultproperties
{
     Difficulties(0)="Easy"
     Difficulties(1)="Medium"
     Difficulties(2)="Hard"
     Difficulties(3)="Unreal"
}
Code:
class RabbitScoreKeeper expands TournamentPickup;

var travel int Score;

RabbitPlayer is just another UnrealPlayer class (new model).

When I try to compile this I have an error (RabbitEndGameTrigger):
Unrecognized member 'SaveScores' in class 'Class'
And I can't read value of Score in RabbitScoreKeeper (RabbitEndGameTrigger line TPScore=RabbitPlayer(Instigator).ScoreHolder.Score; ).

Anyone can help me?
 
Last edited:

porkmanii

New Member
Sep 9, 2004
129
0
0
Australia, Qld
Obviously, SaveScores is not a member of 'Class', it is a member of RabbitHSClient. You need to have a reference to an instance of a RabbitHSClient, or make the SaveScores function static, and call:
Code:
Class'RabbitHSClient'.[b]static.[/b]SaveScores(TPName, TPSCore, TPDiff);
You can only access default values of variables in static functions, so you'd need to set the default of the variable. i.e.
Code:
// where you have:
TPlayerName[9]=TPName;
// you'd need:
default.TPlayerName[9]=TPName;
Do that for all of the variables of RabbitHSClient which you are changing (excluding local variables and paramaters, of course).

If you don't want to do all that, you'll have to create an instance of a RabbitHSClient, and then call the SaveScores function of that. Just remember that StaticSaveConfig() is a static function which saves the default values of config variables to an ini file. If you want to save values of config variables for an instance of a RabbitHSClient, have it call SaveConfig().