Results 1 to 2 of 2

Thread: Failsafe global function?

  1. #1
    Join Date
    Jun 2012
    Location
    THE Students-City of Holland
    Posts
    332
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default Failsafe global function?

    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

  2. #2
    Join Date
    Oct 2008
    Posts
    196
    Mentioned
    1 Post(s)
    Quoted
    20 Post(s)

    Default

    Uh your code is confusing. Not sure if it's a snippet from your actual script or not. If you want my advice, use an integer as a failsafe. For example, everytime any of my scripts fail at something, an integer is increased. If it increases beyond a certain limit, my script automatically stops to prevent unhuman-like actions or repeated clicks. hope this helps

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •