OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Rommel92 on 06 Jun 2008, 17:02:06

Title: Anoter Call Problem
Post by: Rommel92 on 06 Jun 2008, 17:02:06
Code: [Select]
if (_side == west) then
{
_pool = ["SquadLeaderW","SoldierWB","SoldierWG","SoldierWAT","SoldierWMG","SoldierWG","SoldierWMedic","SoldierWG","SoldierWG","SoldierWG","SoldierWG","SoldierWMG"];
};
if (_side == east) then
{
_pool = ["SquadLeaderE","SoldierEB","SoldierEG","SoldierEAT","SoldierEMG","SoldierEG","SoldierEMedic","SoldierEG","SoldierEG","SoldierEG","SoldierEG","SoldierEMG"];
};

A segment of a script that is run with a call compile preProcessFile... Doesn't like switch / if statements?!  :dunno:

Code: [Select]
player globalchat format ["%1",_pool];
_POOL = Scalar Bool Array 0xe0fffff etc.
Title: Re: Anoter Call Problem
Post by: i0n0s on 06 Jun 2008, 17:45:01
Please give the last line of the script.
Title: Re: Another Call Problem
Post by: Rommel92 on 06 Jun 2008, 18:50:06
Code: [Select]
/*
make.sqf;
Version: 110 [07, 06, 2008];
Author(s): Rommel

Execution: nul = [WEST,"SoldierWB",(position Gulan),[],"FORM",10] execVM "make.sqf";
*/

_side = _this select 0;
_type = _this select 1;
_position = _this select 2;
_markers = _this select 3;
_special = _this select 4;

_pool = ["SquadLeaderW","SoldierWB","SoldierWG","SoldierWAT","SoldierWMG","SoldierWG","SoldierWMedic","SoldierWG","SoldierWG","SoldierWG","SoldierWG","SoldierWMG"];

_group = createGroup _side;

{
_man = _group createUnit [_x, _position, _markers, 0, _special];
[_man,_position] spawn
{
_para = _this select 0;
_pos = _this select 1;

_chute = "ParachuteC" createVehicle _pos;
_chute setPos [(_pos select 0) + (50 - random 100), (_pos select 1) + (50 - random 100),(_pos select 2) + 200];
_para moveInDriver _chute;
};
} forEach _pool;
 _group
Title: Re: Anoter Call Problem
Post by: i0n0s on 06 Jun 2008, 18:54:38
That globalChat was in the function for debug purposes?

Add private for each variable. Missing private can cause some strange errors.
Title: Re: Anoter Call Problem
Post by: Mandoble on 06 Jun 2008, 19:59:44
What you have in the first post doesnt coincide with the second one, so obviously the code that fails is not the last one.
In the first case, _pool is defined within the scope of the if, so you cannot use it outside it unless you add, for example,a private ["_pool"]; as very first line of your script.
Title: Re: Anoter Call Problem
Post by: Rommel92 on 07 Jun 2008, 03:21:11
Thanks Mando!  :good:

HOWEVER:

Another question:

First Chat Line is Executing Code.
Second Chat Line is Received Code in the Executed Script. And then the error shown above.
Code below shown in order of debug lines.

(http://img359.imageshack.us/img359/6074/platzlr6.jpg)
Code: [Select]
_group = _this select 3 select 0;
_type = _this select 3 select 1;

player globalchat format["%1 --- %2 --- %3 --- %4",_group,_type,_pos,_shift];
call compile format ["titleCut ['Shift - Click %1 Waypoint Location on Map.','PLAIN DOWN',3]", _type];

call compile format ["onMapSingleClick '[''%1'',''%2'',_pos,_shift] call compile preProcessFile ''Scripts\OnMapSingleClick.sqf''; true;'",_group,_type];

Code: [Select]
_group = format["%1",_this select 0];
_type = _this select 1;
_pos = _this select 2;
_shift = _this select 3;

_side = side _leader;

player globalchat format["%1 --- %2 --- %3 --- %4",_group,_type,_pos,_shift];

if (_shift) then
{
onMapSingleClick "";
_waypoint = _group addWaypoint [_pos, 20];
_waypoint setWaypointType _type;

[_side, "HQ"] sideChat format["%1 %2 task received. Out.",_group, _type];
};

Its clearly coming in as a string, but how do I convert this to a GROUP. :blink:
(Or a BOOL as the game says it is... (via further debugging))
Code: (debugging) [Select]
_count = count units call compile format[" '%1' ",_group];
player globalchat format ["%1",_count];