Page 1 of 2 12 LastLast
Results 1 to 25 of 39

Thread: Cap'n Arnav's Chest random solver

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

    Default Cap'n Arnav's Chest random solver

    Ok i made it today, i know that mods should fix some bugs on it and add some filesafes.

    Special thanks to boss01 who lend me his acc.

    SCAR Code:
    program New;


    {.include srl/srl.scar}


    procedure Confirm;
    begin
      Wait(RandomRange(700, 1200));
      MouseBox(384, 237, 503, 278, 1);
    end;


    function FindChest: boolean;
    var
      x, y, i, j: integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;
    begin
      FindColorsSpiralTolerance(x, y, TPA, 4348001, MSX1, MSY1, MSX2, MSY2, 20);
      ATPA := SplitTPA(TPA, 15);
      for i := 0 to High(ATPA) do
      begin
        for j := 0 to 3 do
        begin
          if MiddleTPAEX(ATPA[i], x, y) then
              MMouse(x, y, 3, 3);
          if IsUpText('hest') then
          begin
            GetMousePos(x, y);
            ClickMouse(x, y, False);
            Wait(RandomRange(1000, 1500));
            if ChooseOption('pen') then Result := True;
            if Result then Exit;
          end;
        end;
      end;
    end;


    function FindPortal: boolean;
    var
      x, y, i, j: integer;
      TPA: TPointArray;
      ATPA: T2DPointArray;
    begin
      FindColorsSpiralTolerance(x, y, TPA, 6663573, MSX1, MSY1, MSX2, MSY2, 20);
      ATPA := SplitTPA(TPA, 15);
      for i := 0 to High(ATPA) do
      begin
        for j := 0 to 3 do
        begin
          if MiddleTPAEX(ATPA[i], x, y) then
              MMouse(x, y, 3, 3);
          if IsUpText('ortal') then
          begin
            GetMousePos(x, y);
            ClickMouse(x, y, False);
            Wait(RandomRange(1000, 1500));
            if ChooseOption('ortal') then Result := True;
            if Result then Exit;
          end;
        end;
      end;
    end;


    procedure ClickArrow(Times, Col: integer; How: Boolean); //How: True = up, False = down
    var
      x1, x2, y1, y2, i: integer;
    begin
      case Col of
        1: if How then
           begin
             x1 := 106; y1 := 11; x2 := 147; y2 := 39;
           end else
           begin
             x1 := 106; y1 := 302; x2 := 147; y2 := 320;
           end;
        2: if How then
           begin
             x1 := 193; y1 := 11; x2 := 236; y2 := 39;
           end else
           begin
             x1 := 193; y1 := 302; x2 := 236; y2 := 320;
           end;
        3: if How then
           begin
             x1 := 283; y1 := 11; x2 := 327; y2 := 39;
           end else
           begin
             x1 := 283; y1 := 302; x2 := 327; y2 := 320;
           end;
      end;
     
      for i := 0 to Times - 1 do
      begin
        Wait(RandomRange(100, 200));
        MouseBox(x1, y1, x2, y2, 1);
      end;
    end;

    function MachineBox(i :Integer): TBox;
    {
       _____ _____ _____
      |  1  |  4  |  7  |
      |_____|_____|_____|
      |  2  |  5  |  8  |
      |_____|_____|_____|
      |  3  |  6  |  9  |
      |_____|_____|_____|
    }

    var
      x1, x2, y1, y2: integer;
    begin
      case i of
     
        1: begin x1 := 90; x2 := 175; y1 := 45; y2 := 125; end;
        2: begin x1 := 90; x2 := 175; y1 := 125; y2 := 210; end;
        3: begin x1 := 90; x2 := 175; y1 := 210; y2 := 290; end;
       
        4: begin x1 := 175; x2 := 260; y1 := 45; y2 := 125; end;
        5: begin x1 := 175; x2 := 260; y1 := 125; y2 := 210; end;
        6: begin x1 := 175; x2 := 260; y1 := 210; y2 := 290; end;
       
        7: begin x1 := 260; x2 := 345; y1 := 45; y2 := 125; end;
        8: begin x1 := 260; x2 := 345; y1 := 125; y2 := 210; end;
        9: begin x1 := 260; x2 := 345; y1 := 210; y2 := 290; end;
       
      end;
     
      Result.x1 := x1;
      Result.x2 := x2;
      Result.y1 := y1;
      Result.y2 := y2;
    end;







    procedure Chest_Analyze(Col: integer);
    {
     ______
    |      |
    |      | coins
    |______|
    |      |
    |      | bowl
    |______|
    |      |
    |      | bar
    |______|

             ring


       This function is serching for bar, combination is always the same.
    }

    var
      Time, i, j, x, y, Slot: integer;
      B: TBox;
      BBreak: boolean;
    begin

      case Col of
        1: i := 1;
        2: i := 4;
        3: i := 7;
      end;
     
      MarkTime(Time);
      repeat
        for j := i to i + 2 do
        begin
          B := MachineBox(j);
          if FindColoredAreaTolerance(x, y, 1074825, B.x1, B.y1, B.x2, B.y2, 100, 10) then
          begin
            Slot := j;
            BBreak := True;
    //        WriteLn(inttostr(j));
          end;
        end;
      until (TimeFromMark(Time) > 5000) or BBreak;

      if InRange(i, 4, 6) then Slot := Slot - 3;
      if InRange(i, 7, 9) then Slot := Slot - 6;
     
     
      case slot of
        1: ClickArrow(1, Col, True);
        2: case Random(1) of
             0: ClickArrow(2, Col, True);
             1: ClickArrow(2, Col, False);
           end;
        3: ClickArrow(1, Col, False);
      end;
     
    end;


    procedure SolveChestRandom;
    var
      i, x, y: integer;
    begin
      SetAngle(False);
    //  FindChest;
      FindObj(x, y, 'hest', 7510440, 10);
      Mouse(x, y, 0, 0, True);
      Wait(RandomRAnge(1200, 1700));
      SetAngle(True);
      ClickToContinue;
      Wait(RandomRAnge(700, 1200));
      FindNPCChatText('try', ClickLeft);
      Wait(RandomRAnge(700, 1200));
      ClickToContinue;
      for i := 1 to 3 do
      begin
        Wait(RandomRAnge(700, 1200));
        Chest_Analyze(i);
      end;
      Confirm;
      for i := 0 to 2 do ClickToContinue;
      FindPortal;
    end;



    begin
      setupsrl;
      activateclient;
      SolveChestRandom;

    end.
    :P

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

    Default

    Has it occured to you that the combination may differ per account, and per time you enter the random? (Seems obvious to me, but I am not 100% sure.)



    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)

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

    Default

    as far as i know combination is the same
    :P

  4. #4
    Join Date
    Jan 2009
    Location
    Somewhere
    Posts
    240
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thats really nice. Try to solve the Bee-keeper. I posted some pictures in the stickied thread and also there a vid on yt

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

    Default

    i need acc stucked in beekeeper random to start makeing solver.
    :P

  6. #6
    Join Date
    Jan 2009
    Location
    Somewhere
    Posts
    240
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ill try to get one.

  7. #7
    Join Date
    Mar 2008
    Location
    New Jersey
    Posts
    1,673
    Mentioned
    1 Post(s)
    Quoted
    9 Post(s)

    Default

    oh my god Iroki, you're a random solving machine. You've solved so many randoms lately. Rep+ for yet another solver. Goodjob, if I get any randoms I'll send account to you for you to solve it.

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

    Default

    You could shorten and clean up your code.

    Use some maths in the machine box function, as well, you use unnecessary nests. If only one line of code comes after an if statement, you don't need a begin end nest. Same for after an else!

    Good job though, quick off the bat.

    E: Look at wizzup's post, good initiative, bad logic?
    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

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

    Default

    Quote Originally Posted by Nava2 View Post
    You could shorten and clean up your code.

    Use some maths in the machine box function, as well, you use unnecessary nests. If only one line of code comes after an if statement, you don't need a begin end nest. Same for after an else!

    Good job though, quick off the bat.
    Thanks Nava2, i dont have enought time to "clean" my code. The most important thing is that it works , devs must "clean" it.
    :P

  10. #10
    Join Date
    Oct 2008
    Location
    behind you!
    Posts
    1,688
    Mentioned
    2 Post(s)
    Quoted
    40 Post(s)

    Default

    wow that was fast !

    tbh, iroki deserves to be a SRL member.
    Hi

  11. #11
    Join Date
    Feb 2007
    Location
    South East England
    Posts
    2,906
    Mentioned
    2 Post(s)
    Quoted
    8 Post(s)

    Default

    Quote Originally Posted by Tickyy View Post
    wow that was fast !

    tbh, iroki deserves to be a SRL member.
    This has been discussed by Admins, and he was a member on that account. He is lucky he is still at SRL for breaking the rules when he was on Iroki. The highest rank he can ever achieve is Jr Member. Same as Sandstorm.


    Fantastic scripter or not, rules are rules.


    Nice work, Iroki, however.
    Jus' Lurkin'

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

    Default

    Quote Originally Posted by Tickyy View Post
    wow that was fast !

    tbh, iroki deserves to be a SRL member.
    I accepted that i cant be member
    :P

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

    Default

    Quote Originally Posted by Iroki AKA manfromczech View Post
    Thanks Nava2, i dont have enought time to "clean" my code. The most important thing is that it works , devs must "clean" it.
    Err... Isn't that your job?
    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
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Torrent of Flame View Post
    This has been discussed by Admins, and he was a member on that account. He is lucky he is still at SRL for breaking the rules when he was on Iroki. The highest rank he can ever achieve is Jr Member. Same as Sandstorm.


    Fantastic scripter or not, rules are rules.


    Nice work, Iroki, however.
    [offtopic] What happened to Sandstorm? [/offtopic]

  15. #15
    Join Date
    Oct 2008
    Location
    behind you!
    Posts
    1,688
    Mentioned
    2 Post(s)
    Quoted
    40 Post(s)

    Default

    Quote Originally Posted by Da 0wner View Post
    [offtopic] What happened to Sandstorm? [/offtopic]
    [offtopic]

    Quote Originally Posted by WT-Fakawi
    I am sorry Sandstorm, but you will have to accept the fact you will be capped at Junior Members. Rules are rules, you where permanently banned so technically speaking you shouldnt be here in the first place.

    Now, I am not saying you are not a nice guy nor that you haven't learned from your mistakes, but Junior is all you will ever be.
    Btw, Congrats on your cup that you always wanted, Da Owner .

    [offtopic]
    Hi

  16. #16
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Tickyy View Post
    [offtopic]



    Btw, Congrats on your cup that you always wanted, Da Owner .

    [offtopic]
    Give me the link to that post...and my name has a zero (0).

    Edit: Is sandstorm hey321? On sythe his name is hey321 and his sig on it said ~Sandstorm.

  17. #17
    Join Date
    Sep 2006
    Location
    include srl/srl.scar ( aussie)
    Posts
    2,875
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Da 0wner View Post
    Give me the link to that post...and my name has a zero (0).

    Edit: Is sandstorm hey321? On sythe his name is hey321 and his sig on it said ~Sandstorm.
    Yes he is

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

    Default

    http://www.youtube.com/watch?v=HaAaU9hxNgs - the same combination as in my solver.
    :P

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

    Default

    You always try to get the coins in the middle?

    SCAR Code:
    2: case Random(1) of
             0: ClickArrow(2, Col, True);
             1: ClickArrow(2, Col, False);
           end;

    You know that random(1) never returns 1?
    Hup Holland Hup!

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

    Default

    Quote Originally Posted by nielsie95 View Post
    You always try to get the coins in the middle?

    SCAR Code:
    2: case Random(1) of
             0: ClickArrow(2, Col, True);
             1: ClickArrow(2, Col, False);
           end;

    You know that random(1) never returns 1?
    Thanks, my fault

    btw http://www.youtube.com/watch?v=j3sAeuMkhKw <- the same combination.
    I need to make new function which checks for object which must be in the centre.
    :P

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

    Default

    In the video you posted you see that the bar needs to be in the centre, so it varies each time.

    The order of the items seems to be the same every time though. My solver doesn't use that, but it's actually quite a good idea
    Hup Holland Hup!

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

    Default

    you made this random solver ??
    :P

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

    Default

    Yes, but that's no reason for you not to work on it The best one will be put in SRL.
    Hup Holland Hup!

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

    Default

    can i see yours?? I'm just wonder how you solve it:P
    :P

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

    Default

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

    function arnav_InRandom: Boolean;
    begin
      Result := (GetMusic = 'Sea Shanty');
    end;

    function arnav_LockScreen: Boolean;
    begin
      Result := SimilarColors(GetColor(497, 19), 6854059, 3);
    end;

    procedure arnav_ClickArrow(Col: Integer; Up: Boolean);
    var
      t: TPoint;
    begin
      t.x := 123 + (Col * 90);
      if Up then
        t.y := 20
      else
        t.y := 305;
      Mouse(t.x, t.y, 8, 8, True);
      Wait(1500 + Random(500));
    end;

    function arnav_GetTarget: string;
    var
      tpa: TPointArray;
    begin
      Result := 'unknown';
      if (not arnav_LockScreen) then
        Exit;
       
      FindColorsTolerance(tpa, 0, 7, 150, 80, 185, 1);
      WriteLn(Length(tpa));
     
      case Length(tpa) of
        84: Result := 'bar';
        108: Result := 'bowl';
        102: Result := 'coins';
      end;
    end;

    function arnav_GetCurrent(Col: Integer): string;
    var
      i, t: Integer;
      tpa: TPointArray;
      b: TBox;
      Info: array of Variant;
    begin
      ColorToleranceSpeed(2);
      Result := 'unknown';
      t := GetSystemTime;
      b := IntToBox(91 + (88 * Col), 125, 166 + (88 * Col), 198);

      while (Result = 'unknown') and ((GetSystemTime - t) < 20000) and
            arnav_LockScreen do
      begin
        for i := 0 to 4 do
        begin
          case i of
            0: Info := ['bar'  , 0.02, 0.15, 1008002, 20, 500];
            1: Info := ['coins', 0.03, 0.15, 876911, 13, 700];
            2: Info := ['coins', 0.02, 0.7, 1358036, 8, 600];
            3: Info := ['bowl' , 0.03, 0.35, 1732993, 30, 850];
            4: Info := ['ring' , 0.05, 0.3 , 1421243, 12, 200];
          end;
          SetColorSpeed2Modifiers(Info[1], Info[2]);
          FindColorsTolerance(tpa, Info[3], b.x1, b.y1, b.x2, b.y2, Info[4]);
          //WriteLn(IntToStr(i)+':'+IntToStr(Length(tpa)));
          if (Length(tpa) > Info[5]) then
          begin
            Result := Info[0];
            //DebugTPA(tpa);
            Break;
          end;
        end;
        Wait(60);
      end;
      WriteLn(Result);
    end;

    function SolveArnav: Boolean;
    var
      deg, cts, col, t, x, y: Integer;
      Target, c: string;
      Up: Boolean;
      aci: TAutoColorInfo;
    begin
      Result := False;
      if (not arnav_InRandom) then
      begin
        WriteLn('Not in Arnav!');
        Exit;
      end;

      with aci do
      begin
        UpText := 'Talk';
        MaxDist := 15;
        Color := 2047847;
        HueMod := 0.43;
        SatMod := 3.23;
        LumTol := 8;
        MinR := 85; MaxR := 129;
        MinG := 28; MaxG := 94;
        MinB := 9; MaxB := 63;
        MinX := 4.31; MaxX := 11.23;
        MinY := 2.86; MaxY := 11.51;
        MinZ := 0.59; MaxZ := 6.20;
      end;

      cts := GetColorToleranceSpeed;
      deg := Round(rs_GetCompassAngleDegrees);
      MakeCompass('n');
      t := GetSystemTime;

      SetAngle(True);
      while ((GetSystemTime - t) < 40000) and (not arnav_LockScreen) do
      begin
        Wait(1500);
        if AreTalking then
        begin
          if (not ClickContinue(True,True)) then
            FindNPCChatText('ready to try', ClickLeft);
        end
        else if FindObjRecordEx(x, y, aci, MSX1, MSY1, MSX2, MSY2, False, False) then
        begin
          Mouse(x, y, 0, 0, False);
          Wait(100 + Random(200));
          ChooseOption('Talk');
          Wait(500);
          FFlag(0);
          x := GetSystemTime;
          while (not AreTalking) and ((GetSystemTime - x) < 5000) do Wait(100);
        end;
      end;
     
      Target := arnav_GetTarget;
      if (Target = 'unknown') then
      begin
        WriteLn('Could not get Arnav target!');
        SetColorSpeed2Modifiers(0.2, 0.2);
        ColorToleranceSpeed(cts);
        Exit;
      end;
      WriteLn('Arnav target: '+Target);
     
      for col := 0 to 2 do
      begin
        t := GetSystemTime;
        Up := RBool;
        while ((GetSystemTime - t) < 60000) and arnav_LockScreen do
        begin
          c := arnav_GetCurrent(col);
          if (c = Target) then
            Break;
          arnav_ClickArrow(col, Up);
        end;
        if (c <> Target) then
          Break;
      end;
      if (col < 3) then
      begin
        WriteLn('Could not identify arnav objects!');
        SetColorSpeed2Modifiers(0.2, 0.2);
        ColorToleranceSpeed(cts);
        Exit;
      end;
     
      MMouse(405, 245, 70, 20);
      Exit;
      Mouse(405, 245, 70, 20, True);
      x := GetSystemTime;
      while arnav_LockScreen and ((GetSystemTime - x) < 5000) do Wait(100);

      if arnav_LockScreen then
        CloseWindow;
       
      with aci do
      begin
        UpText := 'portal';
        MaxDist := 15;
        Color := 8633254;
        HueMod := 0.19;
        SatMod := 0.72;
        LumTol := 11;
        MinR := 147; MaxR := 187;
        MinG := 165; MaxG := 212;
        MinB := 97; MaxB := 162;
        MinX := 28.03; MaxX := 50.00;
        MinY := 34.43; MaxY := 59.62;
        MinZ := 16.70; MaxZ := 42.60;
        MinCount := 100;
      end;

      t := GetSystemTime;
      while arnav_InRandom and ((GetSystemTime - t) < 20000) do
      begin
        Wait(100);
        if AreTalking then
          ClickContinue(True,True)
        else if FindObjRecordEx(x, y, aci, MSX1, MSY1, MSX2, MSY2, False, False) then
        begin
          Mouse(x, y, 0, 0, False);
          Wait(100 + Random(200));
          ChooseOption('Enter');
          Wait(500);
          FFlag(0);
          Wait(4000);
        end;
      end;

      Result := (not arnav_InRandom);
      MakeCompass(IntToStr(Deg));
      SetColorSpeed2Modifiers(0.2, 0.2);
      ColorToleranceSpeed(cts);
    end;

    begin
      SetupSRl;
      ClearDebug;
      WriteLn(BoolToStr(SolveArnav));
    end.
    Hup Holland Hup!

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Bee Keeper Random Solver!
    By Drakan in forum Research & Development Lounge
    Replies: 14
    Last Post: 03-03-2009, 12:14 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
  •