scar_coding
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
scar_coding [2024/01/21 14:38] – rap6tor | scar_coding [2025/01/10 11:27] (current) – old revision restored (2024/01/21 14:49) admin | ||
---|---|---|---|
Line 1: | Line 1: | ||
===== SCAR Coding ===== | ===== SCAR Coding ===== | ||
- | **The following Guide was written by modder KanKrusha on RelicNews Forums (now defunct), however it is one of the more comprehensive guides currently available. Modern notes are highlighted.** | + | **The following Guide was written by modder KanKrusha on RelicNews Forums (now defunct), however it is one of the more comprehensive guides currently available.** |
+ | ---- | ||
**[HOW TO] Common Lua and SCAR errors: Identification and Prevention** | **[HOW TO] Common Lua and SCAR errors: Identification and Prevention** | ||
Line 22: | Line 22: | ||
Lua is very sensitive to typos and errors. I check all my script by pasting it into a program called ScIte. It is a bit fussy to use but will identify syntax problems before I try the code out in game | Lua is very sensitive to typos and errors. I check all my script by pasting it into a program called ScIte. It is a bit fussy to use but will identify syntax problems before I try the code out in game | ||
- | https:// | + | https:// |
**COMMON LUA ERRORS** | **COMMON LUA ERRORS** | ||
Line 37: | Line 37: | ||
Code: | Code: | ||
+ | < | ||
arms = 1000 -- qqq temporary test value to see if function working | arms = 1000 -- qqq temporary test value to see if function working | ||
+ | </ | ||
You can also disable chunks of code by commenting it out with square brackets | You can also disable chunks of code by commenting it out with square brackets | ||
Code: | Code: | ||
+ | < | ||
--[[ putting 2 hyphens and 2 square brackets here comments out the following code | --[[ putting 2 hyphens and 2 square brackets here comments out the following code | ||
Line 53: | Line 53: | ||
]] -- the last 2 square brackets ends the commenting | ]] -- the last 2 square brackets ends the commenting | ||
+ | </ | ||
Prevention: Liberally use comments | Prevention: Liberally use comments | ||
Line 242: | Line 242: | ||
function Squad_NewHealthchecker(squad) | function Squad_NewHealthchecker(squad) | ||
- | return Squad_GetHealth(sQuad) -- this is a typo and will return a nil value so will seem to do nothing | + | |
end | end | ||
Line 255: | Line 255: | ||
Code: | Code: | ||
+ | < | ||
SGroup_Add(sgroup1) -- this won't work | SGroup_Add(sgroup1) -- this won't work | ||
SGroup_Add(sgroup1, | SGroup_Add(sgroup1, | ||
+ | </ | ||
Prevention/ | Prevention/ | ||
scar_coding.1705847893.txt.gz · Last modified: 2024/01/21 14:38 by rap6tor