SRL Archive - SRL Snippets

DepositAllButEx


Shuttleu

2012-01-05 10:20:14

procedure DepositAllButEx(Stuff: TIntegerArray);
var
i, j, x, y, TempNumber, ItemColor: Integer;
Box, Box1: TBox;
SpecialItem, DupeItem: Boolean;
begin
for i:=1 to 28 do
if ExistsItem(i) then
begin
SpecialItem:= False;
Box:= InvBox(i);
writeln(length(Stuff));
for j:=0 to High(Stuff) do
if FindDTM(Stuff[j], x, y, Box.X1, Box.Y1, Box.X2, Box.Y2) then
SpecialItem:= True;
if not SpecialItem then
begin
DupeItem:= False;
TempNumber:= CountColor(131072, Box.X1, Box.Y1, Box.X2, Box.Y2);
ItemColor:= GetColor(Box.X1+15, Box.Y1+15);
for j:=i+1 to 28 do
begin
GetInvItemBounds(i, Box1);
if ((CountColor(131072, Box1.X1, Box1.Y1, Box1.X2, Box1.Y2) = TempNumber) and (GetColor(Box.X1+15, Box.Y1+15) = Itemcolor)) then
begin
DupeItem:= True;
break;
end;
end;
if DupeItem then
begin
MouseBox(Box.X1+5, Box.Y1+5, Box.X2-5, Box.Y2-5, 2);
Wait(200+Random(300));
ChooseOption('it-All');
Wait(500+Random(300));
end else
begin
MouseBox(Box.X1+5, Box.Y1+5, Box.X2-5, Box.Y2-5, 1);
Wait(600+Random(300));
end;
end;
end;
end;

it will deposit everything apart from the DTM's which the user includes when they call the function

it can be made more accurate if instead of getting a color and comparing it with the next boxes you use create and use a bmp of some sort, however im not entirely too sure of how to do this :s

~shut

Coh3n

2012-01-07 14:13:57

Why need DTMs? The other deposit functions use inventory slots, so why not make this one? DepositAllExcept(slots: TIntegerArray). If you want to don't want to deposit certain items, you can get the inventory slot using CoordsToItem and FindDTM.

Shuttleu

2012-01-07 14:19:35

because it would make it easier for new people who wouldnt know how to do it otherwise

~shut

Coh3n

2012-01-07 15:19:59

We're making things too easy for people.

I'm not going to add this because it's inconsistent with other Deposit methods. Someone else is welcome to add it, though.

Sin

2012-01-23 18:05:38

I'm getting an error when I do this -

DepositAllButEx(astralDTM);
astralDTM is my DTM name.

[Error] (118:30): Type mismatch at line 117

Kyle Undefined

2012-01-23 18:07:16

From: S1N
I'm getting an error when I do this -

DepositAllButEx(astralDTM);
astralDTM is my DTM name.

[Error] (118:30): Type mismatch at line 117


It needs to be in an array: DepositAllButEx([astralDTM]);

Sin

2012-01-23 18:08:31

O.
I didn't see the array part :p..