daily pastebin goal
3%
SHARE
TWEET

Untitled

a guest Jan 12th, 2018 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Written by beta
  2. //Self interaction setup
  3.  
  4.  
  5. #include "\ca\editor\Data\Scripts\dikCodes.h"
  6.  
  7. private ["_menuDef", "_target", "_params", "_menuName", "_menuRsc", "_menus"];
  8.  
  9. // _this==[_target, _menuNameOrParams]
  10. _target = _this select 0;
  11. _params = _this select 1;
  12.  
  13. _menuName = "";
  14. _menuRsc = "buttonList";
  15.  
  16. if (typeName _params == typeName []) then {
  17.     if (count _params < 1) exitWith {diag_log format["Error: Invalid params: %1, %2", _this, __FILE__]};
  18.     _menuName = _params select 0;
  19.     _menuRsc = if (count _params > 1) then {_params select 1} else {_menuRsc};
  20. } else {
  21.     _menuName = _params;
  22. };
  23.  
  24. //-----------------------------------------------------------------------------
  25.  
  26. _menus =
  27. [
  28.     [
  29.         ["main", "krauseSelfInteracts", _menuRsc],
  30.         [
  31.             [
  32.             "Toggle Overlay on/off",
  33.             "[] execVM 'scriptname.sqf'",
  34.             "","","", -1, 1, (boolean condition)
  35.             ]
  36.         ]
  37.     ]
  38. ];
  39.  
  40. //-----------------------------------------------------------------------------
  41.  
  42. _menuDef = [];
  43. {
  44.     if (_x select 0 select 0 == _menuName) exitWith {_menuDef = _x};
  45. } forEach _menus;
  46.  
  47. if (count _menuDef == 0) then {
  48.     hintC format ["Error: Menu not found: %1\n%2\n%3", str _menuName, if (_menuName == "") then {_this} else {""}, __FILE__];
  49.     diag_log format ["Error: Menu not found: %1, %2, %3", str _menuName, _this, __FILE__];
  50. };
  51.  
  52. _menuDef // return value
RAW Paste Data
Pastebin PRO SPRING Special!
Get 40% OFF Pastebin PRO accounts!
Top