adventuregamestudio / ags-manual

AGS documentation.
https://adventuregamestudio.github.io/ags-manual/
MIT License
27 stars 9 forks source link

Missing newer preprocessor commands #39

Closed morganwillcock closed 5 years ago

morganwillcock commented 5 years ago

e.g. #region and #endregion are not documented

selmiak commented 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...).

ericoporto commented 5 years ago

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.

ghost commented 5 years ago

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.

ericoporto commented 5 years ago

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:

ghost commented 5 years ago

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.

ericoporto commented 5 years ago

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

ghost commented 5 years ago

ifver means "at least version X"

ifnver means "before version X"

selmiak commented 5 years ago

just wondering, can you enclose some ifs?

ifver 2.72

... #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

endif

ifnver 2.72

// do stuff for 2.71 and below

endif

ericoporto commented 5 years ago

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 .

ghost commented 5 years ago

yes they are nestable.

ericoporto commented 5 years ago

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.

morganwillcock commented 5 years ago

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.

ericoporto commented 5 years ago

Sure, no problem, just remove the backticks :)