Jump to content
Sign in to follow this  
eymerich

[] exec "script.sqs"

Recommended Posts

Good page here.... http://seit.unsw.adfa.edu.au/coursework/ZEIT2305/Resources/SQF_Tutorial/basic_sqf.HTML

EDIt: Added.....quoted from that page.

SQF is faster.

SQF can be used to make functions and scripts.

SQF improves the program flow.

SQF is structured, SQS is rarely as structured as SQF.

This should make the natives even more restless!:)

Edited by twirly

Share this post


Link to post
Share on other sites

I'm pretty new to scripting and I never learned SQS. I got started with SQF because that's what nearly all scripts are written in nowadays (I am aware that some people like Celery still release SQS scripts) but it made more sense and I found it easier to understand because its syntax resembled that of C, which is what I learned in school.

Share this post


Link to post
Share on other sites

Pretty good read, but seems a bit dated. It doesn't mention scripts now running scheduled, which often will prove the statement of running uber fast in sqf, because it is sqf, false. A bit tech stuff, but read more here:

http://ace.dev-heaven.net/wagn/Breaking_out_of_the_scheduled_scripting_prison

Also only the C syntax for structure is described, which may look confusing unless you're already familiar with C. So the syntax

for [{_p = 0},{_p < 10},{_p = _p + 1}] do { ... };

can also be written more like in basic, like:

for "_i" from 0 to 10 step 1 do { ... }; //step is optional, not required here.

A neat thing we can do with Arma's switch statement which you cannot do in C, and also not mentioned in the text, is to evaluate for each case, like

switch (true) do { //no input given on what to evaluate yet
case (bEndNow || !alive player) : { ... do something };
};

in which the last example of the text could be coded to better resemble the original sqs code. In C, true has to be a parameter, and each case has to be a value that parameter can have, so you can't mix and mingle. On the other hand, C allows you to evaluate and execute all cases, until a break command is found.

And finally, some goto'ish commands does exist also in sqf, which it doesn't mention (which is good, because I think they should be avoided as much as possible, for same reasons as avoiding goto). These are scopeName, breakOut, and breakTo. Perfectly legal to use, but I try to avoid them. And I haven't seem them used much either.

Share this post


Link to post
Share on other sites
SQF is faster.

SQF can be used to make functions and scripts.

SQF improves the program flow.

SQF is structured, SQS is rarely as structured as SQF.

This should make the natives even more restless!:)

Also from that page:

"Remember that SQS isn't as outdated as everyone tells you. It can work faster, but most of the times it's a lot easier and less time consuming to develop a script in SQS. It's mostly for functions and complex scripts that SQF syntax is needed."

There is no reason to demonize .sqs syntax. It is perfectly fine to use.

Share this post


Link to post
Share on other sites

@ST_Dux

it is not about demonizing. Please tell me, what is easier: learning a synthax at first and then another synthax later or directly learn the later only?

If you know sqs and sqf, of course it is still valid to use sqf.

If you're about to learn scripting, you just waste time as sooner or later you will have to learn sqf anyway.

Also keep in mind that most experienced scripter use sqf aswell these days. Mayself i was pretty used with sqs back in the days, then switched to sqf and now have a rather hardtime to properly read sqs scripts properly.

Means, if you're stuck with a script and need some help, the chance to get help on sqf is higher than on sqs.

Again, it has nothing to do with demonizing, it is just logical.

Share this post


Link to post
Share on other sites
Please tell me, what is easier: learning a synthax at first and then another synthax later or directly learn the later only?

As I already said earlier, if you are 100% new to scripting I agree with an all-sqf approach to scripting. However, this thread was started by someone who learned scripting in the Flashpoint era when .sqs was all that was available. It's not very helpful and kind of annoying to tell people like this to just "learn .sqf" when they ask a question about a format they are familiar with, .sqs.

Personally, I don't use .sqs for anything anymore. Since becoming familiar with .sqf at the end of the Flashpoint era (with the introduction of functions), I haven't really found any use for .sqs. I still know the format, though, because that's what I originally learned (a long long time ago), and I'm happy to help people who have questions about it.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×