Nava2
2008-09-02 17:38:33
Here are the withdraw functions I'm using. They are MODIFIED SRL, but they are better, IMO. They are the same where the error is happening.
Read the following code, then look at what I get in my debug box.
So, I think there is a bug, and the Col - 1, Row - 1 should be removed. :)
That is all. I think its a bug in the new SRL as I haven't come across it pre-rev 24.
Anyways. I also want to put my withdraw function up for denied or accepted.
Either way, let me know if you find a different error.
Cheers.
Read the following code, then look at what I get in my debug box.
{*******************************************************************************
procedure Withdraw(Col, Row, Amount: Integer);
by: Starblaster100, Town, Wizzup? and Nava2
Description: Withdraws Amount at Column/Row.
*******************************************************************************}
function WithdrawMod(col, row, Amount: Integer): boolean;
Var
ResInt, I : Integer;
BBox: TBox;
begin
FixBank;
//FixBankTab;
Result := false;
ResInt := InvCount;
BBox := BankIndexToMSBox(BankPointToBankIndex(Point(Col, Row)));
Writeln('Index: ' + IntToStr(BankPointToBankIndex(Point(Col, Row))));
case Amount of
0: begin
MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, 2);
ChooseOption('Withdraw-All');
end;
1: begin
MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, 1);
Wait(RandomRange(50, 150));
end;
else
begin
MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, 2);
if not ChooseOption('Withdraw-' +IntToStr(Amount)) then
begin
MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, 2);
if (ChooseOption('Withdraw-X')) then
begin
Wait(RandomRange(700, 1200));
TypeSend(IntToStr(Amount));
end;
end;
end;
end;
while ResInt =< InvCount do
begin
if I > 200 then break;
Wait(RandomRange(100, 150));
Inc(i);
Status('Waiting for RS to withdraw items.');
end;
Result := ResInt < InvCount;
end;
{*******************************************************************************
function WithdrawItem(Ident: integer; IdentType: string; var Index: integer; Amount: integer; UpText: TStringArray; Tol: TIntegerArray): boolean;
By: Nava2
Sections by: WT-Fakawi / Sumilion
Description: Withdraws an item from the bank by using "Ident" with tol[0]
as color tolerance, tol[1] as contour tolerance in case of bmp masks. Valid IdentTypes are :
bmp, mask, color, dtm.
Index: The Bank Index where the item is found, must be a variable. Speeds up future withdraws.
Amount: Amount to withdraw from bank.
UpText: The Uptext which the function checks for.
*******************************************************************************}
function WithdrawItem(Ident: integer; IdentType: string; var Index: integer; Amount: integer; UpText: TStringArray; Tol: TIntegerArray): boolean;
var
x1, y1, coltol, contol : integer;
BPoint : TPoint;
BankBox : TBox;
F, Found : boolean;
label
Start;
begin
{Written by WT-Fakawi / Sumilion, from this line to {end}
case LowerCase(IdentType) of
'bmpmask', 'bitmapmask', 'bmp mask', 'bitmap mask', 'mask':
try
begin
coltol := tol[0];
contol := tol[1];
end;
except
srl_Warn('WithdrawItem', 'Tol was incorrect', warn_AllVersions);
Exit;
end;
'dtm': begin end; //I guess this is a check to make sure its a valid identifier?
'bmp', 'bitmap', 'color':
try
coltol := tol[0];
except
srl_Warn('WithdrawItem', 'Tol was incorrect', warn_AllVersions);
Exit;
end;
else begin
srl_Warn('WithdrawItem', 'Invalid identifier type: ' + IdentType, warn_AllVersions);
Exit;
end;
end;
{End}
if (Index = 0) then
begin
Start:
for Index := 1 to 50 do
begin
BankBox := BankIndexToMSBox(Index);
case LowerCase(IdentType) of
'bmp', 'bitmap': F := FindBitmapSpiralTolerance(Ident, x1, y1, BankBox.x1, BankBox.y1, BankBox.x2, BankBox.y2, coltol);
'bmpmask', 'bitmapmask', 'bmp mask', 'bitmap mask', 'mask': F :=FindBitmapMaskTolerance(Ident, x1, y1, BankBox.x1, BankBox.y1, BankBox.x2, BankBox.y2, coltol, contol);
'color': F := FindColorTolerance(x1, y1, Ident, BankBox.x1, BankBox.y1, BankBox.x2, BankBox.y2, coltol);
'dtm': F := FindDtm(Ident, x1, y1, BankBox.x1, BankBox.y1, BankBox.x2, BankBox.y2);
end;
if F then
begin
MMouse(x1, y1, 4, 4);
Wait(100+random(50));
if IsUpTextMultiCustom(UpText) then
begin
Writeln('Found Item at Bank Slot ' + IntToStr(Index) + '.');
Found := true;
break;
end else
Writeln('Found Incorrect Item, Moving to new Bank Spot.');
end;
end;
end else
begin
BankBox := BankIndexToMSBox(Index);
MouseBox(BankBox.x1, BankBox.y1, BankBox.x2, BankBox.y2, 3);
Wait(100+random(50));
if IsUpTextMultiCustom(UpText) then
Found := true
else
begin
Writeln('Item Moved from Bank Slot ' + IntToStr(Index) + ', checking bank again.');
GoTo Start;
end;
end;
Wait(200+random(150));
if Found then
begin
BPoint := MSTPointToBankPoint(Point(x1, y1));
Writeln('Col: ' + IntToStr(BPoint.x) + ' Row: ' + IntToStr(BPoint.y));
Result := WithdrawMod(BPoint.x, BPoint.y, Amount);
DTMPoint := Point(x1, y1);
end else
begin
Index := 0;
Writeln('Could not Find ' + IdentType + ' in Bank.');
end;
end;Found Incorrect Item, Moving to new Bank Spot.
Found Incorrect Item, Moving to new Bank Spot.
Found Incorrect Item, Moving to new Bank Spot.
Found Item at Bank Slot 20. <- Index where item ACTUALLY is
Col: 9 Row: 1 <- Bank point where it is.
Index: 9 <- where the withdraw function finds it.So, I think there is a bug, and the Col - 1, Row - 1 should be removed. :)
That is all. I think its a bug in the new SRL as I haven't come across it pre-rev 24.
Anyways. I also want to put my withdraw function up for denied or accepted.
Either way, let me know if you find a different error.
Cheers.