UE1 - UT storing variables on client machine

  • 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.

The_Cowboy

Member
Jun 18, 2010
61
0
6
How can I store variables on client(in some ini) for a mod and access/modify it as and when required?
 

gopostal

Active Member
Jan 19, 2006
848
47
28
If you have to ask like that, it's above your pay grade. I don't mean for that to sound so condescending but if you are planning on pursuing something like this you better know what you are doing before you start writing to people's ini files, ESPECIALLY default ones.

What exactly are you trying to do?
 

The_Cowboy

Member
Jun 18, 2010
61
0
6
Why *sometimes*, people dont give straightforward answers?
Read the question again.I want to store a variable(belonging to my class) on client's computer and access it as and when required.This is what we call clientside settings.No fancy stuff.I am not modifying variables of other classes.
 
Last edited:

gopostal

Active Member
Jan 19, 2006
848
47
28
I gave you a straightforward answer. You use SaveConfig to save your declared variables. Since you don't understand how to create an ini file on a client (and it appears you are fuzzy on declaring variables and how they are used), it's going to be pretty hard for you to write to it.

Send me your current code and tell me what you want to accomplish. We can go from there. I have a feeling you aren't really asking the question you really want to ask.
 

Gizzy

The Banhammer Cometh
May 30, 2009
195
0
0
United Kingdom
I made a .ini file and added [Package.Class] (Where package.class is, you put your own custom package.class where you are calling SaveConfig(); from)

Once SaveConfig(); was called in my mod, the variables in code were saved to the .ini file. ResetConfig(); can be used to reset the variables in code to the ones currently listed in your .ini (At least that's how I've been taught how they work)

Here's an example snippet from my own mod. It's an item that when activated, brings up a UWindow GUI and the user can summon weapons easily. The weapons that can be summoned (Supports up to 50) are defined the .ini file.

This is my first step in UWindow modding, so the code may be a bit fuzzy.

Code:
//=============================================================================
// UShopClientWin.
//=============================================================================
class UShopClientWin expands UWindowDialogClientWindow Config(UShop);

// Configurable weapon list
Var Config Class <Weapon> ShopWeapons[50]; // List of weapons

Var UWindowSmallButton Button_Weapon0;

function Created()
{
	ResetConfig(); // Reset ShopWeapons to whatever is in my .ini
	Super.Created();

        Button_Weapon0 = UWindowSmallButton(CreateWindow(class'UWindowSmallButton', WinWidth/2-122, WinHeight/2-20, 120, 16));
	Button_Weapon0.SetText(""$ShopWeapons[0].Name); // Get the name of the first weapon and print the text to the button
	Button_Weapon0.Register(Self);
}

function Notify(UWindowDialogControl C, byte E)
{
	/* Click types: DE_Created, DE_Change, DE_Click, DE_Enter, DE_Exit, DE_MClick, DE_RClick, DE_EnterPressed, DE_MouseMove,
	DE_MouseLeave, DE_LMouseDown, DE_DoubleClick, DE_MouseEnter, DE_HelpChanged, DE_WheelUpPressed, DE_WheelDownPressed. */

if( E==DE_Click && C==Button_Weapon0 )
	{
		GetPlayerOwner().Summon(""$ShopWeapons[0]); // Summon the first weapon in the list in our .ini
		// OwnerWindow.Close();
	}
}


And in my .ini:

Code:
[UShop.UShopClientWin]
ShopWeapons[0]=Class'UnrealI.Quadshot'
 
Last edited:

The_Cowboy

Member
Jun 18, 2010
61
0
6
Thanks for the nice reply.

Yeah thats right.But the problem is that server should also be able to access those variables.The example you gave allows only the client computer to access the variables stored and make the desired Uwindow.
 

gopostal

Active Member
Jan 19, 2006
848
47
28
What use would the server have for a UWindow anyway :)

The server accesses all variables like this, otherwise they wouldn't replicate to you. It's a simple matter to let the server also write to the ini.

A variable by it's very nature implies that there is some difference that the server needs to be aware of and share with the client the results of it's decision. There are a few examples of 'player only' variables (like crosshair choice, video driver) that don't replicate to the server but by and large most all do.

You just keep halfway asking your question. Put it out there and ask. Hell, one of us will write the code for you to use.