gnrnr 0 Posted January 12, 2009 Hi all, I am getting the following error report in my arma.rpt file: Error in expression <if ((Count _targets) == 0) then {Goto "MoveTo> Error position: <Count _targets) == 0) then {Goto "MoveTo> Error count: Type Number, expected Array,Config entry My understanding is that _targets was unable to be "Count"ed as it was a number not an array. The script before this location reads: if ((TypeName _targets) != "ARRAY") then {[Format["%1Targets are not an array", _sideText]] Call TRACE; goto "MoveToLocation"}; Again, as i understand this, if _targets is not an array (eg number) the script should go to the moveToLocation within the script. This should mean that the Count _targets should never have been encountered. Have I done something wrong? The code in question is within an *.sqs file. I posted this earlier into the wrong group. @SNKMAN The error is appearing in the Advanced_updateSquad.sqs file. i'll not post it here as it is over 700 lines. I've been editing the SelectTarget script section as this has been where the errors are occuring. #SelectTarget ; Move to enemy target that is the closest to the team. if ((Count _enemyTargets) == 0) then {Goto "MoveToLocation"}; _location = [_leader, (_enemyTargets + [_location])] Call GetNearest; ; If we are a heavy team, and our side holds at least 4 towns, ; select the closest of the strike and scramble targets. if (!(_teamType In _heavyTypes)) then {Goto "MoveToLocation"}; if ((_side Call GetTownsHeld) < 4) then {Goto "MoveToLocation"}; _targets = []; _targets = _scrambleTargets + _strikeTargets; [Format ["%1ScrambleTargets",_sideText],Call Compile Format ["%1ScrambleTargets",_sideText,_team]] call Trace_2; [Format ["%1StrikeTargets",_sideText],Call Compile Format ["%1StrikeTargets",_sideText,_team]] call Trace_2; [Format ["%1Targets",_sideText],_sideText,_team] call Trace_2; if ((TypeName _targets) != "ARRAY") then {[Format["%1Targets are not an array", _sideText]] Call TRACE; goto "MoveToLocation"}; if ((TypeName _targets) = "NUMBER") then {[Format["%1Targets are numbers", _sideText]] Call TRACE; goto "MoveToLocation"}; if ((Count _targets) == 0) then {Goto "MoveToLocation"}; _location = [_leader, _targets] Call GetNearest; Regards Gnrnr Share this post Link to post Share on other sites
manzilla 1 Posted January 12, 2009 Â You're still in the wrong forum area. Check this section, it's not in the main ArmA forum area. ArmA Editing section: http://www.flashpoint1985.com/cgi-bin....SC;c=21 From here try one of the first 2 links. I'm not sure exactly which one to direct you to though, my apologies I'm not over there too much. You may want to try OFPEC as well: OFPEC Forums http://www.ofpec.com/forum/index.php?board=80.0 That's a bout all the help I can provide. Most of the stuff you posted is a bit over my head. EDIT: I should have known this but the correct section is the first link. Here it is: ArmA Mission Editing & Scripting section: http://www.flashpoint1985.com/cgi-bin....SF;f=71 Share this post Link to post Share on other sites
t_d 47 Posted January 12, 2009 One '=' is missing here: if ((TypeName _targets) = "NUMBER") then {[Format["%1Targets are numbers", _sideText]] Call TRACE; goto "MoveToLocation"}; The condition should look like this: (TypeName _targets) == "NUMBER" Share this post Link to post Share on other sites
gnrnr 0 Posted January 13, 2009 Thanks Kronzky. Didn't realise that this section wasn't under the Arma section. Makes sense to keep all the scripting stuff together though @manzilla Thanks for the link to the correct location @T_D Good pickup. Thanks for that. Any ideas as to why it got past the !="ARRAY" though? I added the number one to try and catch this specifically as the !="ARRAY" obviously hasn't worked. Regards Gnrnr Share this post Link to post Share on other sites
Namikaze 0 Posted January 13, 2009 How do you have _targets defined? Share this post Link to post Share on other sites
t_d 47 Posted January 13, 2009 Make a hint or sidechat like this: hint typeName _targets; to see what value it really returns. Share this post Link to post Share on other sites
gnrnr 0 Posted January 14, 2009 Make a hint or sidechat like this: hint typeName _targets; to see what value it really returns. @namikaze see above in OP. _targets = []; blah blah blah @T_D I'll try that now. If it is a number though as the error report claims, then they != "ARRAY" should trap it shouldnt it? Regards Gnrnr Share this post Link to post Share on other sites
t_d 47 Posted January 14, 2009 yes it should trap it. One question: why you use sqf syntax in a sqs? Only for being able to use goto command? Share this post Link to post Share on other sites
gnrnr 0 Posted January 14, 2009 yes it should trap it.One question: why you use sqf syntax in a sqs? Only for being able to use goto command? To be honest I hadn't realised i was doing that. How should those If Typename structure be done if using sqs sytax? if ((TypeName _targets) != "ARRAY") then {[Format["%1Targets are not an array", _sideText]] Call TRACE;goto "MoveToLocation"}; The hightlighted ";" would cause the goto movelocation to be skipped wouldn't it? Share this post Link to post Share on other sites
t_d 47 Posted January 14, 2009 No it should work like this. But sqs normally look more like this: ?((TypeName _targets) != "ARRAY") : [Format["%1Targets are not an array", _sideText]] Call TRACE;goto "MoveToLocation" and in sqs you dont need to use ; at the end of each line. So if you wouldnt have goto command in your script it would be already proper sqf syntax which is more recommended for ArmA. (Would be executed with execVM then instead of exec) Share this post Link to post Share on other sites
Namikaze 0 Posted January 14, 2009 @namikazesee above in OP. Â _targets = []; blah blah blah Ahh, okay. I personally use the BBCode "code" tags when giving code examples, because it's easier to read. :P Share this post Link to post Share on other sites
UNN 0 Posted January 16, 2009 Just in case, it's "SCALAR" not "NUMBER": <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> if ((TypeName _targets) = "SCALAR") then {[Format["%1Targets are numbers", _sideText]] Call TRACE; goto "MoveToLocation"}; Share this post Link to post Share on other sites
gnrnr 0 Posted January 19, 2009 Thanks for the responses. I'll give the suggestions a try. Thanks. Share this post Link to post Share on other sites