Function – Talk

From Bohemia Interactive Community
Revision as of 02:28, 27 September 2006 by UNN (talk | contribs)
Jump to navigation Jump to search

How can engine know if I want to use standard or semicolon free variation? In both is first command semicoloned... --Djura 19:34, 24 July 2006 (CEST)

There is no semicolon free in function-based syntax. Watch the examples, they all have semicolons to separate instructions. When no semicolon, it's a curled-brace, ie an "embedded" function line, or set of instruction. The semicolon free syntax exists in current OFP-style scripts, launched by exec. If I'm not mistaken, once you launch things through call, spawn or execVM, you're using function syntax that requires semicolons to separate instructions. If you still use "exec", you're using OFP-style syntax --Whisper 19:44, 24 July 2006 (CEST)

The deprecation of scripts has not been clearly explained. The proper explanation here and in Script_syntax should be that SQS-script syntax has been deprecated in favour of SQF-script syntax(I am coining the term SQF-script for lack of a better alternative). The differences between an SQF-function and an SQF-script are:

  • 1) SQF-scripts can not return values
  • 2) SQF-scripts can pause and wait using the sleep and waitUntil commands
  • 3) SQF-scripts are run in parallel via the spawn command.

The comments about script deprecation so far led me to believe that all functions would have to run in parallel. I doubt I am the only person so confused.--Mr.Peanut 21:28, 26 September 2006 (CEST)

The content in Scripts is concise. I think it's the function page that creates the confusion, using terms like "function based script"?
I'm not sure why the original terminology was dropped? Calling something a script function is a bit confusing. Scripts (*.sqs) Functions (*.sqf) make code that bit easier to understand. If your looking at a *.sqf file, then you know it's supposed to be executed with the call command. Vice versa for scripts, a *.sqs is supposed to be executed with the spawn and execVM commands? That fact that scripts now share the same syntax as functions, should be easy enough for most people to grasp. Without having to create a whole new lexicon. UNN 02:28, 27 September 2006 (CEST)