SRL Archive - SRL Archives

DepositAllButThis & DepositAllButThese


shaunthasheep

2007-06-21 10:19:29

These functions will make banking easier! No more Deposit(2, 28, 2) blah because you don't want to deposit your pickaxe, now here is a better way!!!!

With DepositAllButThis & DepositAllButThese, you can make depositing your stuff in the bank perfect and all in one line!

Usages:
DepositAllButThis(yourbmp);
DepositAllButThese([array, of, your, bmps]);

program DepositAllBut;
{.include SRL/SRL.scar}
var
theitem, theitem2, theitem3 : integer;

procedure LoadItemBmp;
begin

//currentely a bucket
theitem := BitmapFromString(6, 11, 'z78DA7DCF490E03310804C02F0DD02' +
'C3E7AFDFF9362052B9A2CCAA50ED0803042A362A9617D78EFFECD' +
'688192A1492506095F532ACF97CA7115EFA6527D596C5983FAB7C' +
'156A587DB9275DC59D07138C06FF5ACA4CB0D48BDB9F85B252DE2' +
'014DCF9EEC96B87CFD30AFE4AC7ADBB3FB831D1F41286585A0056' +
'CC8CCE4D91F3EE0D9AD1C8A9E5FDF2F9ECC734F4538E603072157' +
'05');
//currentely tin
theitem2 := BitmapFromString(5, 4, '8E84849086868D838389807F857C7C9' +
'28888948A8A9086868D8383000001968C8B988D8D928888000001' +
'211E1E9A8F8E9B91900000012523233E3939');
//currentely copper
theitem3 := BitmapFromString(4, 5, 'E1833AE1833ADC8039D87D37E5853CE' +
'8863CE3833ADF813AEC893EEC893EE8863C000001F18D44F18D44' +
'0000013A210EF29453000001000001472812');

end;

{*********************************************************************
function ExistsInIntArray(number : integer; intarray : Array of integer) : boolean;
By: The_Rs_Monkey
Checks to see if a number exists in an array of integer.
*********************************************************************}
function ExistsInIntArray(number : integer; intarray : Array of integer) : boolean;
var
e : integer;
begin
for e := 0 to GetArrayLength(intarray) - 1 do
begin
if intarray[e] = number then
begin
Result := True;
Exit;
end;
end;
end;

{*********************************************************************
procedure DepositAllButThis(item : integer);
By: The_Rs_Monkey
Deposits everything in the inventory except an item (represents by a bmp);
*********************************************************************}
procedure DepositAllButThis(item : integer);
var
Spots : Array Of Integer;
e, i, Mx, My : integer;
begin
GameTab(4);
for e := 0 to 6 do
begin
for i := 0 to 3 do
begin
Mx := (561 + (i * 43));
My := (208 + (e * 37));
if (FindBitmapIn(item, x, y, Mx, My, Mx + 40, My + 35)) then
begin
SetArrayLength(Spots, GetArrayLength(Spots) + 1);
Spots[GetArrayLength(Spots) - 1] := e * 4 + i + 1;
end;
end;
end;

for i := 1 to 28 do
begin
if Not ExistsInIntArray(i, Spots) then
if ExistsItem(i) then
Deposit(i, i, 2);
end;
end;

{*********************************************************************
procedure DepositAllButThese(item : array of integer);
By: The_Rs_Monkey
Usage: DepositAllButThese([bmp1, bmp2, bmp3, bmp4]);
Deposits everything in the inventory except these item (represents by an array of bmp);
*********************************************************************}
procedure DepositAllButThese(item : array of integer);
var
Spots : Array Of Integer;
e, i, q, Mx, My : integer;
begin
GameTab(4);
if GetArrayLength(item) = 0 then Exit;
for e := 0 to 6 do
begin
for i := 0 to 3 do
begin
Mx := (561 + (i * 43));
My := (208 + (e * 37));
for q := 0 to GetArrayLength(item) - 1 do
begin
if (FindBitmapIn(item[q], x, y, Mx, My, Mx + 40, My + 35)) then
begin
SetArrayLength(Spots, GetArrayLength(Spots) + 1);
Spots[GetArrayLength(Spots) - 1] := e * 4 + i + 1;
Break;
end;
end;
end;
end;

for i := 1 to 28 do
begin
if Not ExistsInIntArray(i, Spots) then
if ExistsItem(i) then
Deposit(i, i, 2);
end;
end;

