Results 1 to 23 of 23

Thread: Sandwich Lady Random Solver!

  1. #1
    Join Date
    May 2008
    Location
    Here :p
    Posts
    194
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Sandwich Lady Random Solver!

    kk this took me the last 4 hours hope you like it.

    ive tested this on my acount and on pictures plus difrent combos and it worked perfect every time. realy realy needs testing though any bugs post it here and ill fix asap thanks to lysolman00 and Main_FTW for the pictures very very big help until i finaly got an acount in there. tell me what you think this is my first time solving a full random by color but i think i was pritty good.

    EDIT: Added a few things mainly sujested by nava2

    SCAR Code:
    program New;
    {.include SRL/SRL.scar}

    {*******************************************************************************
    Function InSandwichLady:Boolean;
    by: BazzBarrett
    Description: returns true if in the sandwich lady random.
    *******************************************************************************}


    function InSandwichLady: Boolean;
    begin
      Result := False;
      if InBlack then
        Result := GetMusic = 'Snack Attack';
    end;

    {*******************************************************************************
    Function FindColorsForSandWitchLady(var x, y: Integer; Color, x1, y1, x2, y2, Tol: Integer):Boolean;
    by: BazzBarrett
    Description: Special color finding function specificly for Sandwich Lady.
    *******************************************************************************}


    Function FindColorsForSandWitchLady(var x, y: Integer; Color, x1, y1, x2, y2, Tol: Integer):Boolean;
    var
      CTS: Integer;
      CTPA: TPointArray;
      ATPA: T2DPointArray;
    begin
      try
        Result := False;
        CTS := GetColorToleranceSpeed;
        ColorToleranceSpeed(2);
        if FindColorsTolerance(CTPA, color, x1, y1, x2, y2, Tol) then
        begin
          ATPA := TPAToATPAEx(CTPA, 70, 100);
          SortATPASize(ATPA, True);
          MiddleTPAEx(ATPA[0], X, Y);
          Result := True;
        end;
      finally
        ColorToleranceSpeed(CTS);
      end;
    end;

    {*******************************************************************************
    Procedure SandWichCorrectCoords(var p : TPoint);
    by: BazzBarrett
    Description: Fixes the location of the mouse when selecting the correct
      food.
    *******************************************************************************}


    Procedure SandWichCorrectCoords(var p : TPoint);
    begin
      if distance(p.x, p.y, 116, 208) < 36 then p := Point(116, 208);
      if distance(p.x, p.y, 180, 144) < 36 then p := Point(180, 144);
      if distance(p.x, p.y, 214, 229) < 36 then p := Point(214, 229);
      if distance(p.x, p.y, 293, 150) < 36 then p := Point(293, 150);
      if distance(p.x, p.y, 335, 230) < 36 then p := Point(335, 230);
      if distance(p.x, p.y, 429, 157) < 36 then p := Point(429, 157);
      if distance(p.x, p.y, 427, 232) < 36 then p := Point(427, 232);
    end;

    {
    Roll
    Meat pie
    doughnut
    Chocolate bar
    Baguette
    Square sandwich
    Triangle sandwich
    }


    {*******************************************************************************
    Function SandwichFindFood(Food:String):Boolean;
    by: BazzBarrett
    Description: Finds food specifyed by food in the Sandwich lady random.
    *******************************************************************************}


    Function SandwichFindFood(Food:String):Boolean;
    var
      fx, fy, Fi, sbx, sby: Integer;
      SB1, SB2: TBox;
      FType: String;
    begin
      if (pos('roll', Food) > 0) then FType := 'roll';
      if (pos('eat', Food) > 0) then FType := 'pie';
      if (pos('ughn', Food) > 0) then FType := 'doughnut';
      if (pos('olat', Food) > 0) then FType := 'chocolate';
      if (pos('uett', Food) > 0) then FType := 'baguette';
      if (pos('uar', Food) > 0) then FType := 's sandwich';
      if (pos('ang', Food) > 0) then FType := 't sandwich';
      For Fi := 0 to 20 do
      begin
        case LowerCase(FType) of
          'roll':   //FindColorSkipBoxTolerance
          begin
            if FindColorsForSandWitchLady(fx, fy, 1209743, 78, 133, 462, 248, 5) then
            begin
              MMouse(fx, fy, 5, 5);
              Result := True;
              exit;
            end;
          end;
       
          'pie':
          begin
            if FindColorsForSandWitchLady(fx, fy, 7105652, 78, 133, 462, 248, 10) then
            begin
              MMouse(fx, fy, 5, 5);
              Result := True;
              exit;
            end;
          end;
       
          'doughnut':
          begin
            if FindColorsForSandWitchLady(fx, fy, 5877182, 78, 133, 462, 248, 5) then
            begin
              MMouse(fx, fy, 5, 5);
              Result := True;
              exit;
            end;
          end;
       
          'chocolate':
          begin
            if FindColorsForSandWitchLady(fx, fy, 1715272, 78, 133, 462, 248, 10) then
            begin
              MMouse(fx, fy, 5, 5);
              Result := True;
              exit;
            end;
          end;
       
          'baguette':
          begin
            if SandwichFindFood('square') then
            begin
              GetMousePos(sbx, sby);
              Sb1.x1 := Sbx-50;
              Sb1.y1 := Sby - 50;
              Sb1.x2 := Sbx + 50;
              Sb1.y2 := Sby + 50;
              if SandwichFindFood('Triange') then
              begin
                GetMousePos(sbx, sby);
                Sb2.x1 := Sbx-50;
                Sb2.y1 := Sby - 50;
                Sb2.x2 := Sbx + 50;
                Sb2.y2 := Sby + 50;
                if FindColorSkipBoxArrayTolerance(fx, fy, 6989242, 78, 133, 462, 248, 5, [SB1, Sb2]) then
                begin
                  MMouse(fx, fy, 5, 5);
                  Result := True;
                  exit;
                end;
              end;
            end;
          end;
       
          's sandwich':
          begin
            if FindColorsForSandWitchLady(fx, fy, 5868444, 78, 133, 462, 248, 5) then
            begin
              MMouse(fx, fy, 5, 5);
              Result := True;
              exit;
            end;
          end;
         
          't sandwich':
          begin
            if SandwichFindFood('square') then
            begin
              GetMousePos(sbx, sby);
              Sb1.x1 := Sbx-50;
              Sb1.y1 := Sby - 50;
              Sb1.x2 := Sbx + 50;
              Sb1.y2 := Sby + 50;
              if FindColorSkipBoxTolerance(fx, fy, 1215567, 78, 133, 462, 248, 5, Sb1) then
              begin
                MMouse(fx, fy, 5, 5);
                Result := True;
                exit;
              end;
            end;
          end;

        end;
        Wait(150);
      end;
    end;

    {*******************************************************************************
    Function FindTheLady:Boolean;
    by: BazzBarrett
    Description: Finds the Sandwich lady.
    *******************************************************************************}


    Function FindTheLady:Boolean;
    var
      CTS, II, lx, ly, Trys, I, LMin : Integer;
      FoundHer: Boolean;
      TPA : TPointArray;
      ATPA: T2DPointArray;
    begin
      if GetColor(104, 27) = 0 then
      begin
        Result := True;
        Exit;
      end;
      While Not(Foundher) or (Trys > 5) do
      begin
        MakeCompass('N');
        SetAngle(True);
        CTS := GetColorToleranceSpeed;
        ColorToleranceSpeed(2);
        FindColorsSpiralTolerance(MSCX, MSCY, TPA, 10660562, MSX1, MSY1, MSX2, MSY2, 5);
        ColorToleranceSpeed(CTS);
        ATPA := TPAToATPAEx(TPA, 15, 15);
        LMin := min(High(ATPA), 5);
        For II := 0 to LMin do// I think this is the same as what you mean Nava2 - changed it again
        begin
          MiddleTPAEx(ATPA[II], lX, lY)
          MMouse(lX, lY, 2, 2);
          Wait(80+Random(40));
          If(IsUpTextmultiCustom(['alk', 'alk-To', 'wich']))then
          begin
            Result := True;
            Mouse(lx, ly, 0, 0, True);
            FoundHer := True;
            Break;
          end;
        end;
        inc(Trys);
        if Not(FoundHer) then
        begin
          wait(1000+random(500));
          Mouse(656, 85, 4, 4, true);
          wait(300);
          FFlag(0);
        end;
      end;
      if FoundHer then
      begin
        For I := 0 to 5 do
        begin
          Mouse(lx, ly, 0, 0, True);
          wait(750+random(500));
          ClickToContinue;
          For II := 0 to 10 do
          begin
            Wait(750+random(300));
            Result := (GetColor(55, 20) = 20);
            if Result = True Then Break;
          end;
          if Result = true then exit;
        end;
      end;
      Result := False;
      Writeln('Failed To Find Sandwich Lady... logging out');
      LogOut;
    end;

    {*******************************************************************************
    Procedure LeaveSandwichLady;
    by: BazzBarrett
    Description: leaves the sandwich lady random through the portal.
    *******************************************************************************}


    Procedure LeaveSandwichLady;
    var
      CTS, II, lx, ly, Trys, I, LMin : Integer;
      Foundit: Boolean;
      TPA : TPointArray;
      ATPA: Array of TPointArray;
    begin
      While Not(Foundit) or (Trys > 5) do
      begin
        MakeCompass('N');
        SetAngle(True);
        CTS := GetColorToleranceSpeed;
        ColorToleranceSpeed(2);
        FindColorsSpiralTolerance(MSCX, MSCY, TPA, 6461561, MSX1, MSY1, MSX2, MSY2, 5);
        ColorToleranceSpeed(CTS);
        ATPA := TPAToATPAEx(TPA, 15, 15);
        LMin := min(High(ATPA), 4);
        For II := 0 to LMin do
        begin
          MiddleTPAEx(ATPA[II], lX, lY)
          MMouse(lX, lY, 2, 2);
          Wait(60+Random(30));
          If(IsUpTextmultiCustom(['xit', 'nter', 'portal']))then
          begin
            Mouse(lx, ly, 0, 0, True);
            Foundit := True;
            Break;
          end;
        end;
        inc(Trys);
        if Not(Foundit) then
        begin
          wait(150+random(500));
          Mouse(656, 85, 4, 4, true);
          wait(300);
          FFlag(0);
        end;
      end;
      if Foundit Then
      begin
        Writeln('Sandwich lady random solved!');
      end else
      begin
        Writeln('So close but failed to leave logging out');
        logout;
      end;
    end;

    {*******************************************************************************
    Function SolveSandwichLady:Boolean;
    by: BazzBarrett
    Description: solves the sandwich lady random.
    *******************************************************************************}


    Function SolveSandwichLady:Boolean;
    var
      Food: String;
      FI: Integer;
      L: TPoint;
    begin
      if FindTheLady then
      begin
        Food := GetTextAtEx(150, 282, 20, SmallChars, False, False, 0, 3, 2070783, 35, false, tr_AllChars);
        Food := Between('a ', ' for', Food);
        Writeln('Found Sandwich Lady, choosing a ' + Food);
        wait(1000+random(1000));
        if SandwichFindFood(Food) then
        begin
          GetMousePos(L.x, L.y);
          SandWichCorrectCoords(L);
          Mouse(L.x, L.y, 3, 3, true);
          writeln('Clicked ' + food);
          wait(RandomRange(500, 1000));
          ClickToContinue;
          wait(RandomRange(500, 1000));
          LeaveSandwichLady;
          Result := True;
        end else
        begin
          Writeln('Failed to Find the correct');
          logout;
        end;
      end;
    end;

    begin
      SetUpSRL;
      ActivateClient;
      if FindSandwichLady then SolveSandwichLady;
    end.

  2. #2
    Join Date
    Sep 2007
    Location
    British Columbia, Canada
    Posts
    4,047
    Mentioned
    1 Post(s)
    Quoted
    2 Post(s)

    Default

    No problem
    Oh Hai Dar

  3. #3
    Join Date
    Apr 2007
    Location
    Behind you...I see your reading my Location. Don't turn around...
    Posts
    119
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Looks very nice! I will test it out and see how it does.
    Your welcome for the help

  4. #4
    Join Date
    Jul 2008
    Location
    Canada
    Posts
    1,612
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Indeed, it is very nice. This should be added to Srl.

  5. #5
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Remove the name credit. Annoying.

    Either that or let Wizzup put his name in every time you use a Wizzy plugin feature.

    Good job, never the less.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  6. #6
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    Quote Originally Posted by Nava2 View Post
    Remove the name credit. Annoying.

    Either that or let Wizzup put his name in every time you use a Wizzy plugin feature.

    Good job, never the less.
    When it goes into SRL you one normally has credits in the description, though... At least he doesn't print them.
    EDIT: Oh, he does. Hehe.

    Good job! Can't wait to test.



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

  7. #7
    Join Date
    Jul 2008
    Location
    Poland
    Posts
    375
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Nice work
    :P

  8. #8
    Join Date
    Apr 2007
    Location
    Perth, Australia
    Posts
    3,926
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Haven't seen the new randoms but apart from the teleporting part doesn't the solver in SRL by nielsie work?

  9. #9
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    Quote Originally Posted by ZephyrsFury View Post
    Haven't seen the new randoms but apart from the teleporting part doesn't the solver in SRL by nielsie work?
    I think it does, the only problem is that kebab is replaced by doughnut and ofcourse the location.
    Hup Holland Hup!

  10. #10
    Join Date
    May 2008
    Location
    Here :p
    Posts
    194
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Wizzup? View Post
    When it goes into SRL you one normally has credits in the description, though... At least he doesn't print them.
    EDIT: Oh, he does. Hehe.

    Good job! Can't wait to test.
    yer thats one thing that confusses me.. when i sugest a funciton for use in the SRL how should i credit/describe it is there any thread on this matter? would be of grate use (and thanks for the functions wizzup?

  11. #11
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    SCAR Code:
    For II := 0 to High(ATPA)-1 do
          noc[II] := High(ATPA[II]);
        For II := 0 to High(ATPA)-1 do
        begin
          if noc[ii] > pv then
          begin
            Pv := noc[ii];
            P := II;
          end;
        end;

    SortATPASize, son.

  12. #12
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    Quote Originally Posted by BazzBarrett View Post
    yer thats one thing that confusses me.. when i sugest a funciton for use in the SRL how should i credit/describe it is there any thread on this matter? would be of grate use (and thanks for the functions wizzup?
    Just look in any SRL file, you'll see how it is documented. (Don't look in any solvers I made, I didn't document them that well... )
    Just look in Gametab.scar, or something.



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

  13. #13
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Yeah, don't use the IMA SPAM I MADE DEM!

    Just put it in the comments, those who use them will thank you

    Edit: Fixed a few things, I THINK I sped it up, also, check the comments as well as my work, tell me if its wrong.

    SCAR Code:
    {*******************************************************************************
    function InSandwichLady:Boolean;
    by: BazzBarrett
    Description: returns true if in the sandwich lady random.
    *******************************************************************************}


    function InSandwichLady: Boolean;
    begin
      Result := False;
      if InBlack then
        Result := GetMusic = 'Snack Attack';
    end;

    {*******************************************************************************
    function FindColorsForSandWitchLady(var x, y: Integer; Color, x1, y1, x2, y2, Tol: Integer):Boolean;
    by: BazzBarrett
    Description: Special color finding function specificly for Sandwich Lady.
    *******************************************************************************}


    Function FindColorsForSandWitchLady(var x, y: Integer; Color, x1, y1, x2, y2, Tol: Integer):Boolean;
    var
      CTS: Integer;
      CTPA: TPointArray;
      ATPA: T2DPointArray;
      noc: TIntegerArray;
    begin
      try
        Result := False;
        CTS := GetColorToleranceSpeed;
        ColorToleranceSpeed(2);
        if FindColorsTolerance(CTPA, color, x1, y1, x2, y2, Tol) then
        begin
          ATPA := TPAToATPAEx(CTPA, 70, 100);
          SortATPASize(ATPA, True);
          MiddleTPAEx(ATPA[0], X, Y);
          Result := True;
        end;
      finally
        ColorToleranceSpeed(CTS);
      end;
    end;

    {*******************************************************************************
    Procedure SandWichCorrectCoords(var p : TPoint);
    by: BazzBarrett
    Description: Fixes the location of the mouse when selecting the correct
                 food.
    *******************************************************************************}


    Procedure SandWichCorrectCoords(var P: TPoint);
    begin
      if distance(p.x, p.y, 116, 208) < 36 then P := Point(116, 208);
      if distance(p.x, p.y, 180, 144) < 36 then P := Point(180, 144);
      if distance(p.x, p.y, 214, 229) < 36 then P := Point(214, 229);
      if distance(p.x, p.y, 293, 150) < 36 then P := Point(293, 150);
      if distance(p.x, p.y, 335, 230) < 36 then P := Point(335, 230);
      if distance(p.x, p.y, 429, 157) < 36 then P := Point(429, 157);
      if distance(p.x, p.y, 427, 232) < 36 then P := Point(427, 232);
    end;

    {
    Roll
    Meat pie
    doughnut
    Chocolate bar
    Baguette
    Square sandwich
    Triangle sandwich
    }


    {*******************************************************************************
    Function SandwichFindFood(Food: String):Boolean;
    by: BazzBarrett
    Description: Finds food specifyed by food in the Sandwich lady random.
    *******************************************************************************}


    Function SandwichFindFood(Food: String):Boolean;
    var
      fx, fy, Fi, sbx, sby: Integer;
      SB1, SB2: TBox;
      FType: String;
    begin
      if (pos('roll', Food) > 0) then FType := 'roll' else
      if (pos('eat', Food) > 0) then FType := 'pie' else
      if (pos('ughn', Food) > 0) then FType := 'doughnut' else
      if (pos('olat', Food) > 0) then FType := 'chocolate' else
      if (pos('uett', Food) > 0) then FType := 'baguette' else
      if (pos('uar', Food) > 0) then FType := 's sandwich' else
      if (pos('ang', Food) > 0) then FType := 't sandwich' else
      for Fi := 0 to 20 do
      begin
        case LowerCase(FType) of
          'roll':   //FindColorSkipBoxTolerance
          begin
            if FindColorsForSandWitchLady(fx, fy, 1209743, 78, 133, 462, 248, 5) then
            begin
              MMouse(fx, fy, 5, 5);
              Result := True;
              exit;
            end;
          end;

          'pie':
          begin
            if FindColorsForSandWitchLady(fx, fy, 7105652, 78, 133, 462, 248, 10) then
            begin
              MMouse(fx, fy, 5, 5);
              Result := True;
              exit;
            end;
          end;

          'doughnut':
          begin
            if FindColorsForSandWitchLady(fx, fy, 5877182, 78, 133, 462, 248, 5) then
            begin
              MMouse(fx, fy, 5, 5);
              Result := True;
              exit;
            end;
          end;

          'chocolate':
          begin
            if FindColorsForSandWitchLady(fx, fy, 1715272, 78, 133, 462, 248, 10) then
            begin
              MMouse(fx, fy, 5, 5);
              Result := True;
              exit;
            end;
          end;

          'baguette':
          begin
            if SandwichFindFood('square') then
            begin
              GetMousePos(sbx, sby);
              Sb1.x1 := Sbx-50;
              Sb1.y1 := Sby - 50;
              Sb1.x2 := Sbx + 50;
              Sb1.y2 := Sby + 50;
              if SandwichFindFood('Triange') then
              begin
                GetMousePos(sbx, sby);
                Sb2.x1 := Sbx-50;
                Sb2.y1 := Sby - 50;
                Sb2.x2 := Sbx + 50;
                Sb2.y2 := Sby + 50;
                if FindColorSkipBoxArrayTolerance(fx, fy, 6989242, 78, 133, 462, 248, 5, [SB1, Sb2]) then
                begin
                  MMouse(fx, fy, 5, 5);
                  Result := True;
                  exit;
                end;
              end;
            end;
          end;

          's sandwich':
          begin
            if FindColorsForSandWitchLady(fx, fy, 5868444, 78, 133, 462, 248, 5) then
            begin
              MMouse(fx, fy, 5, 5);
              Result := True;
              exit;
            end;
          end;

          't sandwich':
          begin
            if SandwichFindFood('square') then
            begin
              GetMousePos(sbx, sby);
              Sb1.x1 := Sbx-50;
              Sb1.y1 := Sby - 50;
              Sb1.x2 := Sbx + 50;
              Sb1.y2 := Sby + 50;
              if FindColorSkipBoxTolerance(fx, fy, 1215567, 78, 133, 462, 248, 5, Sb1) then
              begin
                MMouse(fx, fy, 5, 5);
                Result := True;
                exit;
              end;
            end;
          end;
        end;
        Wait(RandomRange(150, 170));
      end;
    end;

    {*******************************************************************************
    Function FindTheLady:Boolean;
    by: BazzBarrett
    Description: Finds the Sandwich lady.
    *******************************************************************************}


    Function FindTheLady:Boolean;
    var
      CTS, II, lx, ly, Trys, I : Integer;
      FoundHer: Boolean;
      TPA : TPointArray;
      ATPA: T2DPointArray;
    begin
      if GetColor(104, 27) = 0 then
      begin
        Result := True;
        Exit;
      end;
      While Not(Foundher) or (Trys > 5) do
      begin
        MakeCompass('N');
        SetAngle(True);
        CTS := GetColorToleranceSpeed;
        ColorToleranceSpeed(2);
        FindColorsSpiralTolerance(MSCX, MSCY, TPA, 10660562, MSX1, MSY1, MSX2, MSY2, 5);
        ColorToleranceSpeed(CTS);
        ATPA := TPAToATPAEx(TPA, 15, 15);
        For II := 0 to High(ATPA) do
        begin
          if Length(ATPA[II]) < ?? then Continue;  // Add a number here, idk what it would be.
          MiddleTPAEx(ATPA[II], lX, lY)
          MMouse(lX, lY, 2, 2);
          Wait(RandomRange(80, 120));
          If IsUpText('alk-To') then
          begin
            Result := True;
            Mouse(lx, ly, 0, 0, True);
            FoundHer := True;
            Break;
          end;
        end;
        inc(Trys);
        if Not(FoundHer) then
        begin
          wait(1000+random(500));
          Mouse(656, 85, 4, 4, true);
          wait(300);
          FFlag(0);
        end;
      end;
      if FoundHer then
      begin
        For I := 0 to 5 do
        begin
          Mouse(lx, ly, 0, 0, True);
          wait(1000+random(500));
          ClickToContinue;
          For II := 0 to 10 do
          begin
            Wait(1000+random(300));
            Result := GetColor(55, 20) = 20;
            if Result Then Exit;
          end;
        end;
      end;
      Result := False;
      Writeln('Failed To Find Sandwich Lady. Exiting.');
      LogOut;
    end;

    {*******************************************************************************
    Procedure LeaveSandwichLady;
    by: BazzBarrett
    Description: leaves the sandwich lady random through the portal.
    *******************************************************************************}


    Procedure LeaveSandwichLady;
    var
      CTS, II, lx, ly, Trys, I : Integer;
      Foundit: Boolean;
      TPA : TPointArray;
      ATPA: Array of TPointArray;
    begin
      While Not(Foundit) or (Trys > 5) do
      begin
        MakeCompass('N');
        SetAngle(True);
        CTS := GetColorToleranceSpeed;
        ColorToleranceSpeed(2);
        FindColorsSpiralTolerance(MSCX, MSCY, TPA, 6461561, MSX1, MSY1, MSX2, MSY2, 5);
        ColorToleranceSpeed(CTS);
        ATPA := TPAToATPAEx(TPA, 15, 15);
        For II := 0 to High(ATPA) do
        begin
          if Length(ATPA[II]) < ?? then Continue; // Add numbers here?
          MiddleTPAEx(ATPA[II], lX, lY);
          MMouse(lX, lY, 2, 2);
          Wait(RandomRange(80, 120));
          if IsUpText('portal') then
          begin
            Mouse(lx, ly, 0, 0, True);
            Foundit := True;
            Break;
          end;
        end;
        Inc(Trys);
        if Not(Foundit) then
        begin
          Wait(1000+random(500));
          Mouse(656, 85, 4, 4, true);
          Wait(300);
          FFlag(0);
        end;
      end;
      if Foundit Then
        Writeln('Sandwich Lady random solved!')
      else
      begin
        Writeln('Could not leave Sandwich Lady.');
        Logout;
      end;
    end;

    {*******************************************************************************
    Function SolveSandwichLady:Boolean;
    by: BazzBarrett
    Description: solves the sandwich lady random.
    *******************************************************************************}


    Function SolveSandwichLady:Boolean;
    var
      Food: String;
      FI: Integer;
      L: TPoint;
    begin
      if FindTheLady then
      begin
        Food := GetTextAtEx(150, 282, 20, SmallChars, False, False, 0, 3, 2070783, 35, false, tr_AllChars);
        Food := Between('a ', ' for', Food);
        Writeln('Found Sandwich Lady, choosing a ' + Food);
        wait(1000+random(1000));
        if SandwichFindFood(Food) then
        begin
          GetMousePos(L.x, L.y);
          SandWichCorrectCoords(L);
          Mouse(L.x, L.y, 3, 3, true);
          writeln('Clicked ' + food);
          wait(RandomRange(1000, 1500));  // might be too long?
          ClickToContinue;
          wait(RandomRange(1000, 1500));  // might be too long?
          LeaveSandwichLady;
          Result := True;
        end else
        begin
          Writeln('Failed to Find the correct');
          Logout;
        end;
      end;
    end;

    begin
      SetUpSRL;
      ActivateClient;
      if FindSandwichLady then SolveSandwichLady;
    end.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  14. #14
    Join Date
    May 2007
    Location
    Sydney, Australia (Faggot Region)
    Posts
    1,465
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default

    People are solving randoms


  15. #15
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    duh..

    and umm..

    I haven't tested the box thing but..

    it's different for each random/each person..

    does the solvers for it take that into account atm? and also..

    will the food be showing? or is it random order? could add a small fail safe..

    if it doesn't find the food, scrolls down, then checks again.. and if it can't find it for some
    reason, do a random one?

  16. #16
    Join Date
    May 2008
    Location
    Here :p
    Posts
    194
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by 99_ View Post
    duh..

    and umm..

    I haven't tested the box thing but..

    it's different for each random/each person..

    does the solvers for it take that into account atm? and also..

    will the food be showing? or is it random order? could add a small fail safe..

    if it doesn't find the food, scrolls down, then checks again.. and if it can't find it for some
    reason, do a random one?
    im confussed by what you mean exsaculy?
    in the random there is a place with 7 foods on it. there is always the same 7 foods just in a random order. I think that solves your question it does take all that into account.

  17. #17
    Join Date
    Dec 2007
    Posts
    2,766
    Mentioned
    2 Post(s)
    Quoted
    37 Post(s)

    Default

    Aren't booleans set to "false" automatically when SCAR starts ?

  18. #18
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yes they are and I know it's the same 7 sandwiches.. I said

    Quote Originally Posted by 99_ View Post
    duh..

    and umm..

    I haven't tested the box thing but..

    it's different for each random/each person..

    does the solvers for it take that into account atm? and also..

    will the food be showing? or is it random order? could add a small fail safe..

    if it doesn't find the food, scrolls down, then checks again.. and if it can't find it for some
    reason, do a random one?
    the box that gives you the exp/coins/items/etc..

  19. #19
    Join Date
    May 2008
    Location
    Here :p
    Posts
    194
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i forgot to add a failsafe for if it ghesses the wrong type of food. if any1 has an account in that random still or could send me some pictures of what happens if you get the random incorrect that would realy help so i can add that in

  20. #20
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Where you use Min(x, y) in your for loop, I would suggest declaring it first. As doing Min each cycle is slowww.

    Nice to see you used some of my suggestions
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  21. #21
    Join Date
    May 2008
    Location
    Here :p
    Posts
    194
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Nava2 View Post
    Where you use Min(x, y) in your for loop, I would suggest declaring it first. As doing Min each cycle is slowww.

    Nice to see you used some of my suggestions
    done. still need an acount or pictures (or just a description in general ) so i can make a failsafe for if you fail in clicking the correct food (a failsafe i hope no1 ever has to use)

  22. #22
    Join Date
    Mar 2008
    Location
    In a cave
    Posts
    345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    If you pick a wrong food you'll be teleported to a random location. So there's no use for a failsafe of that kind, at least IMO.
    A Chinese wiseman once said: "Shu ciu!", it was considered very smart, but now people know it means: "Something stinks here!"
    FalBuggySmelter v.1.31
    [Updated on the 1st of March 2010]
    RimmBugger BETA V1.8

  23. #23
    Join Date
    May 2008
    Location
    Here :p
    Posts
    194
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by bugger0001 View Post
    If you pick a wrong food you'll be teleported to a random location. So there's no use for a failsafe of that kind, at least IMO.
    oh thats not grate, does she say anything as your being telported out i could atleast try catch that task and logout the current player if that happens or return the value false?

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Anti-Random Sandwich lady
    By Powerz in forum OSR Help
    Replies: 4
    Last Post: 01-03-2008, 04:35 PM

Posting Permissions

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