SRL Archive - SRL Archives

PointToBankIndex


Kave

2008-05-08 06:03:24

I know that in Bank.scar there is a function called MSTPointToBankIndex, and mine does what it does, but it didn't work for me so I made my own.

function PointToBankIndex(P: TPoint): Integer;
var
sx,ex,sy,ey,i,z: Integer;
begin
if not(LoggedIn) then exit;
sx := 80;
sy := 60;
ex := 115;
ey := 95;
for i := 0 to 8 do
begin
if (P.x > sx) and (P.x < ex) then
Break
else
begin
IncEx(sx,45);
IncEx(ex,45);
end;
end;
if i > 8 then Exit;
for z := 1 to 6 do
begin
if (P.y > sy) and (P.y < ey) then
Break
else
begin
IncEx(sy,40);
IncEx(ey,40);
end;
end;
if z > 6 then Exit;
Result := BankPointToIndex(Point);
end;

I use this with a modified version of munks countInvStack to get amounts in the bank.

Bobarkinator

2008-05-08 08:14:21

If the old one doesn't work, you should post this in SRL Development.

Wizzup?

2008-05-08 10:40:31

Hmm… I beleive this can definately be shortened down.
I'll give the PointToBankIndex a try when I get home.

Kave

2008-05-08 11:07:52

Ya it probably can lol. I thought it looked kinda of nice though :p