1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. 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.

UE1 - UT storing variables on client machine

Discussion in 'Programming' started by The_Cowboy, Mar 13, 2011.

  1. The_Cowboy

    The_Cowboy Member

    Joined:
    Jun 18, 2010
    Messages:
    61
    Likes Received:
    0
    How can I store variables on client(in some ini) for a mod and access/modify it as and when required?
     
  2. gopostal

    gopostal Active Member

    Joined:
    Jan 19, 2006
    Messages:
    822
    Likes Received:
    46
    PlayerOwner.SaveConfig();
     
  3. The_Cowboy

    The_Cowboy Member

    Joined:
    Jun 18, 2010
    Messages:
    61
    Likes Received:
    0
    where are the variables stored, I mean which ini?And how can I access them???
     
  4. gopostal

    gopostal Active Member

    Joined:
    Jan 19, 2006
    Messages:
    822
    Likes Received:
    46
    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?
     
  5. The_Cowboy

    The_Cowboy Member

    Joined:
    Jun 18, 2010
    Messages:
    61
    Likes Received:
    0
    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: Mar 15, 2011
  6. gopostal

    gopostal Active Member

    Joined:
    Jan 19, 2006
    Messages:
    822
    Likes Received:
    46
    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.
     
  7. Gizzy

    Gizzy The Banhammer Cometh

    Joined:
    May 30, 2009
    Messages:
    195
    Likes Received:
    0
    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: Mar 18, 2011
  8. The_Cowboy

    The_Cowboy Member

    Joined:
    Jun 18, 2010
    Messages:
    61
    Likes Received:
    0
    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.
     
  9. gopostal

    gopostal Active Member

    Joined:
    Jan 19, 2006
    Messages:
    822
    Likes Received:
    46
    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.
     

Share This Page