Jump to content

Recommended Posts

Hello, I can't remember the list of what gets sent over when you click and rscButton via a createDialog. Which Select # is it? 0 and 1 wasn't working.

Share this post


Link to post
Share on other sites

So when the player selects a button created via the GUI editor, I want to get the object that executes it, obviously this is the player but like, for example when you run an action, you use _this select 1; to get grab the player and then can use this in a script. Depending on which button the player selects, it takes them somewhere. In mutliplayer I obviously can't just use player and hope. My question is which select # is for while using dialogs as I couldn't find any documentation on it.

Share this post


Link to post
Share on other sites

It doesn't work like that. You can use player just fine since the dialog is on client, etc... What are you trying to do exactly? I may be able to help you better.

Share this post


Link to post
Share on other sites

You should describe your exact problem instead of asking for some button/menu behavior. You can add player addAction, even in MP (hopefully)..

Share this post


Link to post
Share on other sites

So I have a GUI setup that allow players to select which unit they're in. this execed via the

initPlayerLocal.sqf

Spoiler

sleep 1;
titlecut ["","BLACK",0];

player addAction ["Open Menu", "scripts\Misc\MenuInit.sqf"];
0 = [player] execVM "Scripts\Misc\WelcomePlayer.sqf";

 

 

Within my WelcomePlayer.sqf

Spoiler

createDialog "CUR_Welcome_GUI";

User = _this select 0;

hint parseText format["<t size='2' color='#f44242'>DEBUG</t><br />Dialog Created", 12];

 

 

Now this works fine so far and I haven't had an issue with double declaring, you know where player becomes everyone, thanks to it being executed from the initPlayerLocal.sqf, however when they respawn, they're not longer that old object and need to be declared again. I tried just resetting the variable but I came into all kinds of issues like it taking everyone there, or sometimes not even working. I was just wondering if there was a quick way of getting WHO clicked the button, so I can just keep it confined and be done with it.

 

If you need my dialog, here is the CUR_Welcome_GUI

Spoiler


class CUR_Welcome_GUI
{
    idd = -1;
    movingEnabled = false;

    class Controls
    {

