OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: laggy on 16 Dec 2008, 22:08:53
-
Hi everyone,
I have this sqf going:
_body = _this select 0;
_fly = _this select 1;
while {true} do
{
if (_fly distance _body > 3) then
{
_fly setpos getpos _body;
} else {
_fly setpos [(getpos _fly select 0) + (0.1 - random 0.2) , (getpos _fly select 1) + (0.1 - random 0.2), (getpos _fly select 2) + (0.1 - random 0.2)];
};
sleep 1;
};
I get this errormessage:
#sleep 1
error generic error in expression
Someone probably laughs at me, but I have no idea what is wrong.
Laggy
-
It seems correct... Did you copy/pasted the code from the original one or rewrite it?
-
It's copied and pasted.
-
Is the error displayed immediately or after some time? Because I remember that a While-loop has a limitation of 10000 loops before exiting and giving a generic expression error. Anyway now I try it on a test map.
EDIT: I tried and it works for me (no error displayed). Are you sure you passed the script correct parameters? In which context are you using it?
-
I have an effect with flies in a mission, it comes in two scripts.
deadguy is unit named that (it's a corpse)
That script is run when a player enters a trigger.
OnActivation [deadguy] exec "flies.sqs"
The SQF is then run from that script as you can see.
_body = _this select 0
_count = 0
#loop
? _count >= 100 : exit
_count = _count + 1
_fly = "HouseFly" createvehicle [(getpos _body select 0) + (2 - random 4), (getpos _body select 1) + (2 - random 4), random 2]
_fly setdir random 360
[_body,_fly] exec "randomfly.sqf"
_fly = ObjNull
~ 0.01
goto "loop"
Laggy
-
Check the parameters you pass the script (I tested it with a M1A1 and a Harrier flying). Could you tell me the use of the script and what parameters you're passing to it
-
Just modified my last message to answer your questions.
-
*cry*
You started a SQF file with exec, so it will get interpreted as a SQS file.
You have to use execVM to get the SQF syntax.
-
:-[
Ehhh, I said someone is laughing at me.
It works now.
Thanks both of you,
Laggy
-
:)
-
While on this subject....Could anyone expound on what the VM is in execVM and why it must be there to distinguish SQF? Just for further understanding. :scratch:
-
Well, ummm, its the name of the command to execute sqf scripts and functions as opposed to the exec command which is for sqs scripts.
ExecVM (http://ofpec.com/COMREF/index.php?action=details&id=550)
or
ExecVM (http://ofpec.com/COMREF/index.php?action=details&id=551)
as opposed to Exec (http://ofpec.com/COMREF/index.php?action=details&id=125)
No idea what the VM actually means... maybe Virtual Machine, Very Muchly, Van Morrison, Very Meaningless ... take your pick.
Planck
-
:D
It's Virtual Machine
#EDIT: No need to quote the entire previous post you're replying to.. h-