SRL Archive - SRL Archives

DepositAllBut, and DropAllBut


Nava2

2008-05-24 18:01:20

These are an old idea, but I never really saw them put into action, so I wrote my own. I did not include a new dropping order for the dropping but I did exclude the items to drop! :D.


Major Flaw, thanks to Mixter for pointing out; it will only keep it if there is one of the item. Fixing at a later time.
{*******************************************************************************
function DepositAllBut(IdentType: string; Idents: TIntegerArray): boolean;
By: Nava2
Description: Deposits all items except those which are specified by Idents.
Valid IdentType arguments are:
dtm, bmp, and bitmap.
Valid arguments for Idents are DTMs, and Bitmaps.
*******************************************************************************}

function DepositAllBut(IdentType: string; Idents: TIntegerArray): boolean;
var i, t, xx, yy, t: integer;
z: TIntegerArray;
begin
result := false;
GameTab(4);
case Lowercase(IdentType) of
'dtm': for i:= 0 to High(Idents) do
if FindDTM(Idents[i], xx, yy, MIX1, MIY1, MIX2, MIY2) then
begin
t := CoordsToItem(xx, yy);
if t <> 0 then
begin
SetLength(z, Length(z) + 1);
z[High(z)]:= t;
end;
end else
Writeln('The ' + IntToStr(i) + ' ' + IdentType + ' is not found.');

'bmp', 'bitmap': for i:= 0 to High(Idents) do
if FindBitmapIn(Idents[i], xx, yy, MIX1, MIY1, MIX2, MIY2) then
begin
t := CoordsToItem(xx, yy);
if t <> 0 then
begin
SetLength(z, Length(z) + 1);
z[High(z)]:= t;
end;
end else
Writeln('The ' + IntToStr(i) + ' ' + IdentType + ' is not found.');

else begin
Writeln(IdentType + ' is not a valid parameter, exiting function.');
exit;
end;
end;
for i := 0 to 28 do
if ExistsItem(i) then
begin
for t := 0 to High(z) do
if (i = z[t]) then break;
MouseItem(i, false);
Wait(100+random(50));
case random(10) of
0..7: begin
ChooseOption('ll');
Result := true;
end;
8..9: begin
ChooseOption('X');
Wait(100+random(50));
TypeSend(IntToStr(RandomRange(28,300)));
Result := true;
end;
end;
end;
ArrangeInv;
end;

{*******************************************************************************
function DropAllBut(IdentType: string; Idents: TIntegerArray): boolean;
By: Nava2
Description: Deposits all items except those which are specified by Idents.
Valid IdentType arguments are:
dtm, bmp, and bitmap.
Valid arguments for Idents are DTMs, and Bitmaps.
*******************************************************************************}

function DropAllBut(IdentType: string; Idents: TIntegerArray): boolean;
var i, t, xx, yy, TMS: integer;
z: TIntegerArray;
begin
result := false;
TMS := MouseSpeed;
GameTab(4);
MouseSpeed := 25;
case Lowercase(IdentType) of
'dtm': for i:= 0 to High(Idents) do
if FindDTM(Idents[i], xx, yy, MIX1, MIY1, MIX2, MIY2) then
begin
t := CoordsToItem(xx, yy);
if t <> 0 then
begin
SetLength(z, Length(z) + 1);
z[High(z)] := t;
end;
end else
Writeln('The ' + IntToStr(i) + ' ' + IdentType + ' is not found.');

'bmp', 'bitmap': for i:= 0 to High(Idents) do
if FindBitmapIn(Idents[i], xx, yy, MIX1, MIY1, MIX2, MIY2) then
begin
t := CoordsToItem(xx, yy);
if t <> 0 then
begin
SetLength(z, Length(z) + 1);
z[High(z)] := t;
end;
end else
Writeln('The ' + IntToStr(i) + ' ' + IdentType + ' is not found.');

else begin
Writeln(IdentType + ' is not a valid parameter, exiting function.');
exit;
end;
end;
for i := 0 to 28 do
if ExistsItem(i) then
begin
for t := 0 to High(z) do
if (i = z[t]) then break;
MouseItem(i, false);
Wait(100+random(50));
repeat
case random(10) of
0..8: begin
ChooseOption('rop');
Result := true;
end;
9: begin
ChooseOption('xamine');
end;
end;
until result;
end;
ArrangeInv;
MouseSpeed := TMS;
end;

These compile, untested though as I don't have any accs.

Nava2

Harry

2008-05-24 18:05:43

Cool. Why don't you just make a level 3 newbie? :p

Nava2

2008-05-24 18:13:26

From: Hy71194
Cool. Why don't you just make a level 3 newbie? :p


Tut Island is lameeeee.

Nava2

mixster

2008-05-24 18:16:37

Uber cool dropping procedure here
Mine pretty much does that except generates DTM's itself and yours probably has a few flaws. The most notable to me is that your dropping procedure will only drop one of each ident as you only run it once. Would probably be better to have it run through all items (i->28) and have a boolean array that gets toggled if it finds one of them and make it not drop based on that.