Home   Help Search Login Register  

Author Topic: ForEach Problem?  (Read 964 times)

0 Members and 1 Guest are viewing this topic.

Offline Rommel92

  • Members
  • *
ForEach Problem?
« on: 15 Jun 2008, 07:34:03 »
Code: [Select]
_MenuPlatoons = [];
{
_MenuPlatoons = _MenuPlatoons +
[
[["Item",_x + ". Platoon"],["SubMenu", _x +"PMenu"]]
]
} forEach ["1","2","3","4"];

_MenuInnerPlatoons =[];
{
_MenuInnerPlatoons = _MenuInnerPlatoons +
[_x + "PMenu",
[
["Caption", _x + " Platoon"],
["Items",
[
[ ["Item", "-"] ],
[ ["Item", "Test1"], ["SubMenu", ""] ],
[ ["Item", "Test2"], ["SubMenu", ""] ],
[ ["Item", "-"] ],
[ ["Item", "Close Menu"],["Close", true],["Default", true] ]
]
]
]
]
} forEach ["1","2","3","4"];

_MenuStructureArray =
[
["MainMenu",
[
["Caption", "Men"],
["Items",
[
[ ["Item", "-"] ],
[ ["Item", "Platoons >"], ["SubMenu", "Platoons"] ],
[ ["Item", "Support >"], ["SubMenu", "Support"] ],
[ ["Item", "-"] ],
[ ["Item", "Close Menu"],["Close", true],["Default", true] ]
]
]
]
],

["Platoons",
[
["Caption", "Platoons"],
["Items", _MenuPlatoons]
]
],

["FireTeams",
[
["Caption", "Operators"],
["Items",
[
[ ["Item", "RFL FireTeam [4]"], ["Action", "[player, 4,0] execVM 'Scripts\C3IS\X_FIRETEAM.sqf'"], ["Close", false] ],
[ ["Item", "GUN FireTeam [4]"], ["Action", "[player, 4,1] execVM 'Scripts\C3IS\X_FIRETEAM.sqf'"], ["Close", false] ],
[ ["Item", "ASLT FireTeam [4]"], ["Action", "[player, 4,2] execVM 'Scripts\C3IS\X_FIRETEAM.sqf'"], ["Close", false] ]
]
]
]
]
] + [_MenuInnerPlatoons];
_MenuStructureArray execVM "Dialogs\ICE.sqf";

http://pb.6thsense.eu/pb/92

Everything works great, however it will not add the menus for "2","3","4" IN the _MENUINNERPLATOONS, however it works for the _MenuPlatoons... why is this? (If anyone needs more info/demonstration/details then just ask).

« Last Edit: 15 Jun 2008, 08:05:44 by Rommel92 »

Offline Rommel92

  • Members
  • *
Re: ForEach Problem?
« Reply #1 on: 15 Jun 2008, 08:14:52 »
Solved.

Top of code to ->
Code: [Select]
_MenuInnerPlatoons =[];
{
_MenuInnerPlatoons = _MenuInnerPlatoons +
[
[_x + "PMenu",
[
["Caption", _x + " Platoon"],
["Items",
[
[ ["Item", "-"] ],
[ ["Item", "Test1"], ["SubMenu", ""] ],
[ ["Item", "Test2"], ["SubMenu", ""] ],
[ ["Item", "-"] ],
[ ["Item", "Close Menu"],["Close", true],["Default", true] ]
]
]
]
]
]
} forEach ["1","2","3","4"];

Code: [Select]
] + [_MenuInnerPlatoons];
To ->
Code: [Select]
] + _MenuInnerPlatoons;

*Cracks open Champagne*

 :D