Home   Help Search Login Register  

Author Topic: IED sqf syntax error  (Read 1553 times)

0 Members and 1 Guest are viewing this topic.

Offline erebus1

  • Members
  • *
IED sqf syntax error
« 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?

Code: [Select]
// 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;
};

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: IED sqf syntax error
« Reply #1 on: 23 Jul 2008, 18:17:53 »
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.

Code: (compile and run SQF in new script instance) [Select]
[this,15,0.2] execVM "ied.sqf"

Code: (precompile SQF and run, waiting for the script to finish, returning a value) [Select]
ied = compile preprocessFileLineNumbers "ied.sqf";
_result = [this,15,0.2] call ied;

Code: (precompile SQF and run in new script instance) [Select]
ied = compile preprocessFileLineNumbers "ied.sqf";
[this,15,0.2] spawn ied;
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline erebus1

  • Members
  • *
Re: IED sqf syntax error
« Reply #2 on: 23 Jul 2008, 20:56:31 »
with [this,15,0.2] execVM "ied.sqf"

i get error, Type Script, Expected Nothing.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: IED sqf syntax error
« Reply #3 on: 23 Jul 2008, 20:58:13 »
Try with
Code: [Select]
res = [this,15,0.2] execVM "ied.sqf"

Offline erebus1

  • Members
  • *
Re: IED sqf syntax error
« Reply #4 on: 23 Jul 2008, 21:04:47 »
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

Offline MachoMan

  • Honoured
  • Former Staff
  • ****
  • KISS, Keep it Simple Stupid
Re: IED sqf syntax error
« Reply #5 on: 23 Jul 2008, 22:14:02 »
Why loop? :no: Just use a trigger!
Get those missions out there you morons!

Offline Cheetah

  • Former Staff
  • ****
Re: IED sqf syntax error
« Reply #6 on: 23 Jul 2008, 22:23:35 »
Alternatively, use the waitUntil command.
Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: IED sqf syntax error
« Reply #7 on: 23 Jul 2008, 22:51:14 »
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.