SRL Archive - SRL Suggestions

WithdrawEx in bank.scar


KingKong

2011-06-07 08:28:26

I think, FixBank should be removed from WithdrawEx, because whenever i switch to another tab, and try to withdraw, it takes me back to main tab. It could be either removed since the withdrawal method works for any tab, or add an additional parameter in WithdrawEx asking for the banktab to withdraw from.

E: Can someone tell me how to Use WithdrawItemEx? and if its somehow related to what im talking about?

masterBB

2011-06-07 09:56:18

From: KingKong
I think, FixBank should be removed from WithdrawEx, because whenever i switch to another tab, and try to withdraw, it takes me back to main tab. It could be either removed since the withdrawal method works for any tab, or add an additional parameter in WithdrawEx asking for the banktab to withdraw from.

E: Can someone tell me how to Use WithdrawItemEx? and if its somehow related to what im talking about?


^Same problem. Only works for main/first tab.

What do you want to know about that function?

Example:
airRuneDTM := LoadDTM(AIR_RUNE_DTM);
WithdrawItemEx(airRuneDTM,'dtm',AirRuneSlot,2,'ir',[0]);
freeDTM(airRuneDTM);

You can use DTM's, bmp and more. First argument is the 'thing' to search for. Second one is the type. Third one is Slot it should search first, will also update it if its in another slot. Fourth argument is the amount. Fifth is the uptext. Last but not least the tolerance.(not needed for DTMs)

edit:
Amount.scar -> FindItemEx (function it is based on)
{*******************************************************************************
function FindItemEx(var x, y: Integer; IdentType: string; Ident: Integer; Area: TBox; Tol: TIntegerArray): Boolean;
By: Nava2
Description: Finds an item in Area specified by TBox in Area. Valid IdentTypes are:
bmp, mask, color, dtm. The Tol variable is:
Tol[0] : Color Tolerance;
Tol[1] : Contour Tolerance or minimum Colors to Find to be True.

KingKong

2011-06-12 22:45:46

Bump, Bump

Coh3n

2011-06-15 03:34:36

So what exactly is the problem? The withdrawing will work with all tabs, but there's a FixBank call somewhere there shouldn't be? Could you try making the change yourself and testing it? I'm just really busy and it's a lot easier if I can just copy/paste/commit.

Thanks. :)

KingKong

2011-06-15 05:20:01

From: Coh3n
So what exactly is the problem? The withdrawing will work with all tabs, but there's a FixBank call somewhere there shouldn't be? Could you try making the change yourself and testing it? I'm just really busy and it's a lot easier if I can just copy/paste/commit.

Thanks. :)


Problem: When withdrawex is called, it switches to the main tab.
Solution: Delete the fixbanktab, here is the fix:

function WithdrawEx(Col, Row, Amount: Integer; Uptexts: TStringArray): Boolean;
var
BBox: TBox;
X, Y: Integer;
begin
Result := False;
FixBank;

BBox := BankIndexToMSBox(BankPointToBankIndex(Point(Col, Row)));
GetMousePos(X, Y);
if (not PointInBox(Point(X, Y), BBox)) then
MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, 3);

if (Length(Uptexts) > 0) then
if (not WaitUptextMulti(Uptexts, 500)) then
Exit;

ClickMouse2(Amount = 1);
if (Amount = 1) then
begin
Result := True;
Wait(RandomRange(250, 550));
Exit;
end;

if (Amount = 0) then
Result := WaitOptionMulti(['Withdraw-All', 'w-A'], 300)
else
Result := WaitOptionMulti(['Withdraw-' + IntToStr(Amount), 'w-' + IntToStr(Amount)] , 300);

if (not (Result)) and (Amount > 0) then
begin
MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, 2);
if WaitOptionMulti(['Withdraw-X', 'w-X'], 500) then
begin
X := GetSystemTime + 10000;
while (X >= GetSystemTime) and (not (InRange(CountColor(0, 250, 396, 307, 410), 155, 165))) do
Wait(50);
Wait(RandomRange(75, 400));
TypeSend(IntToStr(Amount));
Result := True;
end;
end;
end;

Coh3n

2011-06-15 05:57:28

Thanks, committed. :)