The Fatal Scar Error's in game come from a variety of places.
Usually, it is badly written scripting, although in cases the game itself doesn't do what it is meant to.
If you have found a link from a function description, usually the function description will describe usual cases for why the function is causing the error.
Check your warnings.log file (or the console too, if you use the -dev parameter on your DoW shortcut). This will describe (in sometimes very strange words) what exactly went on and why the error occured. It might make no sense, mind you!
Usually, however, if calling a SCAR function caused an error, it will use error() to print out what caused the error, and thus making it easy to track down when and why it was caused.
Making sure you know when your own functions fire is also important. During a scripts development, using print("[ID] Rule_Name") at the start of each function is a good idea:
-- Example SetupAI Function called in a script made by Finaldeath.
function SetupAI()
print("[FD RULE] SetupAI")
-- Rest of the function code
end
-- Second example
function Rule_PlayerLoses()
print("[FD RULE] Rule_PlayerLoses")
-- Rest of the function code
endKeep it consistant. You can debug each bit of a function like that too:
-- Example of rule SetDifficultyLevel() with more debugging of each if statement clause.
function SetDifficultyLevel( difficultyLevel )
print("[FD RULE] SetDifficultyLevel")
-- easy
if difficultyLevel == DIFFICULTY_EASY then
print("[FD Rule] SetDifficultyLevel - Difficulty Easy activated")
-- medium
elseif difficultyLevel == DIFFICULTY_NORMAL then
print("[FD Rule] SetDifficultyLevel - Difficulty Medium activated")
-- hard
elseif difficultyLevel == DIFFICULTY_HARD then
print("[FD Rule] SetDifficultyLevel - Difficulty Hard activated")
end
endYou can debug almost all of the SCAR functions by using the LUA function print. Using this on anything will print something out, even on functions themselves.
You can also test almost every part of the SCAR libary for errors – for example, testing all variables you get for if they are invalid, for instance. There are several SCAR functions used just to test if something is invalid (or can be used as such).
Here is a list of errors found and what they usually mean:
Incomplete – Requires some work! Note: Need to check for different SCAR errors that happen. Usually, however, they are printouts from the functions themselves (for example, passing an integer into a function that requires a string, will print an error).