SRL Archive - Reflection Development

DepositItem


weezy

2010-11-26 16:35:57

Will deposit items that have the said ID.

Have not tested this function yet but it should work.

function DepositItem(id,amount:integer):boolean;
var item:TInvItem;
begin
if not R_BankScreen then exit;
result := false;
if R_ItemIDExists(item, id) then
result := true;
if result then
begin
result := false;
MoveBox(InvBox(item.slot));
ClickMouse2(amount = 1);
if (amount = 1) then
begin
result := true;
Wait(RandomRange(250, 550));
Exit;
end;

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

if (not (Result)) and (Amount > 0) then
begin
if WaitOptionMulti(['Deposit-X', 'd-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;
end;

EDIT: Here is my movebox function, sorry, I'm sure SRL has an equivalent, I made it so it uses the random(random()) method a few people have mentioned before for realism.

procedure MoveBox(box:TBox);
var x,y:integer;
begin
x := (box.x2 - box.x1)/2;
y := (box.y2 - box.y1)/2;
MMouse(box.x1 + x + Random(RandomRange(-x,x)), box.y1 + y + Random(RandomRange(-y,y)), 0, 0);
end;

I have now tested the function and it works perfectly as far as I know.

Gu3st...

2010-11-26 20:37:50

Wow. I find it weird there wasn't a function like that in reflection…
Thanks for making this. Hopefully a Ref dev sees this and commits it :)

TomTuff

2010-11-26 21:14:02

i dont see where it mouses to the item.

Frement

2010-11-26 21:21:28

From: TomTuff
i dont see where it mouses to the item.


ClickBox(InvBox(item.slot),false)

Gu3st...

2010-11-27 05:28:43

MoveBox(InvBox(item.slot));
ClickMouse2(amount = 1);

Bad Boy JH

2010-11-27 09:43:09

I do actually use something simmilar to your move box its MouseBoxCentre, mine uses a Min of two randoms, its slightly more parobolic, compared to yours, which is (I think) exponential…