Jump to content

sbondo1234

Member
  • Content Count

    56
  • Joined

  • Last visited

  • Medals

Posts posted by sbondo1234


  1. 2 minutes ago, HazJ said:

    No problem. You're welcome. Obviously go over the code to improve and understand things. If there is anything you don't understand, just ask.

    Sure will! I have kind of used switch/case statements before when making an earplugs script, so I kind of understand it but not much.


  2. 47 minutes ago, HazJ said:

    Inside.

    
    _lb ctrlAddEventHandler ["LBSelChanged",
    {
    	params ["_control", "_selectedIndex"];
    	private _display = findDisplay 2001;
    	_text = _display displayCtrl 5546;
    	switch (_control lbText _selectedIndex) do
    	{
    		case "Spawn A Vehicle" :
    		{
    			_text ctrlSetStructuredText parseText "Some vehicle...";
    		};
    		case "Gun on Back" :
    		{
    			_text ctrlSetStructuredText parseText "...";
    		};
    		default
    		{
    			// default...
    			_text ctrlSetStructuredText parseText "Test";
    		};
    	};
    }];

     

    Sorry for late reply, was gone doing something but thanks for all the help! Works great!

    Going to work on making it look nicer now!


  3. 8 minutes ago, HazJ said:

    A few ways. First that springs to mind is a switch block.

    
    switch (_control lbText _selectedIndex) do
    {
    	case "Spawn A Vehicle" :
    	{
    		_text ctrlSetStructuredText parseText "Some vehicle...";
    	};
    	case "Gun on Back" :
    	{
    		_text ctrlSetStructuredText parseText "...";
    	};
    	default
    	{
    		// default...
    		_text ctrlSetStructuredText parseText "Test";
    	};
    };

    https://community.bistudio.com/wiki/switch_do

    Sorry, where would I add this?

    I tried replacing it with _lb ctrlAddEventHandler and it gave some error.


  4. @HazJ Thanks for the mission download, I'm not sure what I did wrong but it seemed to fix whatever I did. 

     

    I Understand this line is changing the structuredText to the name of the List Box Option selected?

    _text ctrlSetStructuredText parseText format ["%1", _control lbText _selectedIndex];

    How would I make it so whenever you clicked on an option I could write in what they see instead of them seeing the name of the option they clicked?


  5. My files:

    //sg_dialogs.hpp
    class sg_list_1
    		{
    			type = 5;
    			idc = 5545;
    			onLoad = [] spawn sg_fnc_openHelp;
                onLBDblClick = [] spawn sg_fnc_helpInfo;
    			x = safeZoneX + safeZoneW * 0.343125;
    			y = safeZoneY + safeZoneH * 0.37555556;
    			w = safeZoneW * 0.10375;
    			h = safeZoneH * 0.24;
    			style = 16;
    			colorBackground[] = {0.302,0.302,0.302,0.4683};
    			colorDisabled[] = {0.302,0.302,0.302,0.4841};
    			colorSelect[] = {1,1,1,1};
    			colorText[] = {1,1,1,0.381};
    			font = "PuristaMedium";
    			maxHistoryDelay = 0;
    			rowHeight = 0;
    			sizeEx = (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1);
    			soundSelect[] = {"\A3\ui_f\data\sound\RscListbox\soundSelect",0.09,1.0};
    			class ListScrollBar
    			{
    				color[] = {1,1,1,1};
    				thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
    				arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
    				arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
    				border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
    
    			};
    
    		};
    class sg_helpInfoText_1:RscStructuredText{
                type = 0;
                idc = 5546;
                x = safeZoneX + safeZoneW * 0.4675;
                y = safeZoneY + safeZoneH * 0.38666667;
                w = safeZoneW * 0.126875;
                h = safeZoneH * 0.01;
                style = 0+2;
                text = "Default Text";
                colorBackground[] = {0.9412,0.5843,0.8549,0};
                colorText[] = {1,1,1,1};
                font = "PuristaMedium";
                sizeEx = (((((safezoneW / safezoneH) min 1.2) / 1.2) / 35) * 1);
            };
    	};
    //initPlayerLocal.sqf
    call compile preprocessFile "scripts\sg_dialogs\sg_fnc_help.sqf";
    //sg_fnc_help.sqf
    sg_fnc_openHelp = {
        disableSerialization;
        lbClear 5545;
        {lbAdd[5545,_x]} forEach ["Spawn A Vehicle","Gun On Back","Jumping","Earplugs"];
    };
    
    sg_fnc_helpInfo = {
        disableSerialization;
        private _display = findDisplay 2001;
    
        _text = _display displayCtrl 5546;
        _text ctrlSetStructuredText parseText "You have selected Spawn A Vehicle.";
    };

     


  6. @HazJ I am really confused then... If it works for you then what could I possibly be doing wrong?

     

    I copied your .hpp test code to see if that was the problem and it still didn't work. In fact, I stopped seeing 'Default Text'. I even tried putting my functions in init.sqf instead of its own file but that didn't work either.

     


  7. 15 minutes ago, HazJ said:

    Confirm you can see it then we can look at the next thing.

     

    I could see it when I changed it to default:

    class sg_helpInfoText_1:RscStructuredText{
            	type = 0;
            	idc = 5546;
            	x = safeZoneX + safeZoneW * 0.4675;
            	y = safeZoneY + safeZoneH * 0.38666667;
            	w = safeZoneW * 0.126875;
            	h = safeZoneH * 0.01;
            	style = 0+2;
            	text = "Default Text";
            	colorBackground[] = {0.9412,0.5843,0.8549,0};
            	colorText[] = {1,1,1,1};
            	font = "PuristaMedium";
            	sizeEx = (((((safezoneW / safezoneH) min 1.2) / 1.2) / 35) * 1);
            	moving = false;
    
            };

    http://prntscr.com/mtu9s1


  8. 10 minutes ago, HazJ said:

    Add disableSerialization; in sg_fnc_helpInfo too. This should fix it but if that doesn't then:

    No errors when calling sg_fnc_helpInfo? Correct IDD and IDCs. Try using latest base defines here. Or share your RscStructuredText defines so I can check them. I notice you set style there, etc...

    
    class sg_helpInfoText_1 : RscStructuredText
    {
    	idc = 5546;
    	x = safeZoneX + safeZoneW * 0.4675;
    	y = safeZoneY + safeZoneH * 0.38666667;
    	w = safeZoneW * 0.126875;
    	h = safeZoneH * 0.01;
    	text = "Default text..."; // to see if issue is with SQF code setting new text
    };

     

    I copied the RscStructuredText from the drop box and put it in my defines.hpp, and it still didn't work even with disableSerialization on/off.

    I changed the text to 'Default' and it did show.


  9. 20 minutes ago, HazJ said:

    Oh, I guess I misunderstood too. Create another control type like you did before? Use RscText or RscStructuredText - Give it an IDC, adjust x/y/w/h values, etc...

    
    class whatever : RscStructuredText
    {
    	// stuff...
    };
    
    _text = _display displayCtrl <IDC>; // Replace <IDC> with actual number
    _text ctrlSetStructuredText parseText "You have selected Spawn A Vehicle.";

     

    Sorry, I have just tried it and I still have no idea what is going on. There isn't an error that pops up just nothing happens.

    Might help if I show you the stuff I have rn:

    //sg_dialogs.hpp
    class sg_helpInfoText_1:RscStructuredText{
    	type = 0;
        idc = 5546;
        x = safeZoneX + safeZoneW * 0.4675;
        y = safeZoneY + safeZoneH * 0.38666667;
        w = safeZoneW * 0.126875;
        h = safeZoneH * 0.01;
        style = 0+2;
        text = "";
        colorBackground[] = {0.9412,0.5843,0.8549,0};
        colorText[] = {1,1,1,1};
        font = "PuristaMedium";
        sizeEx = (((((safezoneW / safezoneH) min 1.2) / 1.2) / 35) * 1);
        moving = false;
    };
    //sg_fnc_help.sqf
    sg_fnc_openHelp = {
        disableSerialization;
        lbClear 5545;
        {lbAdd[5545,_x]} forEach ["Spawn A Vehicle","Gun On Back","Jumping","Earplugs"];
    };
    
    sg_fnc_helpInfo = {
        private _display = findDisplay 2001;
    
        _text = _display displayCtrl 5546; // Replace <IDC> with actual number
        _text ctrlSetStructuredText parseText "You have selected Spawn A Vehicle.";
    };

    Whenever I double click on the option in the list box, nothing happens.


  10. 4 minutes ago, HazJ said:
    
    private _lb = _display displayCtrl 5545;
    {
    	_x params ["_leftText", "_rightText"];
    	_lb lbAdd _leftText;
    	_lb lbSetTextRight [_forEachIndex, _rightText];
    } forEach
    [
    	["Item 1", "£200"],
    	["Item 2", "£400"],
    	["Item 3", "£600"]
    ];

    Not tested.

    I use this syntax. Not sure which you should really use, technical details, etc... I know that lbSetTextRight only has the one syntax. Maybe @Larrow will know which to use? Usually one is for dialogs and the other not. However never seen LB use for non dialog. Doesn't make sense to do so?

    Error Undefined Variable in expression: _display. Not really sure what that means. Hopefully, larrow can help with this too.


  11. Hello, I have made a list box and added 4 different option in it. Like this:

    //sg_dialogs.hpp
    class sg_list_1{
    
    	type = 5;
    	idc = 5545;
    	onLoad = [] spawn sg_fnc_openHelp;
    	x = safeZoneX + safeZoneW * 0.343125;
    	y = safeZoneY + safeZoneH * 0.37555556;
    	w = safeZoneW * 0.10375;
    	h = safeZoneH * 0.24;
    	style = 16;
    	colorBackground[] = {0.302,0.302,0.302,0.4683};
    	colorDisabled[] = {0.302,0.302,0.302,0.4841};
    	colorSelect[] = {1,1,1,1};
    	colorText[] = {1,1,1,0.381};
    	font = "PuristaMedium";
    	maxHistoryDelay = 0;
    	rowHeight = 0;
    	sizeEx = (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1);
    	soundSelect[] = {"\A3\ui_f\data\sound\RscListbox\soundSelect",0.09,1.0};
    	class ListScrollBar{
    		color[] = {1,1,1,1};
    		thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
    		arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
    		arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
    		border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
    	};
    };
    //sg_fnc_help.sqf
    sg_fnc_openHelp = {
        disableSerialization;
        lbClear 5545;
        {lbAdd[5545,_x]} forEach ["Spawn A Vehicle","Gun On Back","Jumping","Earplugs"];
    };
    //initPlayerLocal.sqf
    call compile preprocessFile "scripts\sg_dialogs\sg_fnc_help.sqf";

    It works and successfully adds the 4 items into the list box.

     

    I am having a problem when I try to make it add text to the side of the list box depending on which list box item is selected.

    I have another function which I am trying to make change the structured text:

    //sg_fnc_help.sqf
    sg_fnc_helpInfo = {
        _selectedLb = lbCurSel 5545;
            //2001 = idd for dialog. 5545 is idc for structured text.
        _lbText = ((findDisplay 2001) displayCtrl (5545));
    
        if (_selectedLb == 0) then{
            _lbText ctrlSetStructuredText parseText "You have selected Spawn A Vehicle.";
        };
        if (_selectedLb == 1) then{
            _lbText ctrlSetStructuredText parseText "You have selected Gun On Back.";
        };
    };
    //structured text I am trying to change - sg_dialogs.hpp
    class sg_spawnVeh{
                type = 0;
                idc = 5546;
                x = safeZoneX + safeZoneW * 0.52375;
                y = safeZoneY + safeZoneH * 0.39222223;
                w = safeZoneW * 0.048125;
                h = safeZoneH * 0.02444445;
                style = 0;
                text = "";
                colorBackground[] = {0.302,0.302,0.302,0};
                colorText[] = {1,1,1,1};
                font = "PuristaMedium";
                sizeEx = (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1);
    };

    I don't get an error, nothing happens when I double click on any list box item. I haven't really used list boxes before today. Some help would be great!


  12. 3 hours ago, HazJ said:

    Paste full code please. Also, how do you call it? execVM? From where? Please confirm.

    //initPlayerLocal.sqf
    // Check if player has kills saved
    if (isNil {profileNamespace getVariable "sg_kills"}) then {
        profileNamespace setVariable ["sg_kills", 0];
    };
    
    // Get players current kill count and set to player
    _sg_kills = profileNamespace getVariable ["sg_kills", 0];
    player setVariable ["sg_kills", _sg_kills, true]; // True lets everyone on the server know this variable was updated
    
    // Run on all clients in multiplayer when player is killed
    player addMPEventHandler ["MPKilled", {null = _this execVM "scripts\sg_stats.sqf";}];
    // sg_stats.sqf
    params [["_unitKilled", objNull], ["_killer", objNull]]; // https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#MPKilled
    private ["sg_kills"];
    
    // Check if you are the killer
    if (player isEqualTo _killer) then {
    
    	// Update kill count
    	_sg_kills = (player getVariable ["sg_kills", 0]) + 1; // 0 is the default value
    	profileNamespace setVariable ["sg_kills", _sg_kills]; // ProfileNamespace cannot use true with setVariable
    	player setVariable ["sg_kills", _sg_kills, true];
    
    	// Inform user of kill
    	if (_unitKilled in allUnits) then {
    		hint format["You just killed %1, and now your current kill count is %2", name _unitKilled, _sg_kills];
    	};
    };
    
    // Check if your are the one killed
    if (player isEqualTo _unitKilled) then {
        hint "You Are Dead";
    };

    sg_stats.sqf is called in initPlayerLocal


  13. 1 hour ago, HazJ said:

    Good work @NumbNutsJunior

    Couple of notes though:

    
    params [["_unitKilled", objNull], ["_killer", objNull]];

    Having objNull as default value is pointless. Even if you check it with isNull command somewhere since you can just use isNil command.

    
    private ["sg_kills"];

    Typo in sg_stats.sqf file. Add _ in front of the variable

    
    private ["_sg_kills"];
    
    if (isNil {profileNamespace getVariable "sg_kills"}) then {

    No real need for this as you use getVariable with default value.

    When I change the variable in sg_stats.sqf I get an error similar to this http://prntscr.com/mpzgt8, but something on line 53 instead.

     

    I have also just realised a weird error in intelliJ around this code:

    // Check if player has kills saved
    if (isNil {profileNamespace getVariable "sg_kills"}) then {
        profileNamespace setVariable ["sg_kills", 0];
    };

    Error: <statement> expected, got ''.

     

    I don't know if you can make sense of this, but I have no idea what it is talking about.


  14. @NumbNutsJunior

    Thanks for this... I have put everything where it needs to be to test whether it was working and I got an error as soon as I loaded into the MP game.

    Error: http://prntscr.com/mpzgt8, I'm not really good at decrypting arma errors, some help would be great.

     

    Everything around line 55:

    // Check if player has kills saved
    if (isNil {profileNamespace getVariable "sg_kills"}) then {
        profileNamespace setVariable ["sg_kills", 0];
    };

    It would be nice if you could explain this line as well:

    player setVariable ["sg_kills", _sg_kills, true]; // True lets everyone on the server know this variable was updated

    Does everyone have to know when one person gets a kill, what would happen if this was set to false?


  15. I currently have this:

    //initPlayerLocal.sqf
    private ["_sg_kills", "_sg_deaths", "_player"];
    
    _player = _this select 2;
    
    if (isNil {profileNamespace getVariable "sg_kills"}) then {
    	profileNamespace setVariable ["sg_kills", 0];
    };
    
    _lkills = (profileNamespace getVariable "sg_kills");
    _player setVariable ["sg_kills", _lkills];
    
    player addMPEventHandler ["MPKilled", {null = execVM "scripts\sg_stats.sqf";}];

    So I have created the variable sg_kills and it is set to 0 for newcomers and if you have already played it finds what it is.

     

    I can only imagine that this works (please tell if I have gotten something wrong above too).

     

    I am having trouble finding out what I would do in my sg_stats.sqf. I have my variable sg_kills and I have tried adding onto it, but it always ends in errors and it not doing what I wanted it to.

     

    I tried:

    //sg_scripts.sqf
    player addMPEventHandler ["MPKilled" {sg_kills + 1}];
    
    hint format [sg_kills];

    Any help with what I should add into the sg_stats.sqf would be very much so appreciated! I am just trying to make it add a kill onto the sg_kills variable and then display a hint after every kill you get. I am using profileNamespace because I want these statistics to save even after the mission ends ( It's a DM game mode ).


  16. 11 hours ago, beno_83au said:

     

    This is how you can set server-side difficulty, not mission settings. So that wouldn't be what you're after.

     

    Check Description.ext for settings that you can use with your mission. Also, I think 3den Enhanced should show you most, if not all, settings in the 3den editor that are available in the description.ext. But, description.ext trumps anything you set in the editor, so I just use description.ext anyway (and 3den Enhanced for some other things).

     

    You cant change difficulty settings in description.ext? From what I see you can only disable certain things like fully disabling GPS'. I want to be able to force difficulty settings like the ones you get with TADST, but for when someone plays SP/without TADST.

×