lel1224 10 Posted October 3, 2017 Hello I am making a admin tool for my server and I am Using the GUI editor. I need help making a simple admin spawn menu I need help making the file to populate the "class spawn_Menu_List: RscListBox" and then calling the file. class Jackson_dialog { idd =-7000; movingenable=true; //onLoad = "_nul = ['onLoad',_this] execVM 'spawnMenu.sqf';"; class controls { //////////////////////////////////////////////////////// // GUI EDITOR OUTPUT START (by Blackson, v1.063, #Gyrado) //////////////////////////////////////////////////////// class admin_menu: RscFrame { idc = 1800; x = 0.650047 * safezoneW + safezoneX; y = -5.99921e-005 * safezoneH + safezoneY; w = 0.35 * safezoneW; h = 0.999999 * safezoneH; sizeEx = 10 * GUI_GRID_H; }; class admin_Menu_Text: RscText { idc = 1000; text = "Admin Menu"; //--- ToDo: Localize; x = 0.650047 * safezoneW + safezoneX; y = -5.99921e-005 * safezoneH + safezoneY; w = 0.159844 * safezoneW; h = 0.077 * safezoneH; sizeEx = 2 * GUI_GRID_H; }; class godmode_Text: RscText { idc = 1001; text = "Godmode"; //--- ToDo: Localize; x = 0.725019 * safezoneW + safezoneX; y = 0.10004 * safezoneH + safezoneY; w = 0.0360937 * safezoneW; h = 0.066 * safezoneH; }; class godmode_On: RscButton { idc = 1600; onButtonClick = "player allowDamage false;"; text = "On"; //--- ToDo: Localize; x = 0.699959 * safezoneW + safezoneX; y = 0.1601 * safezoneH + safezoneY; w = 0.04125 * safezoneW; h = 0.055 * safezoneH; }; class godmode_Off: RscButton { idc = 1601; onButtonClick = "player allowDamage true;"; text = "Off"; //--- ToDo: Localize; x = 0.749975 * safezoneW + safezoneX; y = 0.1601 * safezoneH + safezoneY; w = 0.04125 * safezoneW; h = 0.055 * safezoneH; }; class player_List: RscListBox { idc = 1500; x = 0.87125 * safezoneW + safezoneX; y = 0.324 * safezoneH + safezoneY; w = 0.128906 * safezoneW; h = 0.242 * safezoneH; }; class player_List_Txt: RscText { idc = 1003; text = "Player List"; //--- ToDo: Localize; x = 0.907344 * safezoneW + safezoneX; y = 0.269 * safezoneH + safezoneY; w = 0.0464063 * safezoneW; h = 0.055 * safezoneH; }; class teleport_To: RscButton { idc = 1603; text = "Teleport To"; //--- ToDo: Localize; x = 0.897031 * safezoneW + safezoneX; y = 0.588 * safezoneH + safezoneY; w = 0.0670311 * safezoneW; h = 0.066 * safezoneH; }; class teleport_To_Me: RscButton { idc = 1604; text = "Teleport To Me"; //--- ToDo: Localize; x = 0.897031 * safezoneW + safezoneX; y = 0.665 * safezoneH + safezoneY; w = 0.0670311 * safezoneW; h = 0.066 * safezoneH; }; class give_Money1: RscButton { idc = 1605; text = "Give 1K Poptabs"; //--- ToDo: Localize; x = 0.860937 * safezoneW + safezoneX; y = 0.159 * safezoneH + safezoneY; w = 0.061875 * safezoneW; h = 0.066 * safezoneH; }; class give_Respect: RscButton { idc = 1606; text = "Give 1K Respect"; //--- ToDo: Localize; x = 0.897031 * safezoneW + safezoneX; y = 0.742 * safezoneH + safezoneY; w = 0.0670311 * safezoneW; h = 0.066 * safezoneH; }; class give_Money_Txt: RscText { idc = 1002; text = "PopTabs"; //--- ToDo: Localize; x = 0.9125 * safezoneW + safezoneX; y = 0.104 * safezoneH + safezoneY; w = 0.04125 * safezoneW; h = 0.055 * safezoneH; }; class give_Money2: RscButton { idc = 1607; text = "Give 10K Poptabs"; //--- ToDo: Localize; x = 0.937456 * safezoneW + safezoneX; y = 0.1601 * safezoneH + safezoneY; w = 0.061875 * safezoneW; h = 0.066 * safezoneH; }; class kick_Player: RscButton { idc = 1608; text = "Kick"; //--- ToDo: Localize; x = 0.87125 * safezoneW + safezoneX; y = 0.808 * safezoneH + safezoneY; w = 0.0464063 * safezoneW; h = 0.066 * safezoneH; }; class ban_Player: RscButton { idc = 1609; text = "Ban Player"; //--- ToDo: Localize; x = 0.943438 * safezoneW + safezoneX; y = 0.808 * safezoneH + safezoneY; w = 0.0515625 * safezoneW; h = 0.066 * safezoneH; }; class map_Teleport: RscButton { idc = 1610; action = "closeDialog 7000; []execVM ""mapteleport.sqf"";"; text = "Alt Click Map Teleport"; //--- ToDo: Localize; x = 0.654688 * safezoneW + safezoneX; y = 0.896 * safezoneH + safezoneY; w = 0.103125 * safezoneW; h = 0.033 * safezoneH; }; class delete_Vehicle: RscButton { idc = 1611; action = "[]execVM ""deleteVic.sqf"";"; text = "Delete Vehicle at Cursor"; //--- ToDo: Localize; x = 0.654688 * safezoneW + safezoneX; y = 0.83 * safezoneH + safezoneY; w = 0.103125 * safezoneW; h = 0.044 * safezoneH; }; class player_Kick_Out_Of_Vic: RscButton { idc = 1612; text = "Player Get Out"; //--- ToDo: Localize; x = 0.654688 * safezoneW + safezoneX; y = 0.786 * safezoneH + safezoneY; w = 0.0979687 * safezoneW; h = 0.033 * safezoneH; }; class spawn_Menu_List: RscListBox { onLBSelChanged = "spawnscript.sqf ";///where I want to call list idc = 1508; x = 0.680469 * safezoneW + safezoneX; y = 0.357 * safezoneH + safezoneY; w = 0.175313 * safezoneW; h = 0.352 * safezoneH; }; class spawnMenuText: RscText { idc = 1005; text = "Spawn Menu"; //--- ToDo: Localize; x = 0.732031 * safezoneW + safezoneX; y = 0.291 * safezoneH + safezoneY; w = 0.0567187 * safezoneW; h = 0.055 * safezoneH; }; //////////////////////////////////////////////////////// // GUI EDITOR OUTPUT END //////////////////////////////////////////////////////// }; }; //missionconfigfile >> "Jackson_dialog" //missionconfigfile >> "RscTUTVehDialog" Share this post Link to post Share on other sites
MKD3 27 Posted October 3, 2017 This is a basic way of doing it. Clearing and repopulating the list each time its called based on whatever conditions _idc = 1337; lbClear _idc; _stuff = ["a", "c"]; _things = ["a", "b", "c"]; { //if stuff in things, add if (_x in _things) then { lbadd [_idc, _x]; }; } foreach _stuff; Share this post Link to post Share on other sites
lel1224 10 Posted October 5, 2017 I still cant seem to get it to work. I have this Jackson_SpawnVic = { disableSerialization; lbClear _ctrl; /*_className = "B_Truck_01_Repair_F"; _config = [_classname] call HG_getConfig; */ _displayName = getText(configFile >> "CfgVehicles" >> "displayName"); _listItems = ["_displayName"]; _ctrl = (findDisplay 7000) displayCtrl 2400; { _ctrl lbAdd _x; }forEach _displayName; }; class Jackson_dialog { idd =-7000; movingenable=true; onload = "[] spawn Jackson_SpawnVic;"; class controls { Share this post Link to post Share on other sites
7erra 629 Posted October 5, 2017 Your script doesn't make any sense. If you want to get all the displayNames from the config then this will do: Jackson_SpawnVic = { disableSerialization; _ctrl = (findDisplay 7000) displayCtrl 2400; lbClear _ctrl; _configs = "true" configClasses (configFile >> "CfgVehicles"); _displayNames = _configs apply {_x call BIS_fnc_displayName}; { _ctrl lbAdd _x; } forEach _displayNames; }; Also your IDD doesn't correspond with the number in the script. I don't know if a negative number as IDD is even possible. Neither do I know if this script is performance friendly since CfgVehicles has several hundred entries. Let me elaborate on your script errors: Spoiler Jackson_SpawnVic = // it is performance friendlier to make a function for scripts that are called more than once, so good job here { disableSerialization; lbClear _ctrl; //- _ctrl hasn't been defined yet. _displayName = getText(configFile >> "CfgVehicles" >> "displayName"); //This will return "" since there is no such entry at the given path _listItems = ["_displayName"]; // This will simply output "_displayName" and not the variable. Use "str" or "format" command instead. What is the purpose of this variable anyway? _ctrl = (findDisplay 7000) displayCtrl 2400; // Now the variable is defined. Why not earlier? Also the IDD is wrong { _ctrl lbAdd _x; }forEach _displayName; //_displayName would be a string at this point since getText returns that. You need an array of strings to add sth to the listbox. }; Share this post Link to post Share on other sites