Jump to content
  • 0

[HELP/ TUTORIAL NEEDED] Maca, s Right Click Options to items.


speaR

Question

Good Evening guys. I got some problems getting macas right click options to work on my server.: http://epochservers.com/viewtopic.php?f=14&t=13 . In his tutorial he's talking about compiles.sqf . Do I have to create an custom one in my mission folder? Or is it the one in the .pbo\init etc. Do I have to create an own compiles.sqf in my missions folder? If I have to.. How is it done? Same with ui_selectSlot.sqf . Does anyone knows a tutorial for noobs like me in scripting. (But already learned a lot of you helpful guys in this forum :-) ) so could anyone make me a bit more detailed description of how to gut it working.. Have a nice day !

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0
private ["_control","_button","_parent","_group","_pos","_item","_conf","_name","_cfgActions","_numActions","_height","_menu","_config","_type","_script","_outputOriented","_compile","_array","_outputClass","_outputType"];
disableSerialization;
_control = 	_this select 0;
_button =	_this select 1;
_parent = 	findDisplay 106;

//if ((time - dayzClickTime) < 1) exitWith {};

if (_button == 1) then {
	//dayzClickTime = time;
	_group = _parent displayCtrl 6902;
	
	_pos = 		ctrlPosition _group;
	_pos set [0,((_this select 2) + 0.48)];
	_pos set [1,((_this select 3) + 0.07)];
	
	_item = gearSlotData _control;
	
	_conf = configFile >> "cfgMagazines" >> _item;
	if (!isClass _conf) then {
		_conf = configFile >> "cfgWeapons" >> _item;
	};
	_name = getText(_conf >> "displayName");
	
	_cfgActions = _conf >> "ItemActions";
	_numActions = (count _cfgActions);
	_height = 0;
	
	//Populate Menu
	for "_i" from 0 to (_numActions - 1) do 
	{
		_menu = 	_parent displayCtrl (1600 + _i);
		_menu ctrlShow true;
		_config = 	(_cfgActions select _i);
		_type = 	getText	(_config >> "text");
		_script = 	getText	(_config >> "script");
		_outputOriented = 	getNumber	(_config >> "outputOriented") == 1;
		_height = _height + (0.025 * safezoneH);
		_compile =  format["_id = '%2' %1;",_script,_item];
		uiNamespace setVariable ['uiControl', _control];
		if (_outputOriented) then {
			/*
				This flag means that the action is output oriented
				the output class will then be transferred to the script
				and the type used for the name
			*/			
			_array = 	getArray	(_config >> "output");
			_outputClass = _array select 0;
			_outputType = _array select 1;
			_name = getText (configFile >> _outputType >> _outputClass >> "displayName");
			_compile =  format["_id = ['%2',%3] %1;",_script,_item,_array];
		};
		
		_menu ctrlSetText format[_type,_name];
		_menu ctrlSetEventHandler ["ButtonClick",_compile];
	};
	//Custom Start
		// Add extra context menus
		_erc_cfgActions = (missionConfigFile >> "ExtraRc" >> _item);
		_erc_numActions = (count _erc_cfgActions);
		if (isClass _erc_cfgActions) then {
		for "_j" from 0 to (_erc_numActions - 1) do 
		{
        _menu =  _parent displayCtrl (1600 + _j + _numActions);
        _menu ctrlShow true;
        _config =  (_erc_cfgActions select _j);
        _text =  getText (_config >> "text");
        _script =  getText (_config >> "script");
        _height = _height + (0.025 * safezoneH);
        uiNamespace setVariable ['uiControl', _control];
        _menu ctrlSetText _text;
        _menu ctrlSetEventHandler ["ButtonClick",_script];
    };
};
	//Custom End
	
	
	_pos set [3,_height];
	//hint format["Obj: %1 \nHeight: %2\nPos: %3",_item,_height,_grpPos];		

	_group ctrlShow true;
	ctrlSetFocus _group;
	_group ctrlSetPosition _pos;
	_group ctrlCommit 0;
};

Thats the file i use with macas script.

Link to comment
Share on other sites

  • 0

thanks for answering that fast. And whats about this ui_selectSlot.sqf file?

You also put it into mission. In case you ever need to edit the file further in the future though, just remember the part of what was shared above that deals with it is. Quite a few scripts released include files instead of placement guides, so always possible to overwrite stuff you've done, good to take note of it all.

 

//Custom Start
        // Add extra context menus
        _erc_cfgActions = (missionConfigFile >> "ExtraRc" >> _item);
        _erc_numActions = (count _erc_cfgActions);
        if (isClass _erc_cfgActions) then {
        for "_j" from 0 to (_erc_numActions - 1) do
        {
_menu = _parent displayCtrl (1600 + _j + _numActions);
_menu ctrlShow true;
_config = (_erc_cfgActions select _j);
_text = getText (_config >> "text");
_script = getText (_config >> "script");
_height = _height + (0.025 * safezoneH);
uiNamespace setVariable ['uiControl', _control];
_menu ctrlSetText _text;
_menu ctrlSetEventHandler ["ButtonClick",_script];
};
};
    //Custom End
Link to comment
Share on other sites

  • 0
On 2014-06-10 at 2:30 PM, speaR said:

Good Evening guys. I got some problems getting macas right click options to work on my server.: http://epochservers.com/viewtopic.php?f=14&t=13 . In his tutorial he's talking about compiles.sqf . Do I have to create an custom one in my mission folder? Or is it the one in the .pbo\init etc. Do I have to create an own compiles.sqf in my missions folder? If I have to.. How is it done? Same with ui_selectSlot.sqf . Does anyone knows a tutorial for noobs like me in scripting. (But already learned a lot of you helpful guys in this forum :-) ) so could anyone make me a bit more detailed description of how to gut it working.. Have a nice day !

Do you have another link for macas right click script? cant find it anywhere

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Discord

×
×
  • Create New...