OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: erebus1 on 23 Jul 2008, 17:12:10
-
Hey all, Im trying to learn sqf coming from sqs.. I have an IED script that worked with sqs but when I ported it over it's telling me I'm missing a closing }.
Am I missing something here?
// ied.sqf
// syntax as follows
// [this,distance from player before expload,damage needed to expload] exec "ied.sqf"
// [this,15,0.2] exec "ied.sqf"
_veh = _this select 0;
_distance = _this select 1;
_damage = _this select 2;
if ((getdammage _veh >= _damage) || (side player == west)&&(player distance _veh < _distance)) then
{
_ied = "Sh_120_SABOT" createvehicle getpos _veh;
};
-
Yes, you are missing something. That file compiles and runs with no errors for me ;P
The problem is how you are running it. ArmA doesn't care about file extensions; it is the command you use to run it that determines whether the SQS or SQF interpreter is used.
[this,15,0.2] execVM "ied.sqf"
ied = compile preprocessFileLineNumbers "ied.sqf";
_result = [this,15,0.2] call ied;
ied = compile preprocessFileLineNumbers "ied.sqf";
[this,15,0.2] spawn ied;
-
with [this,15,0.2] execVM "ied.sqf"
i get error, Type Script, Expected Nothing.
-
Try with
res = [this,15,0.2] execVM "ied.sqf"
-
thanks fellas, that got rid of the error mandoble, only problem is its not looping, so I have to put it inside a while do?
in my other one I used loop, but that doesnt work in sqf
-
Why loop? :no: Just use a trigger!
-
Alternatively, use the waitUntil (http://www.ofpec.com/COMREF/index.php?action=list&game=All&letter=w#812) command.
-
You are using ""this"" as argument, so I did assume you were already executing that from the init field of a unit, from a trigger or from a waypoint.