View Full Version : UE1 - UT storing variables on client machine
13th Mar 2011, 09:10 PM
How can I store variables on client(in some ini) for a mod and access/modify it as and when required?
14th Mar 2011, 10:18 AM
15th Mar 2011, 08:52 PM
where are the variables stored, I mean which ini?And how can I access them???
15th Mar 2011, 09:04 PM
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?
15th Mar 2011, 09:12 PM
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.
15th Mar 2011, 09:18 PM
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.
18th Mar 2011, 07:35 AM
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.
class UShopClientWin expands UWindowDialogClientWindow Config(UShop);
// Configurable weapon list
Var Config Class <Weapon> ShopWeapons; // List of weapons
Var UWindowSmallButton Button_Weapon0;
ResetConfig(); // Reset ShopWeapons to whatever is in my .ini
Button_Weapon0 = UWindowSmallButton(CreateWindow(class'UWindowSmallButton', WinWidth/2-122, WinHeight/2-20, 120, 16));
Button_Weapon0.SetText(""$ShopWeapons.Name); // Get the name of the first weapon and print the text to the button
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); // Summon the first weapon in the list in our .ini
And in my .ini:
18th Mar 2011, 10:00 AM
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.
18th Mar 2011, 04:03 PM
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.
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.