Game Development Community

Prefs not loading

by Stephen · in Torque Game Engine · 05/11/2006 (6:03 pm) · 4 replies

I have add to the startMission.gui the option to change the Server Name, Server Info, Max Players, and Timelimit. It works fine but when I restart the game their not there. I have added the Server Name, etc.. to the defaults.cs on the client but it still doesnt load. In the starter.fps, I also noticed that the players name doesnt show up to, so I search the forum and couldn't find thing to fix it.

I have looked at this thread but I don't understand it.

Thanks

#1
05/11/2006 (6:15 pm)
This is definitely a spot of confusion.
Short answer:
find all files named "prefs.cs" and delete them.

Long answer:
When your app runs for the very first time,
it loads defaults.cs and that it. Simple.

However, every time the app exits, it writes all the $pref:: values into prefs.cs,
and then when your app runs the second time what it does is:
1. load defaults.cs
2. load prefs.cs, which overrides all the values in defaults.cs.

One way to think of defaults.cs is "the default preferences settings, but not the preferences settings themselves".

But anyhow, the short answer works.
#2
05/11/2006 (6:16 pm)
Also,
be aware that there's a defaults.cs and prefs.cs for both the client and the server.
#3
05/11/2006 (6:41 pm)
Also, in TGE 1.4 and TSE MS3 there's a problem with the prefs not saving/loading correctly. There was a fix around here for the text entry ones, but I also use slider controls which don't get saved or loaded right. It's an issue.

Edit: Text entry problems are fixed here, but not all the prefs.cs issues.

From Stefan Beffy Moises: Replace the setText() function in guiTextEditCtrl.cpp with this:
void GuiTextEditCtrl::setText( const char *txt )
{	
	if(txt && txt[0] != 0)
	{		
		Parent::setText( txt );
		mTextBuffer.set( txt );
	}
	else
		mTextBuffer.set( "" );
 
   mCursorPos = mTextBuffer.length();
}
#4
05/11/2006 (6:47 pm)
Okay, launch the "starter.fps" in the SDK from a fresh install of TGE 1.4. Go to "Start Mission", notice that in the players name nothing is there. So you put your name in there, then lets say you restart the whole game and start a new mission. Notice your name that you just put in there isnt there, its blank.

That's the problem, it doesn't load from the prefs. Even if I delete the prefs.cs, "Frest Mest" should be displaying as the players name.