begin
ClearDebug;
SetUpSrl;
ActivateClient;
Wait(2000);
LoadItemBmp;
//DepositAllButThis(theitem);
DepositAllButThese([theitem, theitem2, theitem3]);
end.

EDIT: BTW, Inventorycount checks a non existing inventory column, see function InventoryCount, line 228 in inventory.scar, line is: for i := 0 to 4 do (0, 1, 2, 3, 4)<-THATS 5 COLUMNS, Needs to be changed too for i := 0 to 3
EDIT: scroll down for Bmp Tolerance & DTM version

Bobarkinator

2007-06-21 10:26:09

Good work !!!

Secet

2007-06-21 10:56:23

Wouldn't DTM be better than bitmap?

shaunthasheep

2007-06-21 10:57:34

havn't tested these, but they should work. Added tolerance. I don't know if i should make a set for DTMS

{*********************************************************************
procedure DepositAllButThisTol(item, tol : integer);
By: The_Rs_Monkey
Deposits everything in the inventory except an item (represents by a bmp) at a certain tolerance;
*********************************************************************}
procedure DepositAllButThisTol(item, tol : integer);
var
Spots : Array Of Integer;
e, i, Mx, My : integer;
begin
GameTab(4);
for e := 0 to 6 do
begin
for i := 0 to 3 do
begin
Mx := (561 + (i * 43));
My := (208 + (e * 37));
if (FindBitmapToleranceIn(item, x, y, Mx, My, Mx + 40, My + 35, tol)) then
begin
SetArrayLength(Spots, GetArrayLength(Spots) + 1);
Spots[GetArrayLength(Spots) - 1] := e * 4 + i + 1;
end;
end;
end;

for i := 1 to 28 do
begin
if Not ExistsInIntArray(i, Spots) then
if ExistsItem(i) then
Deposit(i, i, 2);
end;
end;

{*********************************************************************
procedure DepositAllButTheseTol(item : array of integer; tol : integer);
By: The_Rs_Monkey
Usage: DepositAllButThese([bmp1, bmp2, bmp3, bmp4]);
Deposits everything in the inventory except these item (represents by an array of bmp) at a certain tolerance
*********************************************************************}
procedure DepositAllButTheseTol(item : array of integer; tol : integer);
var
Spots : Array Of Integer;
e, i, q, Mx, My : integer;
begin
GameTab(4);
if GetArrayLength(item) = 0 then Exit;
for e := 0 to 6 do
begin
for i := 0 to 3 do
begin
Mx := (561 + (i * 43));
My := (208 + (e * 37));
for q := 0 to GetArrayLength(item) - 1 do
begin
if (FindBitmapToleranceIn(item[q], x, y, Mx, My, Mx + 40, My + 35, tol)) then
begin
SetArrayLength(Spots, GetArrayLength(Spots) + 1);
Spots[GetArrayLength(Spots) - 1] := e * 4 + i + 1;
Break;
end;
end;
end;
end;

for i := 1 to 28 do
begin
if Not ExistsInIntArray(i, Spots) then
if ExistsItem(i) then
Deposit(i, i, 2);
end;
end;

EDIT: just saw secets post, ill edit it for DTMS i guess, and bitmaps work fine.
EDIT: Secet, these should work just fine:

{*********************************************************************
procedure DepositAllButThisDTM(item : integer);
By: The_Rs_Monkey
Deposits everything in the inventory except an item (represents by a DTM);
*********************************************************************}
procedure DepositAllButThisDTM(item : integer);
var
Spots : Array Of Integer;
e, i, Mx, My : integer;
begin
GameTab(4);
for e := 0 to 6 do
begin
for i := 0 to 3 do
begin
Mx := (561 + (i * 43));
My := (208 + (e * 37));
if (FindDTM(item, x, y, Mx, My, Mx + 40, My + 35)) then
begin
SetArrayLength(Spots, GetArrayLength(Spots) + 1);
Spots[GetArrayLength(Spots) - 1] := e * 4 + i + 1;
end;
end;
end;

for i := 1 to 28 do
begin
if Not ExistsInIntArray(i, Spots) then
if ExistsItem(i) then
Deposit(i, i, 2);
end;
end;

