SRL Archive - SRL Archives

Bank Tab


NiCbaZ

2008-09-04 02:48:26

BankTab.. For Banking.scar, very usefull :)

thanks to Wizzup? for helping

{-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
function IsBankTabOpen(WhichTab: Integer) : Boolean;
By: Nicbaz
Description: Returns True if your tab is open
Status: Good
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-}
function IsBankTabOpen(WhichTab: Integer) : Boolean;
begin
Result := (GetColor(64 + (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;

markuska815

2008-09-04 03:02:55

you should make the BankTab function result in true if the bank tab is open or if it successfully opens the tab:

if (IssBankTabOpen(NumberOfTab)) then
begin
Result := true;
Exit;
end else
Result := MouseBox(34 + (NumberOfTab - 1) * 50, 54, 34 + (NumberOfTab - 1) * 50, 75, 1);

Narcle

2008-09-04 09:47:20

I don't think banktabs will be a simple "BankTab(3) then click this area" type of deal.

Only reason I say this is because the player chooses if there is a banktab there or not. Also depending how many banktabs there is, the size of them change depending how many bank tabs there are.

I was thinking of possible doing a TPA count or some such to first determine how many bank tabs there are. Then we can have a well working BankTab() function.

Seroko

2008-09-04 19:55:20

Uhm, not meaning to steal your function, heres a SLIGHTLY edited version i use in my scripts.


{*******************************************************************
Procedure SetBankTab(WhichTab: Integer);
By: Nicbaz edited by Seroko
Description: Sets the bank tab to WhichTab
********************************************************************}

procedure SetBankTab(WhichTab: Integer);
begin
if (WhichTab <1) or (WhichTab > 9) then
begin
Writeln('Bank tab '+IntToStr(WhichTab)+' does not exist!');
Exit;
end;
if (GetColor(62 + (WhichTab - 1) * 49, 56) = 2896954) then
Exit;
MouseBox(34 + (WhichTab - 1) * 50, 54, 34 + (WhichTab - 1) * 50, 75, 1);
end;

HyperSecret

2008-09-04 19:59:50

From: Narcle
I don't think banktabs will be a simple "BankTab(3) then click this area" type of deal.

Only reason I say this is because the player chooses if there is a banktab there or not. Also depending how many banktabs there is, the size of them change depending how many bank tabs there are.

I was thinking of possible doing a TPA count or some such to first determine how many bank tabs there are. Then we can have a well working BankTab() function.


Totally agree with you there.

Seroko

2008-09-04 20:57:02

The size of bank tabs never change (example)

[Main][ 1 ]
[Main][ 1 ][ 2 ]
[Main][ 1 ][ 2 ][ 3 ]

Etc. The size is never adjust it just adds a tab, and if you call a tab thats not there you will be clicking nothing.

HyperSecret

2008-09-04 21:06:44

I guess i have never messed with banktabs and they don't change so this should work…sorry for not knowing before i agreed with something

Narcle

2008-09-04 21:23:44

From: Seroko
The size of bank tabs never change (example)

[Main][ 1 ]
[Main][ 1 ][ 2 ]
[Main][ 1 ][ 2 ][ 3 ]

Etc. The size is never adjust it just adds a tab, and if you call a tab thats not there you will be clicking nothing.


Well we still need to check to see how many tabs are there anyways. So that if it tried to click a tab it returns false, or the warning comes up that the tab isn't there.

Seroko

2008-09-04 22:42:33

From: Narcle
Well we still need to check to see how many tabs are there anyways. So that if it tried to click a tab it returns false, or the warning comes up that the tab isn't there.


Why? it would be a user set variable

something like

Players[0].integer[0] := 4; // Bank tab to use

but uhm, if you wanted add that you could do something like..

procedure SetBankTab(WhichTab: Integer);
begin
if (WhichTab <1) or (WhichTab > 9) then
begin
Writeln('Bank tab '+IntToStr(WhichTab)+' does not exist!');
Exit;
end;
if (GetColor(62 + (WhichTab - 1) * 49, 56) = 2896954) then
Exit;
if (GetColor(62 + (WhichTab - 1) * 49, 56) = 3424329) or (GetColor(62 + (WhichTab - 1) * 49, 56) = 33358280) then
begin
Writeln('Bank tab '+IntToStr(WhichTab)+' does not exist!');
Exit;
end;
MouseBox(34 + (WhichTab - 1) * 50, 54, 34 + (WhichTab - 1) * 50, 75, 1);
end;

not the most efficient way, cause I just threw it in there, but something like that should work. I still don't think its needed.

NiCbaZ

2008-09-05 02:09:09

From: Narcle
I don't think banktabs will be a simple "BankTab(3) then click this area" type of deal.

Only reason I say this is because the player chooses if there is a banktab there or not. Also depending how many banktabs there is, the size of them change depending how many bank tabs there are.

I was thinking of possible doing a TPA count or some such to first determine how many bank tabs there are. Then we can have a well working BankTab() function.


No need for anything advanced, bank tabs never change size, and it will no click on the tab if its not opened or not yet created, il add a warning in that will tell you if its open, or not created.

Narcle

2008-09-05 09:04:31

From: Seroko
Why? it would be a user set variable

something like

Players[0].integer[0] := 4; // Bank tab to use

but uhm, if you wanted add that you could do something like..

procedure SetBankTab(WhichTab: Integer);
begin
if (WhichTab <1) or (WhichTab > 9) then
begin
Writeln('Bank tab '+IntToStr(WhichTab)+' does not exist!');
Exit;
end;
if (GetColor(62 + (WhichTab - 1) * 49, 56) = 2896954) then
Exit;
if (GetColor(62 + (WhichTab - 1) * 49, 56) = 3424329) or (GetColor(62 + (WhichTab - 1) * 49, 56) = 33358280) then
begin
Writeln('Bank tab '+IntToStr(WhichTab)+' does not exist!');
Exit;
end;
MouseBox(34 + (WhichTab - 1) * 50, 54, 34 + (WhichTab - 1) * 50, 75, 1);
end;

not the most efficient way, cause I just threw it in there, but something like that should work. I still don't think its needed.

Its so if something goes wrong, or the person that is setting up the script doesn't see it.

From: NiCbaZ
No need for anything advanced, bank tabs never change size, and it will no click on the tab if its not opened or not yet created, il add a warning in that will tell you if its open, or not created.

Yeah if they don't change size then GetColor's like Seroko showed should work.

I think its needed so it doesn't try to spam click a area that doesn't exist. Just a thought. ;)

Edit:
Oh I know you have "IsBankTabOpen" instead I think you should have one that just returns the integer of which one is open. "BankTabOpen: integer;"