OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: dmakatra on 21 Jun 2007, 21:49:05
-
Right, I'm getting ArmA next week so I want to be prepared once it arrives. So I had a look around at the Biki to see what has changed (editing-wise) from OFP to ArmA. The Biki states that while SQS is still supported, SQF is the primary language. Why? I never really learnt SQF back in the day because I was scared looking at the syntax, but wasn't SQF merely a complement to SQS? I understand that there are several advantages (and disadvantages) to both formats, but can someone give me a little background to why the SQS is treated as obsolete?
I tried searching the forums and I just ended up with topics in which loops were named after various culturally-tabooed body-openings. :whistle:
-
Well, the good point about sqf is that now Sleeps are supported there, so you are not limited to "fast" functions anymore. And sqf scripts (not functions) are compiled by execVM and executed so they are not "parsed" every time as with SQS which means they consumes less CPU and are more efficient. But for scripts where you have > 1 sec sleeps SQS are still perfectly valid, just as valid as in OFP.
SQF has another advantage when executed with execVM, execVM command returns an script handler and you may use it to terminate the script from outside and/or to check whether that script is finished or not. For example:
_script = execVM "myscript.sqf"
@scriptDone _script
hint "Script finished"
Or
_script = execVM "myscript.sqf"
~5
?!scriptDone _script
terminate _script
-
Thanks for the answer mate. Looks like it's time to learn SQF-syntax then. :)
-
This (http://www.ofpec.com/forum/index.php?topic=28702.0) should get you started.
-
I'm sure there are better opportunities in SQF writing, but the SQS you learned in OFP still 95% applies to Armed Assault, so you should have no problems jumping in and creating. I've been able to use old OFP stuff for most of my mission.
-
SQF is especially better when you have to repeat the same script or function more often in the same mission.
Especially when much of such things are happening in the mission.
preProcessFile, spawn and call, are your friends :-)
I recommend anyone to simply quit SQS and work in 1 language-only, not only because SQF is better in many cases, but also so you don't have to develop in 2 different scripting formats but simply keep to 1, easier for yourself, easier for others in the end aswell...
1 Syntax to rule them all :-)
-
SQF also feels better to program. It's closer to what you will find in the real world. Since SQS is line based I used to need 3 to 4 SQS scripts to do what 1 SQF script can do. This also makes the code easier to read and edit.
--Ben