{*********************************************************************
procedure DepositAllButTheseDTM(item : array of integer);
By: The_Rs_Monkey
Usage: DepositAllButThese([bmp1, bmp2, bmp3, bmp4]);
Deposits everything in the inventory except these item (represents by an array of DTMs);
*********************************************************************}
procedure DepositAllButTheseDTM(item : array of integer);
var
Spots : Array Of Integer;
e, i, q, Mx, My : integer;
begin
GameTab(4);
if GetArrayLength(item) = 0 then Exit;
for e := 0 to 6 do
begin
for i := 0 to 3 do
begin
Mx := (561 + (i * 43));
My := (208 + (e * 37));
for q := 0 to GetArrayLength(item) - 1 do
begin
if (FindDTM(item[q], x, y, Mx, My, Mx + 40, My + 35)) then
begin
SetArrayLength(Spots, GetArrayLength(Spots) + 1);
Spots[GetArrayLength(Spots) - 1] := e * 4 + i + 1;
Break;
end;
end;
end;
end;

for i := 1 to 28 do
begin
if Not ExistsInIntArray(i, Spots) then
if ExistsItem(i) then
Deposit(i, i, 2);
end;
end;

EDIT: DepositAllBut****Tol works.
EDIT: DepositAllBut****DTM works!

~alex~

2007-06-21 12:42:32

Nice functions I was thinking of making something like this..

WhiteShadow

2007-06-21 16:33:44

Here's mine, from an old depreciated thread.. "{

procedure DepositAllExcept(TheDTM : Integer);
var
f : TPoint;
i : Integer;
begin
if(not(BankScreen))then
Exit;
for i:= 1 to 28 do
begin
f:= ItemCoords(i);
if (not(FindDTM(TheDTM, x, y, f.x - 25, f.y - 25, f.x + 25,f.y + 25)))and
(ExistsItem(i)) then
begin
Mouse(f.x, f.y, 5, 5, false);
Wait(200 + random(100));
ChooseOption(x, y, 'All');
end;
end;
end;

Yours is much cooler, however.. :stirthepot:

Cool functions!:)

shaunthasheep

2007-06-21 17:12:42

From: WhiteShadow
Here's mine, from an old depreciated thread.. "{

procedure DepositAllExcept(TheDTM : Integer);
var
f : TPoint;
i : Integer;
begin
if(not(BankScreen))then
Exit;
for i:= 1 to 28 do
begin
f:= ItemCoords(i);
if (not(FindDTM(TheDTM, x, y, f.x - 25, f.y - 25, f.x + 25,f.y + 25)))and
(ExistsItem(i)) then
begin
Mouse(f.x, f.y, 5, 5, false);
Wait(200 + random(100));
ChooseOption(x, y, 'All');
end;
end;
end;

Yours is much cooler, however.. :stirthepot:

Cool functions!:)


Hmm, srry, i didn't know you made a function like this, I probally wasn't active when you posted it =S

but thanks for the comments, and I hope this can be added to SRL, I could use it in every banking script i make.

Santa_Clause

2007-06-22 01:34:21

Lol…this is nice…very nice…

However, every banking script you make…you only made one…:p

*No hard feelings, I'm just kidding*

Drakan

2007-06-22 13:36:50

well dtms only look for shape right? if your trying to deposit one type of rune and not the other than DTMs wouldnt work. so thats why bmps are a good idea :). please correct me if im wrong

shaunthasheep

2007-06-22 13:42:01

From: SantaClause
Lol…this is nice…very nice…

However, every banking script you make…you only made one…:p

*No hard feelings, I'm just kidding*


make, not made :P

From: drags111
well dtms only look for shape right? if your trying to deposit one type of rune and not the other than DTMs wouldnt work. so thats why bmps are a good idea :). please correct me if im wrong


Dtms are points, not shape, as long as you pick the right points, the DTM's would work. But i made 3 versions: Bmp, Bmp Tol, And DTM's. So No worry's.

Santa_Clause

2007-06-22 20:04:44

Meh, your sense of humour is what I like…;)

Abyssal

2007-06-24 21:56:53

I like it, it's cool.

Obviously good for banking, lol.

Doofy

2007-06-26 15:47:40

This is real sick. I was gunna try and make one yesterday but I didn't….. Anyways, great work, this is really useful and should be implememnted into SRL.

EDIT:

I just created a procedure that stores everything from the inv into the bank except axes using DepositAllButTheseDTM. Check it out.