Function – Talk
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)
- I would really recommend not using sqs for the structed syntax scripts. There are even instances in the game where both new and old syntax is accepted, and old syntax is used for sqs extenstion (like init.sqs, init.sqf). --Suma 15:28, 27 September 2006 (CEST)
- In any event, these wiki pages are sowing confusion by wantonly mixing the terms. For example, the execVM page uses both function and script interchangably in its text. Perhaps a better lexical differentiation would be "parallel" and "serial". Users will have loads of fun trying to decipher whether a particular SQF file must be executed via spawn, execVM or call compile. I suppose the user community will sort it out by either defining a new file suffix (e.g. SQP for parallel function/structured script/whatever you want to call it) or requiring a header with the necessary information. --Mr.Peanut 16:42, 27 September 2006 (CEST)