Jump to content
Ranqers

Need help, may be a little advanced?

Recommended Posts

Ok.

 

I need help coming up with a solution to find a bank booth.

Using findColor, or findColorTol will not work, there's a repeation of that color in the area.

 

If it makes it any easier, I'm using Draynor bank.

This is RS2 so i'll have to hardcode it.

 

Suggestions, ideas, thoughts, discussion?

 

Thanks:) -Happy Holidays.

Link to comment
Share on other sites

Some inspiration for you

 

https://github.com/OSI1/OSI1/blob/master/RS2/Core/Bank.scar

 

[sCAR]{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

function OpenBankBooth(Loc: Integer): Boolean;

Contributors: Wanted, Freddy

Description: Opens a booth, true if bankscreen found. Use Loc_VEB etc.

Date Created: December 14th, 2011. By Wanted. RS2 Build 688.

Last Modified: November 26th, 2012. By Bixby Sayz. RS2 Build 743.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

 

function OpenBankBooth(Loc: Integer): Boolean;

var

BankInfo: TVariantArray;

CTS, I, H, T: Integer;

ATPA: T2DPointArray;

TPA: TPointArray;

P: TPoint;

begin

Result := BankScreen;

if (Result) then

Exit; // 0 1 2 3 4 5 6 7 8 9

case (Loc) of // | CTS | CTS2 Mods | Color | Tol | Split | W | H | Min | Max | Modified By Build #

Loc_LBC: BankInfo := [2, 0.23, 0.35, 9147035, 10, 0, 35, 35, 100, 750]; // December 14, 2011 Wanted 688

Loc_AKB: BankInfo := [2, 0.15, 0.09, 3883077, 14, 0, 35, 35, 100, 900]; // December 14, 2011 Wanted 688

Loc_FEB,{BankInfo := [2, 0.06, 0.21, 5272464, 4, 1, 4, 15, 250, 800];} // December 14, 2011 Wanted 688

Loc_FWB: BankInfo := [2, 0.06, 0.21, 5272464, 4, 1, 4, 15, 250, 800]; // December 14, 2011 Wanted 688

Loc_VEB: BankInfo := [2, 0.07, 1.59, 2181720, 5, 0, 35, 45, 350, 99999]; // December 14, 2011 Wanted 688

Loc_VWB: BankInfo := [2, 0.09, 0.45, 3235696, 3, 0, 35, 35, 150, 600]; // December 14, 2011 Wanted 688

Loc_DYB,{BankInfo := [2, 0.37, 0.48, 4083025, 2, 0, 35, 35, 500, 99999];}// December 14, 2011 Wanted 688

Loc_EVB: BankInfo := [2, 0.37, 0.48, 4083025, 2, 0, 35, 35, 500, 99999]; // December 14, 2011 Wanted 688

else

Exit;

end;

CTS := GetColorToleranceSpeed;

ColorToleranceSpeed(BankInfo[0]);

SetColorSpeed2Modifiers(BankInfo[1], BankInfo[2]);

FindColorSpiralTolEx(MSCX, MSCY, TPA, BankInfo[3], MSX1, MSY1, MSX2, MSY2, BankInfo[4]);

SetColorspeed2Modifiers(0.2, 0.2);

ColorToleranceSpeed(CTS);

if (Length(TPA) < 1) then

Exit;

case (BankInfo[5]) of

0: ATPA := GroupTPAEx(TPA, BankInfo[6], BankInfo[7]);

1: ATPA := SplitTPA(TPA, BankInfo[6]);

2: ATPA := SplitTPAEx(TPA, BankInfo[6], BankInfo[7]);

end;

if (Length(ATPA) < 1) then

Exit;

{$IFDEF SCAR338_UP}

SortATPAByMeanEx(ATPA, Point(MSCX, MSCY));

{$ELSE}

SortATPAByMiddleEx(ATPA, Point(MSCX, MSCY));

{$ENDIF}

//DebugATPABounds(ATPA);

H := High(ATPA);

//for I := 0 to High(ATPA) do

//OSI_WriteAndLog(IntToStr(I) + ', ' + IntToStr(Length(ATPA)));

for I := 0 to High(ATPA) do

if (InRange(Length(ATPA), BankInfo[8], BankInfo[9])) then

begin

{$IFDEF SCAR338_UP}

P := TPAMean(ATPA);

{$ELSE}

P := TPAMiddle(ATPA);

{$ENDIF}

MMouse(P.X, P.Y, 2, 2);

if ((Loc = Loc_DYB) or (Loc = Loc_EVB)) then

begin

if (not (IsUpTextMulti(['Bank C', 'k Coun', 'ounter']))) then

Continue;

end

else

if (not (IsUpTextMulti(['ank B', 'k Ban', 'Bank b', 'k boot', 'booth']))) then

Continue;

GetMousePos(P.X, P.Y);

Mouse(P.X, P.Y, 0, 0, True);

if (WaitFunc(@FlagExists, True, 100, 200, 500, 1000)) then

Flag;

WaitRR(200, 400);

T := GetSystemTime + RR(5000, 7000);

repeat

if (PinScreen) then

if (not (EnterBankPin(Players[CurrentPlayer].Pin, False))) then

begin

OSI_WriteAndLog('Pin failed!');

Exit;

end

else

begin

Result := True;

Exit;

end;

if (BankScreen) then

begin

Result := True;

Exit;

end;

WaitRR(250, 400);

until (GetSystemTime > T);

Exit;

end;

end;

 

{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

function OpenBankNPC(Loc: Integer): Boolean;

Contributors: Wanted, Freddy

Description: Opens a bank via Banker, true if bankscreen found. Use Loc_VEB etc.

Date Created: December 22nd, 2011. By Wanted. RS2 Build 690.

Last Modified: November 26th, 2012. By Bixby Sayz. RS2 Build 743.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

 

function OpenBankNPC(Loc: Integer): Boolean;

var

BankerInfo: TVariantArray;

I, H, T, CTS: Integer;

ATPA: T2DPointArray;

TPA: TPointArray;

TBA: TBoxArray;

P: TPoint;

begin

Result := BankScreen;

if (Result) then

Exit; // 0 1 2 3 4

case (Loc) of // | CTS | CTS2 Mods | Color | Tol Modified By Build #

Loc_LBC,{BankerInfo := [2, 0.48, 0.06, 6776940, 7];} // December 22, 2011 Wanted 690

Loc_FEB,{BankerInfo := [2, 0.48, 0.06, 6776940, 7];} // December 22, 2011 Wanted 690

Loc_FWB,{BankerInfo := [2, 0.48, 0.06, 6776940, 7];} // December 22, 2011 Wanted 690

Loc_AKB: BankerInfo := [2, 0.48, 0.06, 6776940, 7]; // December 22, 2011 Wanted 690

Loc_EVB,{BankerInfo := [2, 0.14, 0.76, 4533556, 11];}// December 22, 2011 Wanted 690

Loc_VEB,{BankerInfo := [2, 0.14, 0.76, 4533556, 11];}// December 22, 2011 Wanted 690

Loc_VWB: BankerInfo := [2, 0.14, 0.76, 4533556, 11]; // December 22, 2011 Wanted 690

Loc_DYB: BankerInfo := [2, 0.21, 0.07, 7633020, 20]; // December 22, 2011 Wanted 690

Loc_GEB: BankerInfo := [2, 0.42, 0.14, 6053473, 6]; // December 22, 2011 Wanted 690

else

Exit;

end;

ATPA := FindMMDotsExOverLap([cldYellowDot]);

TPA := MMsToMSs(ATPA[0]);

SortTPAEx(TPA, Point(MSCX, MSCY));

H := High(TPA);

SetLength(TBA, H + 1);

for I := 0 to H do

TBA := Box(TPA.X - 30, TPA.Y - 30, TPA.X + 30, TPA.Y + 30);

ConstrainBoxes(TBA, MSX1, MSY1, MSX2, MSY2);

for I := 0 to H do

begin

CTS := GetColorToleranceSpeed;

ColorToleranceSpeed(BankerInfo[0]);

SetColorSpeed2Modifiers(BankerInfo[1], BankerInfo[2]);

FindColorTolEx(TPA, BankerInfo[3], TBA.X1, TBA.Y1, TBA.X2, TBA.Y2, BankerInfo[4]);

SetColorspeed2Modifiers(0.2, 0.2);

ColorToleranceSpeed(CTS);

ATPA := SplitTPA(TPA, 5);

if (Length(ATPA) < 1) then

Continue;

SortATPASize(ATPA, True);

{$IFDEF SCAR338_UP}

P := TPAMean(ATPA[0]);

{$ELSE}

P := TPAMiddle(ATPA[0]);

{$ENDIF}

MMouse(P.X, P.Y, 0, 0);

if (not (IsUpTextMulti(['to B', 'anker']))) then

Continue;

GetMousePos(P.X, P.Y);

Mouse(P.X, P.Y, 0, 0, False);

if (not (ChooseOptionMulti(['Bank B', 'k B']))) then

Continue;

if (WaitFunc(@FlagExists, True, 100, 200, 500, 1000)) then

Flag;

WaitRR(200, 400);

T := GetSystemTime + RR(5000, 7000);

repeat

if (PinScreen) then

if (not (EnterBankPin(Players[CurrentPlayer].Pin, False))) then

begin

OSI_WriteAndLog('Pin failed!');

Exit;

end

else

begin

Result := True;

Exit;

end;

if (BankScreen) then

begin

Result := True;

Exit;

end;

WaitRR(250, 400);

until (GetSystemTime > T);

Continue;

end;

end;

 

{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

function OpenBankEx(Loc: Integer; AllowNPC, AllowBooth, TryBoothFirst: Boolean): Boolean;

Contributors: Wanted

Description: Opens bank using custom settings, true if bankscreen found. Use Loc_VEB etc.

Date Created: December 22nd, 2011. By Wanted. RS2 Build 690.

Last Modified: December 22nd, 2011. By Wanted. RS2 Build 690.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

 

function OpenBankEx(Loc: Integer; AllowNPC, AllowBooth, TryBoothFirst: Boolean): Boolean;

begin

Result := False;

if (not (AllowBooth)) then

TryBoothFirst := False;

if (TryBoothFirst) then

begin

if (not (OpenBankBooth(Loc))) then

if (AllowNPC) then

begin

if (not (OpenBankNPC(Loc))) then

Exit;

end

else

Exit;

Result := True;

Exit;

end

else

begin

if (not (OpenBankNPC(Loc))) then

if (AllowBooth) then

begin

if (not (OpenBankBooth(Loc))) then

Exit;

end

else

Exit;

Result := True;

Exit;

end;

end;

 

{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

function OpenBank(Loc: Integer): Boolean;

Contributors: Wanted

Description: Opens bank using recommended settings, true if bankscreen found. Use Loc_VEB etc.

Date Created: December 22nd, 2011. By Wanted. RS2 Build 690.

Last Modified: December 22nd, 2011. By Wanted. RS2 Build 690.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

 

function OpenBank(Loc: Integer): Boolean;

begin

case (Loc) of

Loc_DYB, Loc_EVB, Loc_AKB: Result := OpenBankEx(Loc, True, True, False);

else

Result := OpenBankEx(Loc, True, True, True);

end;

end;[/sCAR]

 

Maybe someone else can elaborate a bit more, but honestly asking the right questions gets you the right answers most of the time and helps you understand what you are trying to find out ultimately. How do you know the right questions to ask? Look into as much information as you can beforehand i.e. research EX 'DIG' CODE

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...