Exception handling
Category: Armed Assault:Scripting
In Armed Assault is implemented system of scripting commands witch allows your scripts react to lots of kinds of exceptions.
Standard construction is:
try {
//block, that can throw exception
if (_name == "") then {
throw "invalid _name"
} else {
TitleText ["And the name is:", "PLAIN DOWN"]
~1
TitleText [_name, "PLAIN DOWN"]
}
catch {
//block, that processes an exception
if (_exception == "invalid _name") then {
echo "Wrong name detected"
TitleText ["And the name isn't", "PLAIN DOWN"]
}
}
Template:AnswerMe Probably is possible this too:
try {
TitleText ["Sgt. Detritus: He have luck, but next time I'll kill him!", "PLAIN DOWN"] [jeepOne] exec "killDriver.sqs"
}
catch {
if (_exception == "car empty") then {
TitleText ["Sgt. Detritus: He have luck, but next time I'll kill him!", "PLAIN DOWN"]
} else {
TitleText ["Sgt. Detritus: Some strange error appears...", "PLAIN DOWN"]
}