Home   Help Search Login Register  

Author Topic: Array Help [GIVEN UP + CLOSED]  (Read 2842 times)

0 Members and 1 Guest are viewing this topic.

Offline Rommel92

  • Members
  • *
Array Help [GIVEN UP + CLOSED]
« on: 16 Jun 2008, 01:19:01 »
The script below deletes Groups out of an array which is setup like this: [[Group1,Group2,Group3,Group4],[Group1,Group2,Group3,Group4],[Group1,Group2,Group3,Group4]] etc. It is designed to only delete only one of the sets of four. It does this great, however a trace (<NULL-GROUP>) is left behind, and I can't figure how to remove it.  :dunno:
Code: (Disband.sqf) [Select]
_Disband =
{
private ["_group"];

_group = _this select 0;

{deleteVehicle _x} forEach units _group;
deleteGroup _group;
};

_side = _this select 0;
_platoon = _this select 1;

player groupChat format ["%1", _this];

_company = call compile format["%1COMPANY",_side];
_platoon = _company select (_platoon - 1);

player groupChat format ["%1 --- %2", _company, _platoon];

{[_x] call _Disband} forEach _platoon;

_platoon = _platoon - _platoon;

player groupChat format ["%1 --- %2", _company, _platoon];

Solved

Sorry about this Mods, I won't post in future, I solve me own problems to quick... minimum two hours plus screaming only for posting up in future I thinks.

 :P

Code: [Select]
{[_x] call _Disband} forEach _platoon;

_platoon = _platoon - _platoon;

call compile format["%1COMPANY set [%2, %3]", _side, (_platoonN - 1), _platoon];

player groupChat format ["%1 --- %2", _company, _platoon];
Was the answer... Forgot _platoon is local the script cause its a local variable...  :whistle:
« Last Edit: 19 Jun 2008, 01:14:11 by Rommel92 »

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Array Help [SOLVED]
« Reply #1 on: 16 Jun 2008, 13:31:03 »
This looks very, very fishy to me:
Code: [Select]
_platoon = _platoon - _platoon;
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Rommel92

  • Members
  • *
Re: Array Help [NOT SOLVED ANYMORE]
« Reply #2 on: 16 Jun 2008, 14:03:32 »
hehe.


WESTCOMPANY = [[WEST 1-1-B],[],[],[]]

Code: [Select]
private ["_num","_sqdNum","_result"];

_num = _this select 0;

_MenuSquads = [[ ["Item", "-"] ]];
{
_MenuSquads = _MenuSquads +
[
[["Item", format["%1 >",_x]],["SubMenu", format["%1",_x] + "SMenu"]]
]
} forEach call compile format ["%1COMPANY select %2", side player, _num - 1];

_MenuSquads = _MenuSquads + [[ ["Item", "-"] ],[ ["Item", "Close Menu"],["Close", true]]];


//////-----------------------------------------------------------------------------//////


_MenuInnerSquads = [];
{
call compile format["%1Result = %1COMPANY select %2 find '%3'", side player, _num - 1, _x];

player globalChat format ["%1",call compile format["%1Result", side player]];
_MenuInnerSquads = _MenuInnerSquads +
[
[format["%1",_x] + "SMenu",
[
["Caption", format["%1",_x]],
["Items",
[
[ ["Item", "-"] ],
[ ["Item", "Waypoints >"], ["SubMenu","Waypoints"], ["Action",format["%1Result = %1COMPANY select %2 find '%3'", side player, _num - 1, _x]], ["Close", false]],
[ ["Item", "Formation >"], ["SubMenu","Formations"]],
[ ["Item", "-"] ],
[ ["Item", "Open Fire"], ["Action", ""], ["Close", false] ],
[ ["Item", "Hold Fire"], ["Action", ""], ["Close", false] ],
[ ["Item", "-"] ],
[ ["Item", "Hold Position"], ["Action", ""], ["Close", false] ],
[ ["Item", "-"] ],
[ ["Item", "Close Menu"],["Close", true]]
]
]
]
]
]
} forEach call compile format ["%1COMPANY select %2", side player, _num - 1];


//////-----------------------------------------------------------------------------//////


