function ChooseTabbedOptionMulti(OptionsA, OptionsB: TStringArray): Boolean;
Parameters
OptionsA: First set of options to look for in the Options Menu.
OptionsB: Second (and final) set of options to search for & choose.
Usage
This is used in the instance the right-click option you're trying to choose isn't visible, rather it's in one of the sub-menus (tab menu). For example, if you're trying to open a bank chest using the option 'Use' but it wasn't visible, you could use this instead: "ChooseTabbedOptionMulti(['Bank','Chest'], ['Use']);". Initially it will check if any of OptionsB are already visible and if so, click them. If not, the function will search for & move to any visible options of OptionsA and then choose the visible OptionsB (if found).
First, throw this procedure in mouse.simba, anywhere under the WindMouse procedure:
Simba Code:
{******************************************************************************* procedure AccurateMMouse(eX, eY, ranX, ranY: Integer); By: Flight Description: Same as MMouse but uses a much straighter path; required for choosing tabbed options. *******************************************************************************} Procedure AccurateMMouse(eX, eY, ranX, ranY: Integer); var randSpeed: extended; X,Y,MS: integer; begin MS := MouseSpeed; randSpeed :=(random(MouseSpeed)/2.0+ MouseSpeed)/10.0; GetMousePos(X, Y); WindMouse(X, Y, RandomRange(eX-ranX, eX+ranX), RandomRange(eY-ranY,eY+ranY),14,3,10.0/randSpeed,15.0/randSpeed,10.0*randSpeed,10.0*randSpeed); MouseSpeed := MS; end;
This is required choosing a tabbed option.
Now go into text.simba and under the "GetChooseOptions" function add this:
Simba Code:
{******************************************************************************* Function GetTabbedOptions(BigBox: TBox; TextType: string): Array of TOptions; By: Flight Description: Grabs all the options of the right-click tab menu, if visible. *******************************************************************************} Function GetTabbedOptions(BigBox: TBox; TextType:string):Arrayof TOptions; var B, BB, sB, TabBox: TBox; FilteredTPA, TPA, TPA1, TPA2: TPointArray; ATPA, tempatpa: T2DPointArray; I, L, target, bmp,w,h, cts: Integer; BoxColors: TIntegerArray; begin target := GetImageTarget; GetClientDimensions(B.X2, B.Y2); B := IntToBox(0,0, B.X2-1, B.Y2-1);
BoxColors :=[131843,3682593,3552822]; SetLength(ATPA, Length(BoxColors)); for i :=0to High(BoxColors)do FindColorsTolerance(ATPA[i], BoxColors[i], B.X1, B.Y1, B.X2, B.Y2,0);
TPA := MergeATPA(ATPA); //Remove the initial bigbox ClearTPAFromTPAWrap(TPA,TPAFromBox(BigBox),FilteredTPA); If Length(FilteredTPA) < 100Then begin ColorToleranceSpeed(cts); Exit; end;
ATPA := SplitTPA(FilteredTPA,4); For i :=0to High(ATPA)do begin B := GetTPABounds(ATPA[i]); if((B.x2-B.x1) > 90)and((B.y2-B.y1) > 18)then Break else B := IntToBox(0,0,0,0); end;
If(B.x2 =0)then begin ColorToleranceSpeed(cts); Exit; end;
And finally underneath the "OptionsExist" function add this bit:
Simba Code:
function ChooseTabbedOptionMulti(OptionsA, OptionsB: TStringArray): Boolean; var T: TPoint; B,BigBox,TabBox: TBox; i, H, ii, L, x: Integer; Options,TOptions:arrayof TOptions; begin Result := False; Options := GetChooseOptions('All'); if(Length(Options) < 1)then Exit; BigBox := Options[0].BigBox;
//Initially check TextsB if OptionsExist(OptionsB, False)then begin Result := ChooseOptionMulti(OptionsB); Exit; end;
//Mouse first set of text options H := High(Options); L := High(OptionsA); for i :=0To L do begin for ii :=0to H do If Pos(OptionsA[i], Options[ii].Str) > 0Then begin Result := True; B := Options[ii].Bounds; GetMousePos(T.x, T.y); if(not PointInBox(T, B))then MouseBoxEx(B.x1 +5, B.Y1, B.x2 -5, B.Y1 +5,5, mouse_move); end; end;
//Secondary options TOptions := GetTabbedOptions(BigBox,'All'); if(Length(TOptions) < 1)then Exit; L := High(OptionsB); H := High(TOptions); for i :=0To L do begin for ii :=0to H do If Pos(OptionsB[i], TOptions[ii].Str) > 0Then begin Result := True; TabBox := TOptions[0].BigBox; GetMousePos(T.x, T.y); AccurateMMouse(RandomRange(TabBox.X1, TabBox.X2), T.Y,0,3); Wait(200+ Random(100)); B := TOptions[ii].Bounds; GetMousePos(T.x, T.y); if PointInBox(T, B)then ClickMouse2(Mouse_left) else MouseBoxEx(B.x1 +5, B.Y1, B.x2 -5, B.Y1 +5,5,mouse_left); Exit; end; end; B := TOptions[0].BigBox; x := Max(B.X1 -52,0); if x =0then x := B.X2+10; MMouse(x, Max(B.Y1 -50,0),40, B.Y2-B.Y1); Wait(200+ Random(100)); end;
If you added everything in the correct locations it should compile right up. I'll also attach mouse.simba & text.simba for you lazy ones.
I can't seem to get this to work. I think it's because of the way ChooseOptionMultiEx works. It finds the background color from the mouse position, so the "sub-menu" location wouldn't be detected properly.
Simba Code:
(* ChooseOptionTabbed ~~~~~~~~~~~~~~~~~~
.. code-block:: pascal
function ChooseOptionTabbed(Txt1, Txt2: TStringArray): Boolean;
By passes the "sub-menus" that appear in option menus in a crowded area. 'Txt1' are the hover options, and Txt2 are the final options. If Txt2 alread exists without hovering, it will click it. This function should eventually replace ChooseOption.
.. note::
by Flight Last Updated: April 13th, 2012 by Coh3n
Example:
.. code-block:: pascal
Mouse(bank.x, bank.y, 5, 5, mouse_Right); Result := ChooseOptionTabbed(['Banker'], ['Bank']); *) function ChooseOptionTabbed(Txt1, Txt2: TStringArray): Boolean; begin Result := False;
if(OptionsExist(Txt2, False))then Result := WaitOptionMultiEx(Txt2,'All', ClickLeft,300) else if(ChooseOptionMultiEx(Txt1,'All', Move))then Result := WaitOptionMultiEx(Txt2,'All', ClickLeft,300); end;
I can't seem to get this to work. I think it's because of the way ChooseOptionMultiEx works. It finds the background color from the mouse position, so the "sub-menu" location wouldn't be detected properly.
So then the version you posted did work for you? It's been so long since I posted this.
Well Coh3n I finally have this working correctly, but it requires a couple other functions to work. I gotta say, it took me a bit of time this morning just to make this. :/
I have it working smooth in AeroLib; implanting this into SRL will require, like I said, extra functions. I guess it depends on if you want this in the include or not. Let me know what you think.
Well Coh3n I finally have this working correctly, but it requires a couple other functions to work. I gotta say, it took me a bit of time this morning just to make this. :/
I have it working smooth in AeroLib; implanting this into SRL will require, like I said, extra functions. I guess it depends on if you want this in the include or not. Let me know what you think.
~
Nice work. This looks very slick.. How long exactly did it take to do that?
(sorry for newbie questions)
what method of locating did you use, uptext?
I believe under two hours of hit-and-miss. I had to go through multiple attempts to find one that worked accurately.
It basically works the same way as our current method of grabbing right-click options (TOptions).
Oh okay brilliant!
Wow that's impressive, I still struggle with the basics.
Ok so would we implement this as an additional method of making us look more human or not?
I mean after watching the videos it looked so nifty
This is great for the large stacks of people! Is there a way to detect if the second option box is needed and just choose the normal chooseoption if it's not needed (ie can detect if no tabs present)?
This is great for the large stacks of people! Is there a way to detect if the second option box is needed and just choose the normal chooseoption if it's not needed (ie can detect if no tabs present)?
Yes, here's the parameters:
Simba Code:
function AL_ChooseTabbedOptionMulti(TextA, TextB: TStringArray): Boolean;
TextA is your (first) array of text that you search for incase TextB isn't visible in the initial Options Menu, and obvious TextB is what you will ultimately be choosing. If any of TextB is already visible in the Options Menu then it will be chosen first and return result True.
@-Benny:
I can make this for SRL if Coh3n (or others) would like me to. IMO we should have already had it as a basic core function as it's not just another add-on or antiban, this is really required in some instances.
It will obviously be included in AeroLib whenever I finish(...) it.
function AL_ChooseTabbedOptionMulti(TextA, TextB: TStringArray): Boolean;
TextA is your (first) array of text that you search for incase TextB isn't visible in the initial Options Menu, and obvious TextB is what you will ultimately be choosing. If any of TextB is already visible in the Options Menu then it will be chosen first and return result True.
@-Benny:
I can make this for SRL if Coh3n (or others) would like me to. IMO we should have already had it as a basic core function as it's not just another add-on or antiban, this is really required in some instances.
It will obviously be included in AeroLib whenever I finish(...) it.
That's awesome and I totally agree it should be in the include