        class CUR_Background: IGUIBack
        {
            idc = 2200;
            x = 0.335 * safezoneW + safezoneX;
            y = 0.181 * safezoneH + safezoneY;
            w = 0.33 * safezoneW;
            h = 0.66 * safezoneH;
        };
        class CUR_Text_Title: RscText
        {
            idc = 1000;
            text = "Curious' Charming Clan Selector"; //--- ToDo: Localize;
            x = 0.443281 * safezoneW + safezoneX;
            y = 0.181 * safezoneH + safezoneY;
            w = 0.118594 * safezoneW;
            h = 0.044 * safezoneH;
            sizeEx =
        };
        class CUR_Button_ColdstreamGuards: RscButton
        {
            idc = 1600;
            text = "1st Battalion the Coldstream Guards"; //--- ToDo: Localize;
            x = 0.355625 * safezoneW + safezoneX;
            y = 0.247 * safezoneH + safezoneY;
            w = 0.134062 * safezoneW;
            h = 0.055 * safezoneH;
            action = "closeDialog 0; createDialog ""CUR_Selection_ColdstreamGuards"";";
        };
        class CUR_Text_Subtitle: RscText
        {
            idc = 1001;
            text = "Please select the unit that you're in. If you enter a problem, contact the developers."; //--- ToDo: Localize;
            x = 0.355625 * safezoneW + safezoneX;
            y = 0.775 * safezoneH + safezoneY;
            w = 0.293906 * safezoneW;
            h = 0.055 * safezoneH;
        };
        class CUR_Button_188Rangers: RscButton
        {
            idc = 1601;
            text = "188th Infantry Regiment"; //--- ToDo: Localize;
            x = 0.355625 * safezoneW + safezoneX;
            y = 0.324 * safezoneH + safezoneY;
            w = 0.134062 * safezoneW;
            h = 0.055 * safezoneH;
            action = "closeDialog 0; createDialog ""CUR_188thInfantryRegiment"";";
        };
        class CUR_Button_2_Battalion_7_Marines: RscButton
        {
            idc = 1602;
            text = "2nd Battalion 7th Marines"; //--- ToDo: Localize;
            x = 0.355625 * safezoneW + safezoneX;
            y = 0.401 * safezoneH + safezoneY;
            w = 0.134062 * safezoneW;
            h = 0.055 * safezoneH;
            action = "closeDialog 0; createDialog ""CUR_Default_2_Battalion_7_Marines"";";
        };
        class CUR_Button_TFP: RscButton
        {
            idc = 1603;
            text = "Task Force Paladin"; //--- ToDo: Localize;
            x = 0.510312 * safezoneW + safezoneX;
            y = 0.247 * safezoneH + safezoneY;
            w = 0.134062 * safezoneW;
            h = 0.055 * safezoneH;
            action = "closeDialog 0; createDialog ""CUR_Default_TFP"";";
        };
        class CUR_Button_GreenSeaBattalion: RscButton
        {
            idc = 1604;
            text = "Green Sea Battalion"; //--- ToDo: Localize;
            x = 0.510312 * safezoneW + safezoneX;
            y = 0.324 * safezoneH + safezoneY;
            w = 0.134062 * safezoneW;
            h = 0.055 * safezoneH;
            action = "closeDialog 0; createDialog ""CUR_Default_GreenSeaBattalion"";";
        };
        class CUR_Button_43Commando: RscButton
        {
            idc = 1605;
            text = "43 Commando"; //--- ToDo: Localize;
            x = 0.510312 * safezoneW + safezoneX;
            y = 0.401 * safezoneH + safezoneY;
            w = 0.134062 * safezoneW;
            h = 0.055 * safezoneH;
            action = "closeDialog 0; createDialog ""CUR_Default_43Commando"";";
        };
        class CUR_Button_43CommandoSBS: RscButton
        {
            idc = 1606;
            text = "43 Commando SBS"; //--- ToDo: Localize;
            x = 0.355625 * safezoneW + safezoneX;
            y = 0.478 * safezoneH + safezoneY;
            w = 0.134062 * safezoneW;
            h = 0.055 * safezoneH;
            action = "closeDialog 0; createDialog ""CUR_Default_43CommandoSBS"";";
        };
        class CUR_Button_22SAS: RscButton
        {
            idc = 1607;
            text = "22nd SAS"; //--- ToDo: Localize;
            x = 0.510312 * safezoneW + safezoneX;
            y = 0.478 * safezoneH + safezoneY;
            w = 0.134062 * safezoneW;
            h = 0.055 * safezoneH;
            action = "closeDialog 0; createDialog ""CUR_Default_22SAS"";";
        };
        class CUR_Button_2MarineDivision: RscButton
        {
            idc = 1608;
            text = "2nd Marine Division"; //--- ToDo: Localize;
            x = 0.355625 * safezoneW + safezoneX;
            y = 0.555 * safezoneH + safezoneY;
            w = 0.134062 * safezoneW;
            h = 0.055 * safezoneH;
            action = "closeDialog 0; createDialog ""CUR_Default_2MarineDivision"";";
        };
        class CUR_Button_PathFinders: RscButton
        {
            idc = 1609;
            text = "The PathFinders"; //--- ToDo: Localize;
            x = 0.510312 * safezoneW + safezoneX;
            y = 0.555 * safezoneH + safezoneY;
            w = 0.134062 * safezoneW;
            h = 0.055 * safezoneH;
            action = "closeDialog 0; createDialog ""CUR_Default_PathFinders"";";
        };
        class CUR_Button_Blank2: RscButton
        {
            idc = 1610;
            text = "*BLANK*"; //--- ToDo: Localize;
            x = 0.355625 * safezoneW + safezoneX;
            y = 0.632 * safezoneH + safezoneY;
            w = 0.134062 * safezoneW;
            h = 0.055 * safezoneH;
        };
        class CUR_Button_Blank3: RscButton
        {
            idc = 1611;
            text = "*BLANK*"; //--- ToDo: Localize;
            x = 0.510312 * safezoneW + safezoneX;
            y = 0.632 * safezoneH + safezoneY;
            w = 0.134062 * safezoneW;
            h = 0.055 * safezoneH;
        };
        class CUR_Button_Blank4: RscButton
        {
            idc = 1612;
            text = "*BLANK*"; //--- ToDo: Localize;
            x = 0.355625 * safezoneW + safezoneX;
            y = 0.709 * safezoneH + safezoneY;
            w = 0.134062 * safezoneW;
            h = 0.055 * safezoneH;
        };
        class CUR_Button_Blank: RscButton
        {
            idc = 1613;
            text = "*BLANK*"; //--- ToDo: Localize;
            x = 0.510312 * safezoneW + safezoneX;
            y = 0.709 * safezoneH + safezoneY;
            w = 0.134062 * safezoneW;
            h = 0.055 * safezoneH;
        };

    };

};

 

As for the actions, I clearly stated it was an example.

Share this post


Link to post
Share on other sites
2 hours ago, 56Curious said:

I was just wondering if there was a quick way of getting WHO clicked the button,

As the others have said, a UI is local to a client (a machine with a user (player)) and is running for this client only. All other clients will be running their own copy of the UI on their own machine. So player (the command) is always the person who clicked the button.

2 hours ago, 56Curious said:

User = _this select 0;

There is no need to define a global variable called User, as a user (client) will always be the player which you can get with the command player. You have passed in player to your script from which you then define User from in the first place, which is where your problems are coming from when using User as a reference to the player, User is referencing a specific unit but after respawning this unit is no longer the player but player (the command) will always be the unit the client is using.

2 hours ago, 56Curious said:

you know where player becomes everyone,

Player should never ever become everyone. Player will always return the unit a client is using to play the game with. The only time this will be any different is on a dedicated server where player will be ObjNull. In which case, there could never be a UI as a dedicated server has no interface.

 

Hope that makes sense, I have tried to make it as clear a possible by using bold when talking about the scripting command player.

  • Like 2

Share this post


Link to post
Share on other sites
15 hours ago, Larrow said:

Player should never ever become everyone. Player will always return the unit a client is using to play the game with. The only time this will be any different is on a dedicated server where player will be ObjNull. In which case, there could never be a UI as a dedicated server has no interface.

Within the dedicated environment, I can use player yes?

 

I hate multiplayer scripting with a passion.

Share this post


Link to post
Share on other sites
43 minutes ago, 56Curious said:

I hate multiplayer scripting with a passion.

Fuckin' A!

  • Like 1
  • Haha 2

Share this post


Link to post
Share on other sites
4 hours ago, 56Curious said:

Within the dedicated environment, I can use player yes?

I think you confuse yourself with the term 'dedicated environment'. The client maybe playing on a dedicated server but his environment is a client environment.

If you mean can you use player on a client connected to a dedicated server, then yes.

Share this post


Link to post
Share on other sites

Thank you Larrow, got it working last night with player. Hopefully all goes well.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×