_MenuWaypoints = [[ ["Item", "-"] ]];
{
_MenuWaypoints = _MenuWaypoints +
[
[ ["Item", _x] ,["Action", format["[[%1,%2] '%3'] call compile preProcessFile ''Scripts\TCIM\Waypoint.sqf''",_num,call compile format ["%1Result", side player],_x]], ["Close", true] ]
]
} forEach ["MOVE", "SAD", "GETIN NEAREST", "GETOUT", "TR UNLOAD", "GUARD", "SENTRY", "CLEAR ALL"];


//////-----------------------------------------------------------------------------//////


_MenuWaypoints = _MenuWaypoints + [[ ["Item", "-"] ],[ ["Item", "Close Menu"],["Close", true]]];

_MenuFormations = [[ ["Item", "-"] ]];
{
_MenuFormations = _MenuFormations +
[
[["Item", _x],["Action", ""], ["Close", true]]
]
} forEach ["COLUMN", "STAG COLUMN", "WEDGE", "ECH LEFT", "ECH RIGHT", "VEE", "LINE", "FILE", "DIAMOND"];

_MenuFormations = _MenuFormations + [[ ["Item", "-"] ],[ ["Item", "Close Menu"],["Close", true]]];

_MenuStructureArray =
[
["MainMenu",
[
["Caption", "Squads"],
["Items", _MenuSquads]
]
],
["Waypoints",
[
["Caption", "Waypoints"],
["Items", _MenuWaypoints]
]
],
["Formations",
[
["Caption", "Formations"],
["Items", _MenuFormations]
]
]
] + _MenuInnerSquads;


//////-----------------------------------------------------------------------------//////


_MenuStructureArray execVM "Dialogs\TCIM.sqf";
Issue:

Error in expression <[2871] call PUM3_ClickButton; [[1,-1] 'MOVE'] call compile preProcessFile ''Sc>
  Error position: <'MOVE'] call compile preProcessFile ''Sc>
  Error Missing ]


Also, the find isn't working.

HELP ME OFPEC. PLEASE!
 :weeping: :weeping: :weeping:


DESIRED RESULT
Code: [Select]
[[1,0], "MOVE"] execVM "WAYPOINT.SQF"
etc.

7 hours and counting on this one issue.
« Last Edit: 16 Jun 2008, 14:08:42 by Rommel92 »

Offline Rommel92

  • Members
  • *
Re: Array Help [NOT SOLVED]
« Reply #3 on: 16 Jun 2008, 23:30:00 »
Nah no semi-colons were missing mate. Its simply a string error. I just can't get it figured...  :no:

Offline loki72

  • Former Staff
  • ****
    • Loki's Nightmare
Re: Array Help [NOT SOLVED]
« Reply #4 on: 16 Jun 2008, 23:37:19 »
greetings,

just looking through your post.. this looks suspect

