Advertisement
Guest User

Untitled

a guest
Nov 12th, 2014
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.97 KB | None | 0 0
  1. ["_control","_button","_parent","_group","_pos","_item","_conf","_name","_cfgActions","_numActions","_height","_menu","_config","_type","_script","_outputOriented","_compile","_array","_outputClass","_outputType"];
  2. disableSerialization;
  3. _control = _this select 0;
  4. _button = _this select 1;
  5. _parent = findDisplay 106;
  6.  
  7. //if ((time - dayzClickTime) < 1) exitWith {};
  8. if (!DZE_SelfTransfuse && ((gearSlotData _control) == "ItemBloodBag")) exitWith {};
  9. if (_button == 1) then {
  10. //dayzClickTime = time;
  11. _group = _parent displayCtrl 6902;
  12.  
  13. _pos = ctrlPosition _group;
  14. _pos set [0,((_this select 2) + 0.48)];
  15. _pos set [1,((_this select 3) + 0.07)];
  16.  
  17. _item = gearSlotData _control;
  18.  
  19. _conf = configFile >> "cfgMagazines" >> _item;
  20. if (!isClass _conf) then {
  21. _conf = configFile >> "cfgWeapons" >> _item;
  22. };
  23. _name = getText(_conf >> "displayName");
  24.  
  25. _cfgActions = _conf >> "ItemActions";
  26. _numActions = (count _cfgActions);
  27. _height = 0;
  28.  
  29. //Populate Menu
  30. for "_i" from 0 to (_numActions - 1) do
  31. {
  32. _menu = _parent displayCtrl (1600 + _i);
  33. _menu ctrlShow true;
  34. _config = (_cfgActions select _i);
  35. _type = getText (_config >> "text");
  36. _script = getText (_config >> "script");
  37. _outputOriented = getNumber (_config >> "outputOriented") == 1;
  38. _height = _height + (0.025 * safezoneH);
  39. _compile = format["_id = '%2' %1;",_script,_item];
  40. uiNamespace setVariable ['uiControl', _control];
  41. if (_outputOriented) then {
  42. /*
  43. This flag means that the action is output oriented
  44. the output class will then be transferred to the script
  45. && the type used for the name
  46. */
  47. _array = getArray (_config >> "output");
  48. _outputClass = _array select 0;
  49. _outputType = _array select 1;
  50. _name = getText (configFile >> _outputType >> _outputClass >> "displayName");
  51. _compile = format["_id = ['%2',%3] %1;",_script,_item,_array];
  52. };
  53.  
  54. _menu ctrlSetText format[_type,_name];
  55. _menu ctrlSetEventHandler ["ButtonClick",_compile];
  56. };
  57.  
  58. _erc_cfgActions = (missionConfigFile >> "WaTd" >> _item);
  59. _erc_numActions = (count _erc_cfgActions);
  60. if (isClass _erc_cfgActions) then {
  61. for "_j" from 0 to (_erc_numActions - 1) do
  62. {
  63. _menu = _parent displayCtrl (1600 + _j + _numActions);
  64. _menu ctrlShow true;
  65. _config = (_erc_cfgActions select _j);
  66. _text = getText (_config >> "text");
  67. _script = getText (_config >> "script");
  68. _height = _height + (0.025 * safezoneH);
  69. uiNamespace setVariable ['uiControl', _control];
  70. _menu ctrlSetText _text;
  71. _menu ctrlSetEventHandler ["ButtonClick",_script];
  72. };
  73. };
  74.  
  75. _erc_cfgActions = (missionConfigFile >> "ExtraRc" >> _item);
  76. _erc_numActions = (count _erc_cfgActions);
  77. if (isClass _erc_cfgActions) then {
  78. for "_j" from 0 to (_erc_numActions - 1) do
  79. {
  80. _menu = _parent displayCtrl (1600 + _j + _numActions);
  81. _menu ctrlShow true;
  82. _config = (_erc_cfgActions select _j);
  83. _text = getText (_config >> "text");
  84. _script = getText (_config >> "script");
  85. _height = _height + (0.025 * safezoneH);
  86. uiNamespace setVariable ['uiControl', _control];
  87. _menu ctrlSetText _text;
  88. _menu ctrlSetEventHandler ["ButtonClick",_script];
  89. };
  90. };
  91.  
  92. ///// jahan - begin vehicle pointer
  93. // key colors
  94. _colors = ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"];
  95. if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _item)) in _colors) then {
  96. // characterID of the key (car character number)
  97. _keyOwner = getNumber(configFile >> "CfgWeapons" >> _item >> "keyid");
  98. // key name (like: e3f2)
  99. _keyName = getText(configFile >> "CfgWeapons" >> _item >> "displayName");
  100.  
  101. //Menu entry Key vehicle pointer
  102. _control = _parent displayCtrl (1600 + _numActions);
  103. _control ctrlShow true;
  104. _height = _height + (0.025 * safezoneH);
  105. // this needs to point the place where the script is in your mission (vehicle_pointer.sqf)
  106. _script = "custom\jtools\vehicle_pointer.sqf";
  107. _exescript = format["_id = ['%2','%3'] execVM '%1';closeDialog 0;",_script,_keyOwner,_keyName];
  108. uiNamespace setVariable ['uiControl', _control];
  109. // sets the text in the right button menu
  110. _control ctrlSetText "Vehicle Locator";
  111. _control ctrlSetTextColor [1,1,1,1];
  112. _control ctrlSetTooltip "Pinpoint vehicle. Mark on map if not in range.";
  113. _control ctrlSetTooltipColorBox [0.3,0.4,1,1];
  114. _control ctrlSetTooltipColorShade [0, 0, 0, 1];
  115. _control ctrlSetTooltipColorText [1,1,1,1];
  116. _control ctrlSetEventHandler ["ButtonClick",_exescript];
  117. _numActions = _numActions + 1; // if there are other item action after that (other mods) add 1 to _numactions
  118. };
  119. ///// jahan - end vehicle pointer
  120.  
  121. //### BEGIN MODIFIED CODE: extra click actions
  122. {
  123. private["_classname","_text","_execute","_condition"];
  124. _classname = _x select 0;
  125. _text = _x select 1;
  126. _execute = _x select 2;
  127. _condition = _x select 3;
  128. // if the clicked item matches, then assign the script call and display text
  129. if(_item == _classname && (call compile _condition)) then {
  130. _menu = _parent displayCtrl (1600 + _numActions);
  131. _menu ctrlShow true;
  132. _height = _height + (0.025 * safezoneH);
  133. uiNamespace setVariable ['uiControl', _control];
  134. _menu ctrlSetText _text;
  135. _menu ctrlSetEventHandler ["ButtonClick",_execute];
  136. _numActions = _numActions + 1;
  137. };
  138. } forEach DZE_CLICK_ACTIONS;
  139. //### END MODIFIED CODE: extra click actions
  140.  
  141. _pos set [3,_height];
  142. //hint format["Obj: %1 \nHeight: %2\nPos: %3",_item,_height,_grpPos];
  143.  
  144. _group ctrlShow true;
  145. ctrlSetFocus _group;
  146. _group ctrlSetPosition _pos;
  147. _group ctrlCommit 0;
  148. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement