| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
hpl2:amnesia:script_language_reference_and_guide:quick_start [2012/12/21 22:26] thegreatcthulhu |
hpl2:amnesia:script_language_reference_and_guide:quick_start [2013/08/08 21:21] (current) killer339494 Checkbox Change |
||
|---|---|---|---|
| Line 42: | Line 42: | ||
| '' void OnEnter()''\\ | '' void OnEnter()''\\ | ||
| declares the OnEnter() function. The token in front of it denotes its return type; in this case, it is ''void'', which you can think of to mean "nothing" or "empty" – it simply states that this function does not return any value (some functions you'll write //will// return a value, e.g., a result of some calculation). OnEnter() just does something (starts the fade in effect), but nothing is returned from it (you'll learn more about return values in the section on functions).\\ | declares the OnEnter() function. The token in front of it denotes its return type; in this case, it is ''void'', which you can think of to mean "nothing" or "empty" – it simply states that this function does not return any value (some functions you'll write //will// return a value, e.g., a result of some calculation). OnEnter() just does something (starts the fade in effect), but nothing is returned from it (you'll learn more about return values in the section on functions).\\ | ||
| - | Everything that follows after that line is the //body// of the OnEnter() function. It is the function's body that defines what the function does. It is enclosed by ''{'' and ''}''. You can think of these symbols as of boundaries – they bound the space of the function body. Everything in between them belongs to the function. | + | Everything that follows after that line is the //body// of the OnEnter() function. It is the function's body that defines what the function does. It is enclosed by ''{'' and ''}''. You can think of these symbols as of boundaries – they bound the space of the function body. Everything in between them belongs to the function.\\ |
| + | If a region of code is bounded by ''{'' and ''}'', it is also referred to as a //code block//. | ||
| The text behind ''%%//%%'' represents scriptwriter's comments. These are completely ignored by the script engine, as if they weren't there at all. They are intended for the human reader – you can use them to explain what a certain peace of code does. You can delete them, and the script's functionality will remain exactly the same. | The text behind ''%%//%%'' represents scriptwriter's comments. These are completely ignored by the script engine, as if they weren't there at all. They are intended for the human reader – you can use them to explain what a certain peace of code does. You can delete them, and the script's functionality will remain exactly the same. | ||