User Tools

Site Tools


scar_coding

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
scar_coding [2024/01/21 14:38] rap6torscar_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://www.ebswift.com/scite-text-editor-installer.html I've corrected the link to ScIte, however a modern code writing program may be just as good.+https://www.ebswift.com/scite-text-editor-installer.html //We've corrected the link to ScIte, however a modern code writing program may be just as good.//
  
 **COMMON LUA ERRORS** **COMMON LUA ERRORS**
Line 37: Line 37:
  
 Code: Code:
 +<code>
 arms = 1000 -- qqq temporary test value to see if function working arms = 1000 -- qqq temporary test value to see if function working
 +</code>
 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:
 +<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
 +</code>
 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+  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:
 +<code>
 SGroup_Add(sgroup1)  -- this won't work SGroup_Add(sgroup1)  -- this won't work
  
 SGroup_Add(sgroup1, squad2) -- this will work SGroup_Add(sgroup1, squad2) -- this will work
 +</code>
 Prevention/Fix: Check the scar doc for the right number of parameters for the function Prevention/Fix: Check the scar doc for the right number of parameters for the function
  
scar_coding.1705847893.txt.gz · Last modified: 2024/01/21 14:38 by rap6tor