Lou Montana/Sandbox – User
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (tiny update) |
m (Getting started; recommended skills to do the thing and some minor changes) |
||
Line 7: | Line 7: | ||
---- | ---- | ||
[[:Category: Scripting Topics]] | |||
==Getting start== | |||
===Recommended skills and things=== | |||
*An Arma game | |||
*Passion | |||
*Little bit English knowledge and/or access to a translator to your mother language | |||
*Tutorial/example article (Such as this) | |||
*Skill of Googling | |||
*Advanced text editor (Such as Notepad++) | |||
== Best practices == | == Best practices == | ||
Line 22: | Line 32: | ||
[[private]] _countDown = 360;</code> | [[private]] _countDown = 360;</code> | ||
* Format, indentation, no one-line, spacing, line returns | |||
* Be consistent (space/tab indentation, (camel)casing, [https://en.wikipedia.org/wiki/Indentation_style#K&R_style K&R style] / [https://en.wikipedia.org/wiki/Indentation_style#Allman_style Allman style] indenting) | |||
* Use comments frequently to explain ''not'' what the code does, but ''why'' it is done this way. | * Use comments frequently to explain ''not'' what the code does, but ''why'' it is done this way. | ||
=== Make reusable functions === | === Make reusable functions === | ||
* Don't | * Don't copy and paste the same code, make functions | ||
* Don't make macros to replace SQF code | * Don't make macros to replace SQF code | ||
Line 35: | Line 45: | ||
* Prefix your public variables and [[setVariable]] with your tag | * Prefix your public variables and [[setVariable]] with your tag | ||
* PRIVATE (or params) your variables | * PRIVATE (or params) your variables | ||
* Use #define SOME_CONST for constant values instead of variables | * Use {{Inline code|#define SOME_CONST}} for constant values instead of variables | ||
=== Code location === | === Code location === |
Revision as of 10:30, 7 September 2019
Getting start
Recommended skills and things
- An Arma game
- Passion
- Little bit English knowledge and/or access to a translator to your mother language
- Tutorial/example article (Such as this)
- Skill of Googling
- Advanced text editor (Such as Notepad++)
Best practices
Make it readable
- Some general coding tips from here: standards, line lengths, etc
- Variable names should indicate what they store / are used for.
- Example
// Instead of
private _cd = 360;
// do
private _countDown = 360;
- Format, indentation, no one-line, spacing, line returns
- Be consistent (space/tab indentation, (camel)casing, K&R style / Allman style indenting)
- Use comments frequently to explain not what the code does, but why it is done this way.
Make reusable functions
- Don't copy and paste the same code, make functions
- Don't make macros to replace SQF code
Variables
- Prefix your public variables and setVariable with your tag
- PRIVATE (or params) your variables
- Use
#define SOME_CONST
for constant values instead of variables
Code location
- Nothing in init box but local commands for this specific unit - all the init boxes are run client-side on client connection
0 = myCommand
is "useful" only for editor fields that for no apparent reason refuse commands returning a value.
Final words
- Learn from others' scripts but don't steal code and pretend it's yours — be a decent human being.
- Don't try to obfuscate your code: it is considered rude, especially since you learnt from others.
- Have fun!