Code: [Select]
[format["%1",_x] + "SMenu",
i do see the other bracket it 'should have' at the bottom... have you tried the script without the added hint?

just throwing my 2 cents in :whistle:
« Last Edit: 16 Jun 2008, 23:39:33 by loki72 »

Offline Rommel92

  • Members
  • *
Re: Array Help [NOT SOLVED]
« Reply #5 on: 16 Jun 2008, 23:43:35 »
String of _x + "SMenu" = "_x" + "SMenu"

Say _x = 1.

"1SMenu".

These are dynamic arrays for a dialog.

Offline loki72

  • Former Staff
  • ****
    • Loki's Nightmare
Re: Array Help [NOT SOLVED]
« Reply #6 on: 16 Jun 2008, 23:48:36 »
right.. but i am only asking if this.

Code: [Select]
[format["%1",_x] + "SMenu",
should be this?
Code: [Select]
[format["%1",_x]] + "SMenu",
i've been trying to figure out the same dialog system and these questions, i am sure, will have bearing on what i do in the future.


« Last Edit: 16 Jun 2008, 23:50:56 by loki72 »

Offline Rommel92

  • Members
  • *
Re: Array Help [NOT SOLVED]
« Reply #7 on: 16 Jun 2008, 23:59:15 »
Negative.

Its right the way it is, that menu works fine, if anyone wants I'll upload the mission to show.

Offline loki72

  • Former Staff
  • ****
    • Loki's Nightmare
Re: Array Help [NOT SOLVED]
« Reply #8 on: 17 Jun 2008, 00:04:46 »
don't know if i'll be a help but i'd be happy to load it up and give it a go.

Offline Rommel92

  • Members
  • *
Re: Array Help [NOT SOLVED]
« Reply #9 on: 17 Jun 2008, 00:06:38 »
There you go. Be back in 6 hours.

Offline loki72

  • Former Staff
  • ****
    • Loki's Nightmare
Re: Array Help [NOT SOLVED]
« Reply #10 on: 17 Jun 2008, 01:52:34 »
hmmm.. here's what i found.. and will need another to explain it to me.

it appears the issue is in this section:

order.sqf
Code: [Select]
_MenuWaypoints = _MenuWaypoints +
[
[ ["Item", _x] ,
["Action", format["[[%1,%2] '%3']  call compile preProcessFile ''Scripts\TCIM\Waypoint.sqf''",
_num, call compile format ["%1Result", side player],_x]],
["Close", true] ]
]

looks like this:


however.. by adding a "  it looks like this:



i'm not afraid to say it... this is beyond my current level of understanding...  :P


« Last Edit: 17 Jun 2008, 01:54:36 by loki72 »

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Array Help [NOT SOLVED]
« Reply #11 on: 17 Jun 2008, 13:54:47 »
Well, what does:
Code: [Select]
hint format["[[%1,%2] '%3']  call compile preProcessFile ''Scripts\TCIM\Waypoint.sqf''",1,0, "MOVE"]display? And why do you say you want execVM "Scripts\TCIM\Waypoint.sqf'' when you have put call compile preProcessFile ''Scripts\TCIM\Waypoint.sqf''?
After the ["Action", do you require a string or a code string?
If a string, and assuming you want execVM
Code: [Select]
_MenuWaypoints = _MenuWaypoints +
[
[ ["Item", _x] ,
["Action", format["""[[%1,%2] '%3']  execVM "''Scripts\TCIM\Waypoint.sqf''"",
_num, call compile format ["%1Result", side player],_x]],
["Close", true] ]
]

urp!

Offline Rommel92

  • Members
  • *
Re: Array Help [NOT SOLVED]
« Reply #12 on: 18 Jun 2008, 00:02:48 »
I was just referring to get it working, I havent got my PC for a week, so one of you guys could try out the solutions I'd be really thankful... else just post a few more possible answers and I'll try em on the weekend.

 :good:

Thanks guys.

Offline loki72

  • Former Staff
  • ****
    • Loki's Nightmare
Re: Array Help [NOT SOLVED]
« Reply #13 on: 18 Jun 2008, 00:15:03 »
here's what i put:

Code: [Select]
_MenuWaypoints = [[ ["Item", "-"] ]];
{
_MenuWaypoints = _MenuWaypoints +
[
[ ["Item", _x] ,
["Action", format["""[[%1,%2] '%3']  execVM "''Scripts\TCIM\Waypoint.sqf''"",
_num, call compile format ["%1Result", side player],_x]],
["Close", true] ]
]
} forEach ["MOVE", "SAD", "GETIN NEAREST", "GETOUT", "TR UNLOAD", "GUARD", "SENTRY", "CLEAR ALL"];



here's what i got...



sry...
« Last Edit: 18 Jun 2008, 00:30:45 by loki72 »

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Array Help [NOT SOLVED]
« Reply #14 on: 18 Jun 2008, 17:54:05 »
Missed a quote. Ugh. Two guesses:
Code: [Select]
_MenuWaypoints = _MenuWaypoints +
[
[ ["Item", _x] ,
["Action", format["""[[%1,%2] ""%3""]  execVM "''Scripts\TCIM\Waypoint.sqf'""""",
_num, call compile format ["%1Result", side player],_x]],
["Close", true] ]
]

Code: [Select]
_MenuWaypoints = _MenuWaypoints +
[
[ ["Item", _x] ,
["Action", call compile format["{[[%1,%2] '%3']  execVM "''Scripts\TCIM\Waypoint.sqf''"}",
_num, call compile format ["%1Result", side player],_x]],
["Close", true] ]
]
urp!