SRL Archive - SRL Archives

4 new additions for Bank.scar


Nadeem

2009-07-30 04:57:03

Hi all :)


{*******************************************************************************
Function BankScrollTo(Index: Integer): Integer;
By: Nadeem
Last Edit: 29 Jul 2009
Description: Scrolls bank down until the Index slow appears
*******************************************************************************}
function BankScrollTo(Index: Integer): Integer;
var x, y, C, R, SL, MR: Integer;
BPoint: TPoint;
begin
if not BankScreen then
begin
srl_Warn('MMBankItem', 'Bank not open.', warn_AllVersions);
Exit;
end;
FixBank;
BPoint := BankIndexToBankPoint(Index);
C := BPoint.x;
R := BPoint.y;
while (C > 9) do begin
C := C - 9;
R := R + 1;
end;
if (R > 3) then
begin
while SimilarColors(4939368, GetColor(489, 103 + SL), 3) do Inc(SL);
MouseBox(483, 103, 493, 103 + (SL - Round(SL div 4)), 3);
GetMousePos(x, y);
HoldMouse(x, y, True);
while (R > 3) do begin
MMouse(x, y + MR, 0, 0);
Wait(13 + Random(13));
IncEx(MR, 19 + Random(3));
R := R - 1;
end;
MMouse(x, y + MR, 0, 0);
Wait(13 + Random(13));
GetMousePos(x, y);
ReleaseMouse(x, y, True);
end;
Result := Index;
while Result > 40 do DecEx(Result, 40);
end;


{*******************************************************************************
Function BankItemExists(Index: Integer): Boolean;
by: Nadeem
Last Edit: 29 Jul 2009
Description: Checks to see if an item on Index in Bank exists
*******************************************************************************}
function BankItemExists(Index: Integer; Scroll: Boolean): Boolean;
var BBox: TBox;
begin
if not BankScreen then
begin
srl_Warn('MMBankItem', 'Bank not open.', warn_AllVersions);
Exit;
end;
if Scroll then Index := BankScrollTo(Index);
BBox := BankIndexToMSBox(Index);
Result := FindColor(BBox.x1, BBox.y1, 65536, BBox.x1, BBox.y1, BBox.x2, BBox.y2);
end;


{*******************************************************************************
Procedure MMBankItem(Index: Integer);
by: Nadeem
Last Edit: 29 Jul 2009
Description: Moves mouse to a specfic index in the bank. No limit on index.
*******************************************************************************}
procedure MMBankItem(Index: Integer);
var BBox: TBox;
begin
if not BankScreen then
begin
srl_Warn('MMBankItem', 'Bank not open.', warn_AllVersions);
Exit;
end;
if (CurrentBankTab <> 1) then BankTab(1);
FixBank;
BBox := BankIndexToMSBox(BankScrollTo(Index));
MouseBox(BBox.x1 + 3, BBox.y1 + 33, BBox.x2 - 9, BBox.y2 + 1, 3);
end;


{*******************************************************************************
Function CreateBankTab(Index: Integer): Integer;
by: Nadeem
Last Edit: 29 Jul 2009
Description: Creates a new tab with the item on Index
*******************************************************************************}
function CreateBankTab(Index: Integer): Integer;
var x, y: Integer;
NBox: TBox;
begin
if not BankScreen then
begin
srl_Warn('MMBankItem', 'Bank not open.', warn_AllVersions);
Exit;
end;
FixBank;
if not CurrentBankTab = 1 then BankTab(1);
Result := 1;
while ExistsBankTab(Result) do Result := Result + 1;
MMBankItem(Index);
GetMousePos(x, y);
HoldMouse(x, y, True);
Wait(RandomRange(150, 250));
NBox := IntToBox(27 + (Result - 1) * 48, 51, 70 + (Result - 1) * 48, 81); // Formula from ExistsBankTab()
MouseBox(NBox.x1 + 5, NBox.y1 + 15, NBox.x2 - 5, NBox.y2 - 3, 3);
GetMousePos(x, y);
Wait(RandomRange(150, 250));
ReleaseMouse(x, y, True);
Wait(RandomRange(150, 250));
while CurrentBankTab = Result do Wait(100);
end;

Please give feedback, Thanks! :)



~NS

Wanted

2009-07-30 08:54:58

Looks good, but is it just me or are the Bank Indexes in SRL all messed up?

Nadeem

2009-07-30 15:17:46

From: IceFire908
Looks good, but is it just me or are the Bank Indexes in SRL all messed up?


No it works good, unless you mean that it gives an index number higher than 40 which does not exist on the screen..?

Well I kind worked around that aswell, i'm making it scroll down to the right index number (i.e 83) and then subtract the other index we passed to get the current index for that same item on the screen now :)

So really, I think the indexes are functioning quite well :)



~NS

yangchao

2011-02-24 22:03:28

Well I kind worked around that aswell, i'm making it scroll down to the right index numbe

**snipped links**