shadowrecon Posted February 13, 2012 Share Posted February 13, 2012 So im trying to learn the proper use of these, because they do not throw errors and stop the script if setup properly and you can account for the errors and ifx them. problem is ive never used them a whole lot, and i was following a tut on the and below is one of the examples. How can i do the same thing that is going on in this Tut in scar? The errors that are coming up is 'On' , 'Message', 'ClassName' var number, zero : Integer; begin // Try to divide an integer by zero - to raise an exception Try zero := 0; number := 1 div zero; ShowMessage('number / zero = '+IntToStr(number)); except on E : Exception do ShowMessage(E.ClassName+' error raised, with message : '+E.Message); end; end; Quote Link to comment Share on other sites More sharing options...
Wanted Posted February 13, 2012 Share Posted February 13, 2012 They are a lot easier to use [sCAR]begin try PossibleFailue; except ItFailed; finally DoesThisAtTheEndEitherWay end; end.[/sCAR] Quote Link to comment Share on other sites More sharing options...
FHannes Posted February 13, 2012 Share Posted February 13, 2012 SCAR's engine does not support "on...do": [scar]var number, zero: Integer; begin try zero := 0; number := 1 div zero; ShowMessage('number / zero = ' + IntToStr(number)); except ShowMessage('Error raised'); end; end.[/scar] Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted February 13, 2012 Share Posted February 13, 2012 They are a lot easier to useHe is trying to get the actual details of the Exception raised a la Delphi. SCAR's engine does not support "on...do":Which it sadly does not appear to support. Not widely used but can be handy in certain circumstances. Quote Link to comment Share on other sites More sharing options...
FHannes Posted February 13, 2012 Share Posted February 13, 2012 Which it sadly does not appear to support. Isn't that what I said? Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted February 14, 2012 Author Share Posted February 14, 2012 SCAR's engine does not support "on...do": [scar]var number, zero: Integer; begin try zero := 0; number := 1 div zero; ShowMessage('number / zero = ' + IntToStr(number)); except ShowMessage('Error raised'); end; end.[/scar] =/ oh well, i was just curious, figured id ask the master him self! =P thanks for the response. ---------- Post added at 08:01 PM ---------- Previous post was at 08:00 PM ---------- He is trying to get the actual details of the Exception raised a la Delphi. Which it sadly does not appear to support. Not widely used but can be handy in certain circumstances. I think you are the only one on here that can decode my questions bixyby =p lol ---------- Post added 02-14-2012 at 02:30 AM ---------- Previous post was 02-13-2012 at 08:01 PM ---------- So just to clarify with scar, if i use a try and except statement, and it was to cause an out of bounds or some other kind of error, it would not terminate scar instead proceed to the except statement? Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted February 14, 2012 Share Posted February 14, 2012 The logic goes something like this: try // Code goes here except // If an error occurs this code gets executed // without crashing SCAR finally // regardless of what happens this // *always* get executed end; You don't have to use all the parts. try // code except // error handling code end; or try // code finally // code to always get executed end; Doesn't work with everything. Plugins (such as smart) seem to still crash scar. Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted February 14, 2012 Author Share Posted February 14, 2012 Ok thanks, i just wanted to clarify, i wish i would of known this a long time ago, this could fix the occasional bank issue i have with map.scar being out of bounds =p yay! lol Quote Link to comment Share on other sites More sharing options...