SRL Archive - SRL Archives

BankTab(NumberOfTab: Integer): Boolean;


NiCbaZ

2008-07-15 03:02:49

It changes to the tab you select, nothing advanced or anything just simple function to do the job :)


//-----------------------------------------------------------------//
//-- Scar Nicbaz Libary --//
//-- » BankTabs --//
//-----------------------------------------------------------------//

//Function IsBankTabOpen(WichTab:String) : Boolean // * by Nicbaz
//function BankTab(NumberOfTab: Integer): Boolean; //* by Nicbaz

{-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Function IsBankTabOpen(WichTab:String) : Boolean
By: Nicbaz
Description: Returns True if your tab is open
Status: Good
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-}


function IsBankTabOpen(WhichTab: Integer) : Boolean; // returns if your tab is opend or closed

begin
Result := (GetColor(62 + (WhichTab - 1) * 49, 56) = 2896954 );
end;


{-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
function BankTab(NumberOfTab: Integer): Boolean;
By: Nicbaz
Description: Changes to the tab you select
Status: Good
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-}
function BankTab(NumberOfTab: Integer): Boolean;
begin
if (NumberOfTab <1) or (NumberOfTab > 9) then
begin
srl_Warn('BankTab',inttostr(NumberOfTab)+' BankTab does not exist',warn_AllVersions);
Result := False;
Exit;
end;
if (IsBankTabOpen(NumberOfTab)) then
Exit;
MouseBox(34 + (NumberOfTab - 1) * 50, 54, 34 + (NumberOfTab - 1) * 50, 75, 1);
end;

PvH

2008-07-15 03:06:00

Why don't you use cases for it NicbaZ?
like:

case lowercase(numberoftab) of
1: blahblah
2:blahblah
etc;)

NiCbaZ

2008-07-15 03:22:03

From: pvh
Why don't you use cases for it NicbaZ?
like:

case lowercase(numberoftab) of
1: blahblah
2:blahblah
etc;)


hmm it would be jus as long i think il cheak

Cause then you get Line 48: [Error] (15093:16): Unknown identifier 'NumberOfTab' in script C:\

and you would have to do it with a string then you would have to use like

ChangeTab('2');

so what do you guys think?

Method

2008-07-15 03:33:07

How's this?

//-----------------------------------------------------------------//
//-- Scar Nicbaz Libary --//
//-- » BankTabs --//
//-----------------------------------------------------------------//

//Function IsBankTabOpen(WhichTab: Integer) : Boolean // * by Nicbaz
//function BankTab(NumberOfTab: Integer): Boolean; //* by Nicbaz

{-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Function IsBankTabOpen(WhichTab: Integer) : Boolean
By: Nicbaz
Description: Returns True if your tab is open
Status: Goog
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-}

function IsBankTabOpen(WhichTab: Integer) : Boolean; // returens if your tab is opend or closed
begin
if (not(LoggedIn)) then Exit;
case WhichTab of
1: Result := (GetColor(63, 65) = 2896954)
2: Result := (GetColor(103, 59) = 2896954)
3: Result := (GetColor(158, 69) = 2896954)
4: Result := (GetColor(206, 57) = 2896954)
5: Result := (GetColor(262, 68) = 2896954)
6: Result := (GetColor(305, 59) = 2896954)
7: Result := (GetColor(352, 61) = 2896954)
8: Result := (GetColor(395, 63) = 2896954)
9: Result := (GetColor(444, 65) = 2896954)
end;
end;

{-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
function BankTab(NumberOfTab: Integer): Boolean;
By: Nicbaz
Description: Changes to the tab you select
Status: Goog
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-}
function BankTab(NumberOfTab: Integer): Boolean;
begin
if (NumberOfTab <1) or (NumberOfTab > 9) then
begin
srl_Warn('BankTab',inttostr(NumberOfTab)+' BankTab does not exist',warn_AllVersions);
Result := False;
Exit;
end;
if (IsBankTabOpen(NumberOfTab)) then
Exit;
case NumberOfTab of
1: MouseBox(35, 59, 35, 79, 1);
2: MouseBox(82, 52, 82, 77, 1);
3: MouseBox(128, 59, 132, 73, 1);
4: MouseBox(178, 58, 174, 76, 1);
5: MouseBox(224, 62, 228, 79, 1);
6: MouseBox(274, 57, 271, 80, 1);
7: MouseBox(323, 59, 318, 79, 1);
8: MouseBox(371, 58, 368, 76, 1);
9: MouseBox(417, 60, 412, 74, 1);
end;
end;

NiCbaZ

2008-07-15 03:44:30

wow thanks man i can not bleave i did not think of that +rep thanks

Edit: updated its half decent now

PvH

2008-07-15 03:45:56

Thats what I ment with cases:p
Method's one is way smaller^^

PvH

NiCbaZ

2008-07-15 03:53:27

From: pvh
Thats what I ment with cases:p
Method's one is way smaller^^

PvH


;) thanks man

Gu3st...

2008-07-15 03:58:02

Wow, how can the status of the codes be 'Goog'? :o

nice functions btw :)

NiCbaZ

2008-07-15 04:03:04

good :~ lol, thanks

Wizzup?

2008-07-15 04:22:05

And now with a formula, and loop through it. ;)
EDIT: Maybe like this:
function IsBankTabOpen(WhichTab: Integer) : Boolean;      // returns if your tab is opend or closed

begin
Result := CountColorTolerance(2896954, 63 + (WhichTab - 1) * 50, 60, 5) > 5;
end;

Added Tolerance, in case JageX might ever mess with it.
Untested though.

NiCbaZ

2008-07-15 04:29:16

From: Wizzup?
And now with a formula, and loop through it. ;)
EDIT: Maybe like this:
function IsBankTabOpen(WhichTab: Integer) : Boolean;      // returns if your tab is opend or closed

begin
Result := CountColorTolerance(2896954, 63 + (WhichTab - 1) * 50, 60, 5) > 5;
end;

Added Tolerance, in case JageX might ever mess with it.
Untested though.


ahh good thinking theres always a way to make a function shorter

NiCbaZ

2008-07-15 04:40:35

updated thanks wizzup il be sure to use that again in future functions

Edit- now shorter than ever thanks for the idea wizzy

Edit: should i add this to SPD