Results 1 to 19 of 19

Thread: Deposit Fix

  1. #1
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default Deposit Fix

    I saw a thread with someone saying the deposit was clicking "deposit-x" instead of "deposit-all" so I make a quick fix:

    SCAR Code:
    Procedure Deposit(SlotFrom, SlotTo: Integer; vType: Variant);

    Var
       DepositX: Boolean;
       All: Variant;
       I, T, x, y: Integer;

    Begin
      If Not BankScreen Then
        Exit;
      If vType = 2 Then
        srl_Warn('Deposit', '2 now means store per 2, not ''All''', 15);
      DepositX := False;
      Case VarType(vType) Of
        3: Begin
             DepositX := InIntArray([1, 5, 10], vType);
             If vType = 1 Then
               All := False
             Else
               All := True;
           End;
        11: All := vType;
      End;
      For I := SlotFrom To SlotTo Do
      Begin
        If Not ExistsItem(I) Then
          Continue;
        MouseItem(I, Not All);
        If DepositX Then
        Begin
          ChooseOption('Deposit-X');
          T := GetSystemTime;
          While (Not FindColor(x, y, 8388608, MCX1, MCY1, MCX2, MCY2)) And (GetSystemTime - T < 3000) Do
            Wait(100);
          TypeSend(vType);
        End Else If VarType(vType) = 3 Then
          ChooseOption('Deposit-' + vType)
        Else
          ChooseOption('Deposit-All');
        T := GetSystemTime;
        Wait(RandomRange(200, 300));
        While ExistsItem(I) And (GetSystemTime - T < 2000) Do
          Wait(50);
      End;
    End;

  2. #2
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    its doing the same with withdraw. What did you change?

  3. #3
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    SCAR Code:
    DepositX := Not InIntArray([1, 5, 10], vType);

    to

    SCAR Code:
    DepositX := InIntArray([1, 5, 10], vType);

    I'll look into the withdraw function, I only knew about the deposit one.

  4. #4
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SRL should also check 'Withdraw/Deposit - Last number entered' so for example every time a script withdraws or deposits it will look more human like or make it faster. I used that once in my clay softener, few seconds do count


  5. #5
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    That is genius!

    So wouldn't it go something like this:

    SCAR Code:
    Procedure CazaxCleverness(number: Integer);
    B: Boolean;
    Begin
      If not(B) then
      Begin
        Mouse({Item coords here});
        ChooseOption('X');
        TypeSend(IntToStr(number);
        B := True;
      end else
      Begin
        Mouse({Item coords here});
        ChooseOption(IntToStr(number));
      end;
    end;

    I know thats a bad version, but you get the general gist.

    I have it has not(B) because booleans are default false, am I right?

    EDIT: With the withdraw function, are you sure you're typing 0 for it to withdraw all?
    Last edited by Richard; 04-18-2009 at 07:54 AM.

  6. #6
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Lol but this is what I made(should be in SRL IMO):
    scar Code:
    Function IsOption(Text : String): Boolean;
    Var
      TPA : TPointArray;
      Box : TBox;
      X, Y : Integer;
    Begin
      FindColorsTolerance(TPA, 4674653, 0, 0, 764, 502, 0);
      Box := GetTPABounds(TPA);
      Result := FindText(X, Y, Text, UpChars, Box.X1, Box.Y1, Box.X2, Box.Y2);
    End;
    And then you call
    SCAR Code:
    If IsOption('26') Then
      ChooseOption('26')//Just an example
    Else
      ChooseOption('X');
      //TypeSend stuff...etc


  7. #7
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    You don't need that cos ChooseOption is a boolean already .

    So something more like this:

    SCAR Code:
    Procedure CazaxCleverness(number: integer);
    Begin
      If not(ChooseOption(IntToStr(number))) then
        Begin
          ChooseOption('X');
          Typesend(IntToStr(number));
        end;
    end;

    A lot simpler.

  8. #8
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ChooseOption moves the mouse away making it to close the popup menu. That's why I made IsOption


  9. #9
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    , didn't know that, might just have to break into that include as well.

    I was trying my hand at the SRLPlayerForm but, like Zeph said, its now made me hate forms

    EDIT: Here's a new way for the ChooseOptionMultiEx (which means you've have to set the 3rd param on everything to false if you wanted to use your method):

    SCAR Code:
    function ChooseOptionMultiEx(Texts: TStringArray; TextType: String; MoveMouseIfFalse: Boolean): Boolean;
    var
       B, T: TBox;
       TPA, TextTPA: TPointArray;
       aTPA: T2DPointArray;
       I, C, H, HH, ii, L: Integer;
       P: TPoint;
       Occurances: array [0..4] of TPointArray;
       Colors: TIntegerArray;
    begin
      Result := False;
      GetClientDimensions(B.X2, B.Y2);
      B.X1 := 0;
      B.Y1 := 0;
      FindColorsTolerance(TPA, 4674653, B.X1, B.Y1, B.X2, B.Y2, 0);
      If Length(TPA) < 10 Then
        Exit;
      B.X2 := 0;
      B.Y2 := 0;

      P := TPA[0];
      H := High(TPA);
      Dec(H);
      For I := 0 To H Do
        If TPA[i].X = TPA[I+1].X - 1 Then
        Begin
          If C > 5 Then
          Begin
            B.X1 := P.X;
            B.Y1 := P.Y;
            Break;
          End Else
            C := C + 1;
        End
        Else
        Begin
          P := TPA[I + 1];
          C := 0;
        End;
      If I = Length(TPA) Then
      Begin
        WriteLn('Choose Option Menu Getting Failed');
        Exit;
      End;
      InvertTPA(TPA);
      C := 0;
      P := TPA[0];
      H := High(TPA);
      Dec(H);
      For I := 0 To H Do
        If TPA[i].X = TPA[I+1].X + 1 Then
        Begin
          If C > 5 Then
          Begin
            B.X2 := P.X;
            B.Y2 := P.Y;
            Break;
          End Else
            C := C + 1;
        End Else
        Begin
          P := TPA[I + 1];
          C := 0;
        End;
      If I = Length(TPA) Then
      Begin
        WriteLn('Choose Option Menu Getting Failed');
        Exit;
      End;

      TPA := [];
      Colors := [16777215, 4231423, 2070783, 65535, 16776960];
      case LowerCase(TextType) of
        'action', 'player': FindColorsTolerance(Occurances[0], Colors[0], B.x1, B.y1, B.x2, B.y2, 3);
        'item'  : begin
                    FindColorsTolerance(Occurances[1], Colors[1], B.x1, B.y1, B.x2, B.y2, 3);
                    FindColorsTolerance(Occurances[2], Colors[2], B.x1, B.y1, B.x2, B.y2, 3);
                  end;
        'npc'   : FindColorsTolerance(Occurances[3], Colors[3], B.x1, B.y1, B.x2, B.y2, 3);
        'object': FindColorsTolerance(Occurances[4], Colors[4], B.x1, B.y1, B.x2, B.y2, 3);
        else
        begin
          FindColorsTolerance(Occurances[0], 4674653, B.X1, B.Y1, B.X2, B.Y2, 0);
          FindColorsTolerance(Occurances[1], clBlack, B.X1, B.Y1, B.X2, B.Y2, 0);
          TPA := MergeATPA(Occurances);
          TPA := ReturnPointsNotInTPA(TPA, B);
        end;
      end;
      if High(TPA) < 1 then TPA := MergeATPA(Occurances);
      aTPA := SplitTPAEx(TPA, 7, 1);
      SortATPAFromFirstPoint(aTPA, Point(B.x1, B.y1));

      H := High(Texts);
      L := High(aTPA);
     // for i := 0 to L do
     //   DebugTPA(atpa[i], inttostr(i));

      For I :=0 To H do
      begin
        TextTPA := LoadTextTPA(Texts[I], UpChars, HH);
        for ii := 0 to L do
          If FindTextTPAInTPA(HH, TextTPA, aTPA[ii], TPA) Then
          Begin
            T := GetTPABounds(TPA);
            Result := True;
            Mouse(B.X1 + 5, T.y1 - 2, B.X2 - B.X1 - 5, T.Y2 - T.Y1, True);
            Exit;
          End;
      end;
      If MouseMouseIfFalse then
        MMouse(B.X1 - 50, B.Y1 - 50, 40, B.Y2 - B.Y1);
      Wait(200 + Random(100));
    end;

    Nooby way of doing it
    Last edited by Richard; 04-18-2009 at 08:10 AM.

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

    Default

    Quote Originally Posted by Richard View Post
    SCAR Code:
    DepositX := Not InIntArray([1, 5, 10], vType);

    to

    SCAR Code:
    DepositX := InIntArray([1, 5, 10], vType);

    I'll look into the withdraw function, I only knew about the deposit one.
    I don't know what the bug is but that won't fix it.

    SCAR Code:
    DepositX := Not InIntArray([1, 5, 10], vType);

    makes sure that it will only click DepositX if there is a number which isn't 1, 5, or 10. 1, 5, and 10 have their own options rather than Deposit-X.

  11. #11
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    Quote Originally Posted by ZephyrsFury View Post
    I don't know what the bug is but that won't fix it.

    SCAR Code:
    DepositX := Not InIntArray([1, 5, 10], vType);

    makes sure that it will only click DepositX if there is a number which isn't 1, 5, or 10. 1, 5, and 10 have their own options rather than Deposit-X.
    Well I was just changing little bits and that seemed to fix it.

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

    Default

    As Zeph said your fix makes no sense, but it could be with my ChooseOption.

    Also, what scar are you all using?

    ZEPH POWA ABOOsEs!

    EDIT: Grammar...

    Edit: Jerk, this is my post, not yours.
    Last edited by Nava2; 04-19-2009 at 10:38 PM. Reason: NO LOVE TONIGHT, YOU BEND OVER AND TAKE IT.
    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

  13. #13
    Join Date
    Feb 2009
    Location
    Philipines
    Posts
    600
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I just noticed when I use depositall with Scar 3.15b it uses the deposit button, and when I use Scar 3.20 it right clicks on the item to deposit.

  14. #14
    Join Date
    Oct 2007
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Dark Arcana View Post
    I just noticed when I use depositall with Scar 3.15b it uses the deposit button, and when I use Scar 3.20 it right clicks on the item to deposit.
    Could be due to different revisions.

  15. #15
    Join Date
    Feb 2009
    Location
    Philipines
    Posts
    600
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Nope they were both rev32, but it might just be me.

  16. #16
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    No, ChooseOption seems to not be working. Just then, my script was trying to right click a tree and click cut, but it would mis it every time.

    Edit: Just tried again, and it worked. Weird.
    Edit2: Just restarted again, and it DIDNT work =\ I think its clicking like 1 pixel to low.
    Edit3: it moves the mouse, its in the right spot to click, then it moves the mouse 1 or 2 pixels away and clicks. There for, missing the option.
    Last edited by noidea; 04-19-2009 at 08:26 AM.
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

  17. #17
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

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

    Default

    I think it is in my new chooseoption.

    Try this:

    SCAR Code:
    {*******************************************************************************
    function ChooseOptionMultiEx(Texts: TStringArray; TextType: String): Boolean;
    By: Wizzup?, Nava2, and modified by N1ke!
    Description: Finds Popup menu, then clicks on it.
                 Will look for the first string first and so on.
                 It will search for the Text Type you input valid arguments are
                 'action', 'player': The white text
                 'npc': The yellow text
                 'object': The cyan text
                 'all': Searches for all colors of text.
                 Will default to 'all'.
    *******************************************************************************}

    function ChooseOptionMultiEx(Texts: TStringArray; TextType: String): Boolean;
    var
       B, T: TBox;
       TPA, TextTPA: TPointArray;
       aTPA: T2DPointArray;
       I, C, H, HH, ii, L: Integer;
       P: TPoint;
       Occurances: array [0..4] of TPointArray;
       Colors: TIntegerArray;
    begin
      Result := False;
      GetClientDimensions(B.X2, B.Y2);
      B.X1 := 0;
      B.Y1 := 0;
      FindColorsTolerance(TPA, 4674653, B.X1, B.Y1, B.X2, B.Y2, 0);
      If Length(TPA) < 10 Then
        Exit;
      B.X2 := 0;
      B.Y2 := 0;

      P := TPA[0];
      H := High(TPA);
      Dec(H);
      For I := 0 To H Do
        If TPA[i].X = TPA[I+1].X - 1 Then
        Begin
          If C > 5 Then
          Begin
            B.X1 := P.X;
            B.Y1 := P.Y;
            Break;
          End Else
            C := C + 1;
        End
        Else
        Begin
          P := TPA[I + 1];
          C := 0;
        End;
      If I = Length(TPA) Then
      Begin
        WriteLn('Choose Option Menu Getting Failed');
        Exit;
      End;
      InvertTPA(TPA);
      C := 0;
      P := TPA[0];
      H := High(TPA);
      Dec(H);
      For I := 0 To H Do
        If TPA[i].X = TPA[I+1].X + 1 Then
        Begin
          If C > 5 Then
          Begin
            B.X2 := P.X;
            B.Y2 := P.Y;
            Break;
          End Else
            C := C + 1;
        End Else
        Begin
          P := TPA[I + 1];
          C := 0;
        End;
      If I = Length(TPA) Then
      Begin
        WriteLn('Choose Option Menu Getting Failed');
        Exit;
      End;

      TPA := [];
      Colors := [16777215, 4231423, 2070783, 65535, 16776960];
      case LowerCase(TextType) of
        'action', 'player': FindColorsTolerance(Occurances[0], Colors[0], B.x1, B.y1, B.x2, B.y2, 3);
        'item'  : begin
                    FindColorsTolerance(Occurances[1], Colors[1], B.x1, B.y1, B.x2, B.y2, 3);
                    FindColorsTolerance(Occurances[2], Colors[2], B.x1, B.y1, B.x2, B.y2, 3);
                  end;
        'npc'   : FindColorsTolerance(Occurances[3], Colors[3], B.x1, B.y1, B.x2, B.y2, 3);
        'object': FindColorsTolerance(Occurances[4], Colors[4], B.x1, B.y1, B.x2, B.y2, 3);
        else
        begin
          FindColorsTolerance(Occurances[0], 4674653, B.X1, B.Y1, B.X2, B.Y2, 0);
          FindColorsTolerance(Occurances[1], clBlack, B.X1, B.Y1, B.X2, B.Y2, 0);
          TPA := MergeATPA(Occurances);
          TPA := ReturnPointsNotInTPA(TPA, B);
        end;
      end;
      if High(TPA) < 1 then TPA := MergeATPA(Occurances);
      aTPA := SplitTPAEx(TPA, 7, 1);
      SortATPAFromFirstPoint(aTPA, Point(B.x1, B.y1));

      H := High(Texts);
      L := High(aTPA);
     // for i := 0 to L do
     //   DebugTPA(atpa[i], inttostr(i));

      For I :=0 To H do
      begin
        TextTPA := LoadTextTPA(Texts[I], UpChars, HH);
        for ii := 0 to L do
          If FindTextTPAInTPA(HH, TextTPA, aTPA[ii], TPA) Then
          Begin
            T := GetTPABounds(TPA);
            Result := True;
            Mouse(B.X1 + 5, T.y1 - 2, B.X2 - B.X1 - 5, T.Y2 - T.Y1 - 3, True);
            Exit;
          End;
      end;

      MMouse(B.X1 - 50, B.Y1 - 50, 40, B.Y2 - B.Y1);
      Wait(200 + Random(100));
    end;

    I just made it so it doesn't click as low. As that seems to be the problem. Let me know please.
    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

  19. #19
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

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
  •