SRL Archive - SRL Archives

Banking problems in Amount.scar


Metagen

2008-10-09 09:21:19

Pulled from Amount.scar//AreaInfo()
 
'bank': begin
startx := 78;
starty := 61;

rowsize := 38;
colsize := 47;

colnumber := 8;
rownumber := 6;
end;

These coordinates are wrong, such that anything relying on
function Amount(area: string; i: Integer): Integer; 
will no longer function inside the bank.

I will try to fix … because i need this function to make my code look pretty.. and that's what it's all about. but i have to figure out exactly what the coordinates mean :( ill just leech off of inventory and fix like that. dtms ftw.

edit: Ok this is untested, but if my math is correct, for an untabbed bank… this is it


'bank': begin
startx := 35;
starty := 91;

rowsize := 44;
colsize := 44;

colnumber := 10;
rownumber := 5;

edit edit: ok it works. use that one. :D yay now my bank feather counter works

tarajunky

2008-10-09 12:07:26

Can you post a function that I can use to test it? Once I can confirm that works, I'll update it in the Dev SVN.

Metagen

2008-10-09 12:14:08

YEa sure one sec… You got any feathers in ur bank?


function FindFeather(var x, y : Integer; where : String) : Boolean;
var DTM : Integer;
begin
DTM := DTMFromString('78DA638C626060A86640038C70920344C7028' +
'952026AA28950130F244A08A84902128504D480DC9C4F845DE904' +
'D46402892C026A12B0ABD16184A964600000509B07D2');
result := FindItem(DTM, x, y, where);
x := x + 6; //offset
y := y - 15;
FreeDTM(DTM);
end;

function FeatherCount(where : String) : Integer;
var x, y, index: Integer;
begin
where := LowerCase(where);
if not FindFeather(x, y, where) then
begin
result := 0;
exit;
end;
if (where = 'inv') or (where = 'inventory') then
index := CoordsToItem(x, y);
if (where = 'bank') then
index := BankPointToBankIndex(MSTPointToBankPoint(IntToPoint(x, y)));
result := Amount(where, index);
end;

// use this -> WriteLn(IntToStr(FeatherCount('bank')));

EDIT:


function FindItem(DTM : Integer; var x, y : Integer; where : String) : Boolean;
begin
result := true;
where := lowercase(Where);
if where = 'bank' then
begin
if not FindDTM(DTM, x, y, msx1, msy1, msx2, msy2) then result := false;
end else if (where = 'inv') or (where = 'inventory') then
begin
if not FindDTM(DTM, x, y, mix1, miy1, mix2, miy2) then result := false;
end else
begin
WriteLn('Incorrect Input');
result := false;
end;
end;


tarajunky

2008-10-09 16:31:56

About 10 million or so… lol.

I've been running 5 simultaneous instances of my chickenkiller on my army lately.

I'll test it when I get home tonight.

Edit:

Tested, and it works great! Good job, Metagen. Will upload it tonight.