Author Topic: Apply changes in prefs.cs  (Read 1480 times)

So, I've got a script which toggles
Code: [Select]
$pref::Input::UseAutoReturnSteering
It works fine, However the effect won't apply untill you go into the options and press "done".

Is there any way of doing this via my script?

The effects should be applied right when you change $pref::Input::UseAutoReturnSteering, it's just not exported.
To export client prefs just do export("$Pref::*", "config/client/prefs.cs");

So i did this:
Code: [Select]
if($pref::Input::UseAutoReturnSteering == 0)
{
clientcmdbottomprint("On", 3, 1);
$pref::Input::UseAutoReturnSteering = 1;
export("$Pref::*", "config/client/prefs.cs");
}

And it still won't change untill i go hit done in the options.

Is there something i'm doing wrong?
« Last Edit: March 15, 2015, 10:30:51 AM by The 1 »

Forget the export line, that's almost certainly outside the scope of your mod. There's actually a specific method you need to call, and it's from the engine so I don't think it shows up in trace. First check if ServerConnection exists, and if so, call ServerConnection.transmitSteeringPrefs();

The mod is clientside.

The mod is clientside.
ServerConnection is a client sided object.

isnt there just a way to call: OptionsDlg::(whatever the "done" button is called)?

First check if ServerConnection exists, and if so, call ServerConnection.transmitSteeringPrefs();

isnt there just a way to call: OptionsDlg::(whatever the "done" button is called)?
Yes, and you're not going to do that because that deletes and regenerates several HUD elements, exports all your preferences, and sends all your avatar settings, too.

"ServerConnection." Look at it. Server. Connection. The connection to a server. That's what clients do - they connect to servers. That's an object that exists on the client when they're connected to a server. So you check if that object exists to find out if they're connected to a server, and if so you call what is literally the perfect method for what you are trying to do.