SRL Archive - MSI Suggestions

MSI_OpenBank


NCDS

2009-09-18 09:12:03

Do you guy's think this (or something similar) would be an effective way to go about opening the bank:

{******************************************************************************}
{ Function MSI_OpenBank(Bank, tPin: string): Boolean; }
{ By: NCDS }
{ Rev: 1 }
{ Date: 18 Sep 09 }
{ Description: Opens any bank supported by SRL. tPin = RS Bank Pin. Set to '0' if you don't have one. }
{******************************************************************************}
function MSI_OpenBank(Bank, tPin: string): Boolean;
var i, t: Integer;
begin
for i := 0 to 3 do
begin
if OpenBankFast(Bank) then
Break;
end;
if not BankScreen and not PinScreen then Exit;
if PinScreen and (Length(tPin) > 1) then
InPin(tPin);
MarkTime(t);
while not BankScreen do
begin
Wait(600);
if TimeFromMark(t) > 5000 then
Exit;
end;
Result := BankScreen;
end;
or do you think we should just use SRL's and write it out custom each time?

Sir R. M8gic1an

2009-09-18 09:53:10


Bank, tPin: string

/me takes gun and shoots himself

Have a look at Walking.scar where all the location consts are, and use those. You can always make a function TWalkToBank , but i don't want to see any string parameters :o

TPin can just simply be put in Players[].Pin and be called directly insde the function, no need to pass it.

Taking all this into account, you could probably have this function with no params, just MSI_OpenBank which would make it pure ownage.

~RM

EvilChicken!

2009-09-18 10:27:35

I'm thinking about something like this, no? Read the thread for reasons ..

(Since we're considering using SmartColors for general object finding as well, so why not?)

Sir R. M8gic1an

2009-09-18 10:37:03

From: EvilChicken!

(Since we're considering using SmartColors for general object finding as well, so why not?)


We're not. At least not at first.

~RM

Coh3n

2009-09-18 17:16:55

From: Rasta Magician

Taking all this into account, you could probably have this function with no params, just MSI_OpenBank which would make it pure ownage.


But you still need to declare which bank you're going to open.

@NCDS: Does the for..to..do loop you used try to open the bank 4 times? I've just never seen it used that way so I'm just wondering.

NCDS

2009-09-18 20:28:11

From: Coh3n

@NCDS: Does the for..to..do loop you used try to open the bank 4 times? I've just never seen it used that way so I'm just wondering.


Yes, it attempts to open the bank 4 times, and if it finds it, it breaks from that loop.

@RM: I don't really see how to get around using a Param for which bank unless I just make it try different bank colors. Originally I did have it just using InPin(Players[CurrentPlayer].Pin), I really don't know why I changed it. I stop thinking late at night sometimes I guess. Can you maybe elaborate on how I would be able to remove the 'WhichBank' param?

Sir R. M8gic1an

2009-09-18 20:47:26

From: NCDS
Yes, it attempts to open the bank 4 times, and if it finds it, it breaks from that loop.

@RM: I don't really see how to get around using a Param for which bank unless I just make it try different bank colors. Originally I did have it just using InPin(Players[CurrentPlayer].Pin), I really don't know why I changed it. I stop thinking late at night sometimes I guess. Can you maybe elaborate on how I would be able to remove the 'WhichBank' param?



Sure thing!

[php]
function TWalkToBank(Where: TWalk): string;
begin
with Where do
begin
case city of
City_Varrock:
case Loc of
Loc_VEBank: Result := Bank_VE;
Loc_VWBank: Result := Bank_VW;
Loc_GEBank: Result := Bank_GE;
end;
City_Falador:
//…
end;
end;
end;

function MSI_OpenBank: boolean;
var
WhichBank: string;
begin
WhichBank := TWalkToBank(MyWalk);
OpenBankFast(WhichBank…..);
end;
[/php]

http://www.villavu.com/forum/showthread.php?p=633699#post633699

~RM

NCDS

2009-09-19 01:10:00

I see :)

Unless I'm missing something though, this doesn't get rid of 'WhatBank' param necessarily. It just creates another function and adds the param to that. Unless there is something else that function is supposed to accomplish?

I'll wait for your response, then I'll begin :)

Sir R. M8gic1an

2009-09-20 18:03:37

no it doens't get rid of it, but at least this way you don't have to to pass it, which will spare you a few headaches

~RM

NCDS

2009-09-20 19:08:10

Alright, then I'll get going with it.