spirit6 51 Posted June 25, 2009 I am busy with the popup menu from Dr Eyeball. First of all it works great and as long as i dont try fancy stuff well it all goes honky donky. The menu builds up from arrays and here is a part of the code that will produce some items in the menu: // TODO: Fill array with real player list PlayerList_MenuArray = [ [ ["Item", "Dr Eyeball"], ["Action", "player globalChat 'type: #vote admin [TOG] Dr Eyeball'"] ], [ ["Item", "The Terminator"], ["Action", ""] ], [ ["Item", "Prince Charles"], ["Action", ""] ], [ ["Item", "Mr Munchkin"], ["Action", ""] ] ]; As you can see an array is filled. As stated above it says: to do, make that array fillup with real players. Now i want something totaly different but the idea is the same. I want that filled up dynamic but i cant seem to get that done in any way. Its may lack of array knowledge that is cracking here. After 5 hours i am smashing my head here. HELP!!!:confused: I tried array = array + array , array plus array what ever array, private array with + but i jsut dont get it at all. Cry cry. Now functional what i want if we keep on what the code suggests: Make the above array (i gues its array in array as element right and then some more even) dynamic by variables and depending on number of players or something. Just some help on how to build up that stuff dynamic would already be enough :P BIG CHEERS for who helps me here, i am so incredible stuck here. Share this post Link to post Share on other sites
rocket 9 Posted June 25, 2009 Don't really know what you're trying to achieve. I think you're trying to change components of the Array? In which case, you use the set command ie _array set [0,"weeee"]; Or are you trying to add additional arrays containing the above? If so, you don't add arrays - you concatenate them, again using the set command. Try to think of arrays as like "divided variables". They're variables inside variables. We've been talking about tips around that in this thread also, which might be useful reading. Share this post Link to post Share on other sites
spirit6 51 Posted June 25, 2009 (edited) Well basicly i try to make that menu work based on dynamich array structure. For example lets try build up the first element of the array. Lets make it: PlayerList_MenuArray set [0, [ ["Item", "Mr Munchkin"], ["Action", ""] ] ]; That doesnt work. So apperently that is not the first element of the array that is expected i assume. The element itself is as seen also an array. I am totaly puzzled here to be honost. Even more on what is the first element at all here. Just to make it clear. The first code above, works. It not my code. Its been provided and works. Its making it dynamic is what i have probs with. Edited June 25, 2009 by spirit6 Share this post Link to post Share on other sites
rocket 9 Posted June 25, 2009 (edited) Yes, nested arrays work fine. Have you checked out the post I linked? There I provided an example for how to alter a nested array. Any variable you create is already dynamic, what you're asking is how you alter a nested array, which is what that topic is explicitly about :) Alternatively, try this post. Edited June 25, 2009 by Rocket Share this post Link to post Share on other sites
welcome to hell 23 Posted June 26, 2009 If you want to fill it up dynamically play around with forEach loop, and array set command. Share this post Link to post Share on other sites
spirit6 51 Posted June 26, 2009 Got it working, here is the relevant code part: for "_i" from 0 to ((count CONFIG) - 1) do { _unitCfg = (CONFIG select _i); if (isClass(_unitCfg)) then { _cfgname = getText(_unitCfg >> "name"); _cfgclass = (configName ((configFile >> "CfgGroups" >> _side >> _faction >> _type) select _i)); // player globalchat _cfgclass; // player globalchat _cfgname; _PlayerList_MenuArray set[(_i-1),[["Item", _cfgname],["Action", format ["groupsthatspawns=""%1"";classtype=""%2"";faction=""%3"";classside=""%4"";spawnside=%5;nul=[3] execVM 'Spawnstuff.sqf';",_cfgclass,_type, _faction, _side, _spawnside ]] ]]; }; }; Share this post Link to post Share on other sites