Home   Help Search Login Register  

Author Topic: Error Local variable in global space?  (Read 2417 times)

0 Members and 1 Guest are viewing this topic.

Offline Sparticus76

  • Members
  • *
Error Local variable in global space?
« on: 14 Jan 2008, 13:43:36 »
G'day, here's the script so far..


Code: [Select]
private
["_firer","_range","_type","_distance","_targets","_numtgts","_v","_n0","_n1","_tgttype","_tgtcnt","_enunits","_ttype","_tid","_fpos","typcnt"];
_firer = _this select 0;
_range = _this select 1;
_type = [];
_distance = [];
_enunits = [];
_ttype = [];
_tid = [];
_fpos = [];
_targets = _firer NearTargets _range;
_numtgts = count _targets;
_v = 0;
_n0 = 0;
_n1 = 1;
_tgttype = ["DSHKM","AGS","D30","BRDM2","UAZMG","UAZ_AGS30","BRDM2_ATGM","BMP2","ZSU","KA50","MI17_MG","SU34B","RHIB","RHIB2Turret"];
_tgtcnt = count _targets;



/*
; SCREEN FOR THREAT
*/

while { _v < _tgtcnt } do
                       {
                       _enunits = _targets select _v;
                       _ttype = _enunits select 1;
                       _tid = _enunits select 4;
                       if (_ttype in _tgttype) then
                                               {
                                               _type = _type + [_tid];
                                               };
                       _v = _v + 1;
                       };



/*
; GET RANGES TO NEWLY ARRAYED UNITS
*/

_typcnt = count _type;
while { _v < _typcnt} do
                      {
                      _fpos = getpos _firer;
                      _ttype = _type select _v;
                      hint format ["type count = %1",_typcnt];
                      sleep 5;
                      _distance = _fpos distance getpos _ttype;
                      hint format ["distance = %1",_distance];
                      sleep 5;
                      _enunits = _enunits + [_distance];
                      hint format ["variable = %1",_enunits];
                      sleep 5;
                      _v = _v + 1;
                      };

and here's the error...

Error in expression <\Ahren\missions\test.Intro\target.sqf"

Quote
private ["_firer","_range","_type","_dis>
  Error position: <private ["_firer","_range","_type","_dis>
  Error Local variable in global space
File C:\Users\User\.........................\missions\test.Intro\target.sqf, line 2

I dont know what that really means, and I've done a search for local variables in a global space....nothing. I've declared them as private so I dont know what I'm doing wrong here..

Offline Loyalguard

  • Former Staff
  • ****
Re: Error Local variable in global space?
« Reply #1 on: 14 Jan 2008, 14:19:09 »
Changing "typcnt" to "_typcnt" in your  private array will probably resolve the error.

Offline Sparticus76

  • Members
  • *
Re: Error Local variable in global space?
« Reply #2 on: 15 Jan 2008, 05:28:25 »
Oops, my first post in the Advanced section and I blow it with a typo!..lol, thanks Loyalguard.