Results 1 to 3 of 3

Thread: Need help with fail safe

  1. #1
    Join Date
    Mar 2013
    Posts
    26
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default Need help with fail safe

    I've been slowly grasping the pascal language so bare with me if this is terrible code lol, Thanks to @Sjoekeloe for showing me the basics.


    Now from a script Sjoe showed me how to make and explaining it, I've decided to make it 100% Accurate and be able to run it for hours before i try to code a script solely by my self. I've been trying to make a failsafe, yet its not responding to when it doesnt find the stall, here is the code, can you tell me what I have done wrong here?


    Code:
    program PickSilk;
    {$i SRL-OSR/SRL.simba}
    Function GreenRandom: Boolean;
    begin
      Result := (CountcolorTolerance(1207359, 552, 4, 697, 152, 13) > 10000);
    end;
    function LeftGreenRandom:Boolean;
    begin
      if (not CountcolorTolerance(1207359, 552, 4, 697, 152, 13) > 10000) then
      Result := True;
    end;
    
    function RandomSolver: Boolean;
    begin
       Gametab(tab_magic);
       Wait(500);
       MouseBox(658, 325, 674, 342, mouse_left);
       Wait(2000 + Random(500));
       MouseBox(230, 423, 288, 435, mouse_left);
      if  WaitFunc(@LeftGreenRandom, 100, 8000) then
      Writeln('Left the random');
    end;
    
    function StealFromStall: Boolean;
    var
      x, y: Integer;
    begin
     if FindObjCustom(x, y, ['Gem', 'stall'], [1908001, 2229602, 11579274], 7) then
     begin
      Writeln('Found Gems') // debug
      Mouse(x, y, 3, 3, true); // leftclicking :)
      Result := True;
      Wait(2500);
      Exit;
     end;
    end;
    Function FindGems: Boolean;
    var
     x, y : Integer;
    begin
      if (FindObjCustom(x, y, ['Gem', 'stall'], [1908001, 2229602, 11579274], 7)) then
    begin
      Writeln('We Found Gems!');
      if (not (FindObjCustom(x, y, ['Gem', 'stall'], [1908001, 2229602, 11579274], 7))) then
    begin
    Gametab(tab_magic);
       Wait(500);
       MouseBox(658, 325, 674, 342, mouse_left);
       Wait(2000 + Random(500));
       MouseBox(230, 423, 288, 435, mouse_left);
      if  WaitFunc(@FindGems, 100, 8000) then
      Writeln('Saved your self!');
    end;
    end;
    end;
    
    begin
     SetupSRL;
     ActivateClient;
    
     repeat
     if (GreenRandom = True) then RandomSolver;
     FindGems;
     StealFromStall
     until(false);
    end.

  2. #2
    Join Date
    May 2007
    Posts
    527
    Mentioned
    12 Post(s)
    Quoted
    109 Post(s)

    Default

    Your function

    Simba Code:
    function LeftGreenRandom:Boolean;
    begin
      if (not CountcolorTolerance(1207359, 552, 4, 697, 152, 13) > 10000) then
      Result := True;
    end;

    Always returns true. Maybe you should use this instead:

    Simba Code:
    function LeftGreenRandom:Boolean;
    begin
      result := (CountcolorTolerance(1207359, 552, 4, 697, 152, 13) < 10000);
    end;

    Also, you should do this:

    Simba Code:
    if GreenRandom() then RandomSolver();

  3. #3
    Join Date
    Mar 2013
    Posts
    26
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    The random solver works perfectly, its the fail safe that's not working like it should,

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
  •