Results 1 to 7 of 7

Thread: ChooseOption1

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

    Default ChooseOption1

    Well, I read someone posting about how they couldn't figure out how to bank by using ChooseOption because 'ank' is in all the names. So, as an alternative I editted the current procedure and added Line Picking! Now, the function will work as it used to, but also will work with a line number should you choose to use it.

    Without further adieu:

    SCAR Code:
    {*******************************************************************************
    function ChooseOption1(Option: variant): Boolean;
    By: Wizzup? and Nava2
    Description: Finds Popup menu, then clicks on it. Allows looking for text or
                 choosing an option line, first line is 1.
    *******************************************************************************}


    function ChooseOption1(Option: variant): Boolean;
    var
       B: TBox;
       P: TPointArray;
       X, Y, Z: Integer;

    begin
      GetClientDimensions(B.X2, B.Y2);
      B.X1 := 0;
      B.Y1 := 0;
      FindColorsTolerance(P, 4674653, B.X1, B.Y1, B.X2, B.Y2, 0);
      If Length(P) = 0 Then
        Exit;
      B := GetTPABounds(P);
      case VarType(Option) of
        3: begin
             B := IntToBox(B.X1, B.Y1 + 19, B.X2, B.Y2)
             Z :=  (B.Y2 - B.Y1) mod 15;
             if InRange(Option, 0, Z) then
             begin
               Result := true;
               Mouse(B.X1 + 5, B.Y1 + ((Option-1)*15) + 6, Random(B.X2 - B.X1), 6, True);
             end else
               SRL_Warn('ChooseOption1', 'Line chosen does not exist.', 1);
           end;
           
        256: If FindText(X, Y, option, upchars, B.X1, B.Y1, B.X2, B.Y2) Then
             Begin
               Result := True;
               Mouse(B.X1 + 5, y + 1, Random(B.X2 - B.X1), random(13), True);
             End
        else
          SRL_Warn('ChooseOption1', 'Invalid Variant Type Use only integers or strings!', 1);
      end;

      if not Result then
      begin
        MMouse(B.X1 - 50, B.Y1 - 50, 40, B.Y2 - B.Y1);
        Wait(200 + Random(100));
      end;
    end;

    Please post comments.

    Nava2
    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

  2. #2
    Join Date
    Apr 2008
    Posts
    28
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    this "someone" was me, and it was at IRC...
    I used FindTextTpaEx to do it as a alternative.
    Ty vm, i will test this function and if works, i will replace the TpaEx=)

  3. #3
    Join Date
    Oct 2006
    Location
    Ontario,Canada
    Posts
    1,718
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    just wondering what if you lagg and get a different popup. it will still click the line but it wont be the right thing so it would screw up. why dont you add a text check thing in there so it checks if its the right text it is looking for?

  4. #4
    Join Date
    Apr 2007
    Location
    Australia
    Posts
    4,163
    Mentioned
    9 Post(s)
    Quoted
    19 Post(s)

    Default

    ChooseOption('Bank quickly') ?

  5. #5
    Join Date
    Apr 2008
    Posts
    28
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by The Claw View Post
    ChooseOption('Bank quickly') ?
    Isso Nom Ecxiste!!! (Padre Quevedo)

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

    Default

    Well, you could choose 'ank' on a particular line, but you could aswell choose "ank anker" on any line!


    Experimental, a bit...

    |
    V

    SCAR Code:
    Function ChooseOptionMultiCustom(Texts: TStringArray): Boolean;

    Var
       TPA: TPointArray;
       B: TBox;
       I, C, X, Y: Integer;
    Begin
      GetClientDimensions(B.X2, B.Y2);
      B.X1 := 0;
      B.Y1 := 0;
      FindColorsTolerance(TPA, 4674653, B.X1, B.Y1, B.X2, B.Y2, 0);
      If GetArrayLength(TPA) < 1 Then
      Begin
        srl_Warn('ChooseOptionMultiCustom', 'Option window not open!', warn_Warning);
        Exit;
      End;
      B := GetTPABounds(TPA);
      FindColorsTolerance(TPA, 4674653, B.x1, B.y1 + 18, B.x2, B.y2, 0);
      B := GetTPABounds(TPA);
      For I := 0 To (B.y2 - B.y1) Div 13 Do
      Begin
        B.y1 := B.y1 + I * 13;
        B.y2 := B.y2 + 13;
        For C := 0 To High(Texts) Do
          If Not FindText(X, Y, Texts[c], UpChars, B.x1, B.y1, B.x2, B.y2) Then
            Break
          Else
            If C = High(Texts) Then Result := True;
        If Result Then
          Break;
      End;
      If Result Then
        Mouse(X + 2, Y + 2, 2, 2, True);
    End;

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

    Default

    *Bends over to n3ss3s*

    Nava2
    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

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
  •