Closed morganwillcock closed 5 years ago
I'd say it has its place either under
Editor Reference > Other Features (This section describes AGS features that were not covered in the tutorial.)
or just under
Scripting
the first one is more for editor windows, so scripting might be better suited, but there it easily gets lost and actually it has no effect on the script after all, but it helps with organizing the scripts (like the different editor windows do...).
Ok, I imagine the description would be:
Preprocessor region
You can wrap a code between lines containing #region
and #endregion
to create a section used for code folding. In the AGS Editor you can use this to hide sections of your code you don't need to see by using the +
button at the left side of the script editor.
Preprocessor commands are also part of the scripting language. Perhaps Scripting Language > Preprocessor ? and then explain what preprocessor does, and list all the preprocessor commands there.
BTW, #ifver command is described in "Script language keywords" in "Version checking" paragraph.
Ok, created a page Preprocessor.md , and placed it under ScriptingLanguage.md. The page is still in initial state, I don't use much preprocessor entries... What is supported? Also I may have written BS, so just tell me and we can fix it. :grimacing:
https://github.com/adventuregamestudio/ags/blob/ags3/Editor/AGS.CScript.Compiler/Preprocessor.cs
Macro creation
Test if macro is defined
Test if is compiled by particular version of AGS (perhaps move from https://github.com/adventuregamestudio/ags-manual/wiki/ScriptKeywords#version-checking)
User defined compile-time error (with message)
Regions
These do nothing, ignored legacy commands from pre-3 era. Still maybe mention them since they are valid keywords.
I got a little confused with #ifver
and #ifnver
. They check for equal and above, and below, or only equal and not equal?
I copied the text from the referred topic to here: https://github.com/adventuregamestudio/ags-manual/wiki/Preprocessor#ifver-version-checking
just wondering, can you enclose some ifs?
... #ifver 3.2.1 ... // do stuff for 3.2.1 and above ... #endif ... #ifnver 3.2.1 ... // do stuff for 3.2.0 and below but above 2.72 ... #endif
// do stuff for 2.71 and below
I have no idea, would need to test... I like to take a look on tween source when I am curious
https://github.com/edmundito/ags-tween/blob/master/Tween/Tween.ash https://github.com/edmundito/ags-tween/blob/master/Tween/Tween.asc
Looks like for version checking it isn't needed to nest to accomplish what you want but from other ifdef checks, it looks like it's nestable .
yes they are nestable.
We may eventually improve the preprocessor page, but for now it exists and has regions, so it should have corrected this issue. I will now close it.
Would it be okay if I edit this page to take the inline code out of the headers? For purposes of indexing I'm processing header elements, but I've realised that I'm only getting partial text on this page.
Sure, no problem, just remove the backticks :)
e.g.
#region
and#endregion
are not documented