Hello,
I'm making my own script, and i'm new to simba/pascal, but i'm doing very well 
I'm now stuck with a question. I need to know a good way to make a sort of global failsafe function
Here's what I was thinking about:
Simba Code:
procedure failsafe(Funct: procedure(x), Amount:integer);
begin
//x=standaard 0 of een in deze functie meegegeven waarde;
if(x > Amount) then
begin
StopOurScript('Failsafe failed to make '+ Funct +' work after retrying '+ Amount +' times... Try second failsafe method: reset client and logout and restart script after 30 minutes',1+Times);
end Else
Funct(x+1,<OTHER VARIABLES THAT WERE GIVEN>);
end;
//make it work like this:
Procedure Progogo(x: integer);
Begin
//lets say theres a 10% change it will fail
//~~~~~~~~~~DOES THINGS~~~~~~
if random(10) = 0 then
begin
failsafe(Progogo(x, <othervariableshere>) , 10);
end;
End;
begin
Progogo(1,<othervars>);
end.
{so.... I thought about this but couldn't think of a way to make this to work..
is it even possible in Pascal/Simba?
It would be really usefull because: you of course could make this function "failsafe"
in every function you have, but that is just a lot of lines of text which you have double in your whole script
and that's bad! you shouldn't have things double in your script, then you should make a new function for it , isn't it? 
so this has to be possible! ^^ What do you say? Or is there maybe a better/different way to handle failsafes more global
p.s. if I make a stupid thinking error It's because it's kinda late here and im tired
pps: sorry for my bad spelling and grammar, Im tired and i'm dutch