OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Gielovic on 18 Oct 2007, 17:37:54

Title: Silly loops
Post by: Gielovic on 18 Oct 2007, 17:37:54
I've such a stupid problem...when i make a for/while loop ArmA is giving me the following error
Code: [Select]
Error in expression < _this select 0;
_i = 0;
while {_i < 5} do
{ _pos = [(_basepos select 0) + 10, (>
  Error position: <do
{ _pos = [(_basepos select 0) + 10, (>
  Error do: Type String, expected code
File D:\My Documents\ArmA\missions\setPos.Intro\basecreator2.sqf, line 9

the script looks like this, it's a .sqf and i execute it by base = [position player] execVM "script.sqf"

Code: [Select]
_i = 0;
while {_i < 5} do
{ blabla;
_i = _i + 1;
};

has anyone an idea what i'm doing wrong cause this is the way it's written on the BIKI:S
Title: Re: Silly loops
Post by: Gielovic on 18 Oct 2007, 17:44:11
ow i'm sorry...saw there was something wrong in the while-loop...dunno why i get these kind of messages but....

well you can remove this if you like as i see i can't :D
Title: Re: Silly loops
Post by: Spooner on 18 Oct 2007, 18:15:05
"Error do: Type String, expected code" means that the block after do, encased in { } isn't formed correctly, so it thinks it must be a string type rather than a code type as it expected. This just means there is a syntax error of some kind somewhere within the { } block, such as missing a semi-colon or mis-typing a command.
Title: Re: Silly loops
Post by: h- on 18 Oct 2007, 22:31:43
Gielovic, for future reference; we do not allow consecutive posting in such a short timeframe.
If you have something to add to your post after a short period of time modify it instead of replying to yourself..