Home   Help Search Login Register  

Author Topic: Difference between SQS and SQF?  (Read 1361 times)

0 Members and 1 Guest are viewing this topic.

PheliCan

  • Guest
Difference between SQS and SQF?
« on: 28 May 2003, 01:38:28 »
What is the difference between programming in SQS-files and SQF-files? Can you do everything in SQF-files that you can in SQS-files, vice versa? I know about the "new line" thing, but does the commands work with both fileextensions?

Can I call a function (SQF-file) with the "exec"-command as I can with SQS-files? Can I send arguments?

SQF-files seems easier to program for me as it reminds alot of C-language, which I'm much more familiar with...

Komuna

  • Guest
Re:Difference between SQS and SQF?
« Reply #1 on: 28 May 2003, 12:08:57 »
EhEhEh! Have you tried [] exec "myscriptwithoutext"...
It works also! You don't realy need to add your scripts an extension!

But, sorry, I think this won't answer your Q.
You could try yourself, and check out for differences between calling a SQS or a SQF...!

About SQF: I'm very new to those kind of functions, but, for what I know, SQF have a specific calling method. Check the Command Refference and you might get an answer! ;)

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Difference between SQS and SQF?
« Reply #2 on: 28 May 2003, 13:15:56 »
In case you haven't found it there is a whole bunch of stuff about functions and how to write them in the Ed Depot.

functions
Plenty of reviewed ArmA missions for you to play

Offline Doolittle

  • Contributing Member
  • **
  • _this select 0
Re:Difference between SQS and SQF?
« Reply #3 on: 28 May 2003, 19:33:11 »
The naming is just to make it easy on the HOOMANS when organizing everything.  It could be called anything.

.sqs are run by using the exec command and .sqf are run by using the call command.  You use functions when you want a value returned to you.

Doolittle

PheliCan

  • Guest
Re:Difference between SQS and SQF?
« Reply #4 on: 29 May 2003, 00:38:16 »
Thanks for the help guys!

I read a little about SQF-functions and I realized I was totally wrong about the way to use them---

My code didn't work the way I wanted it to, but I'll do it the classic way instead.

Here is my SQF-art:
Code: [Select]
_WestTrigger = _this select 0;
_EastTrigger = _this select 1;

_WestArray = list _WestTrigger;
_EastArray = list _EastTrigger;
_i = 0;
while "_i < (count _WestArray)" do
{
   _WestUnit = _WestArray select _i;
   _j = 0;
   while "_j < (count _EastArray)" do
   {
      _EastUnit = _EastArray select _j;
      if ((_WestUnit knowsAbout _EastUnit) > 1) then
      {
         _WestUnit sideRadio "seehim";
         DetectedArray = DetectedArray + [_EastUnit];
      };
      if ((_EastUnit knowsAbout _WestUnit) > 1) then
      {
         _EastUnit sideRadio "seehim";
         DetectedArray = DetectedArray + [_WestUnit];
      };
      _j = _j + 1;
   };
   _i = _i + 1;
};

and....

Code: [Select]
_WestTrigger = _this select 0;
_EastTrigger = _this select 1;

#start;
_WestArray = list _WestTrigger;
_EastArray = list _EastTrigger;

_i = 0;
while (_i < (count DetectedArray)) do
{
   _Detected = false;
   _DetectedUnit = DetectedArray select _i;
   if ((side _DetectedUnit) == "east") then
   {
      {
         if ((_x knowsAbout _DetectedUnit) > 2) then
         {
            _Detected = true;
         };
         ~0.01;
      } forEach _WestArray;
   };

   if ((side _DetectedUnit) == "west") then
   {
      {
         if ((_x knowsAbout _DetectedUnit) > 2) then
         {
            _Detected = true;
         };
         ~0.01;
      } forEach _EastArray;
   };

   if (!_Detected || !(alive _DetectedUnit)) then
   {
      _j = _i;
      while (_j < ((count DetectedArray) -1)) do
      {
         debugLog format["Deleting: %1; Current: %2", (DetectedArray select _j), (DetectedArray select _i)];
         DetectedArray set [_j, (DetectedArray select (_j + 1))];
         _j = _j + 1;
         ~0.01;
      };
      DetectedArray resize ((count DetectedArray) - 1);
   };
   _i = _i + 1;
   ~0.01;
};

~10;
goto "start";
exit;

Guess I lost it somewhere!!! ;-)
« Last Edit: 29 May 2003, 00:39:42 by PheliCan »