News UnrealEd Files Mods FragBU Liandri Archives
BeyondUnreal Forums

Go Back   BeyondUnreal Forums > Unreal Development > Coding

Reply
 
Thread Tools Display Modes
Old 13th Mar 2011, 08:10 PM   #1
The_Cowboy
Registered User
 
The_Cowboy's Avatar
 
Join Date: Jun. 18th, 2010
Posts: 61
storing variables on client machine

How can I store variables on client(in some ini) for a mod and access/modify it as and when required?
The_Cowboy is offline   Reply With Quote
Old 14th Mar 2011, 09:18 AM   #2
gopostal
Registered User
 
Join Date: Jan. 19th, 2006
Posts: 673
PlayerOwner.SaveConfig();
gopostal is offline   Reply With Quote
Old 15th Mar 2011, 07:52 PM   #3
The_Cowboy
Registered User
 
The_Cowboy's Avatar
 
Join Date: Jun. 18th, 2010
Posts: 61
where are the variables stored, I mean which ini?And how can I access them???
The_Cowboy is offline   Reply With Quote
Old 15th Mar 2011, 08:04 PM   #4
gopostal
Registered User
 
Join Date: Jan. 19th, 2006
Posts: 673
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?
gopostal is offline   Reply With Quote
Old 15th Mar 2011, 08:12 PM   #5
The_Cowboy
Registered User
 
The_Cowboy's Avatar
 
Join Date: Jun. 18th, 2010
Posts: 61
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 by The_Cowboy; 15th Mar 2011 at 08:14 PM.
The_Cowboy is offline   Reply With Quote
Old 15th Mar 2011, 08:18 PM   #6
gopostal
Registered User
 
Join Date: Jan. 19th, 2006
Posts: 673
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.
gopostal is offline   Reply With Quote
Old 18th Mar 2011, 06:35 AM   #7
Gizzy
The Banhammer Cometh
 
Gizzy's Avatar
 
Join Date: May. 30th, 2009
Location: United Kingdom
Posts: 195
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 by Gizzy; 18th Mar 2011 at 06:41 AM.
Gizzy is offline   Reply With Quote
Old 18th Mar 2011, 09:00 AM   #8
The_Cowboy
Registered User
 
The_Cowboy's Avatar
 
Join Date: Jun. 18th, 2010
Posts: 61
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.
The_Cowboy is offline   Reply With Quote
Old 18th Mar 2011, 03:03 PM   #9
gopostal
Registered User
 
Join Date: Jan. 19th, 2006
Posts: 673
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.
gopostal is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 06:04 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.

Copyright ©1998 - 2012, BeyondUnreal, Inc.
Privacy Policy | Terms of Use
Bandwidth provided by AtomicGamer