SRL Archive - SRL Archives

Inventory functions


jhildy

2007-07-10 02:08:26

I didnt see these functions they might have some but i didnt see any
//Uses item in inventory spot 1 with item in inventory spot 2
Procedure UseItems(inv1,inv2: integer);
begin
if existsitem(inv1) and existsitem(inv2) then
begin
UseItem(inv1);
Wait(100+random(50));
UseItem(inv2);
end else;
Writeln('Theres nothing in one of the inventory spots');
end;
// uses dtm1 with dtm2
Procedure UseItemsDTM(Dtm1,Dtm2: integer);
begin
if FindDTM(DTM1,X,Y,MIX1,MIY1,MIX2,MIY2) and
FindDTM(DTM2,X,Y,MIX1,MIY1,MIX2,MIY2) then
begin
FindDTM(DTM1,X,Y,MIX1,MIY1,MIX2,MIY2);
Mouse(x,y,3,3,true);
FindDTM(DTM1,X,Y,MIX1,MIY1,MIX2,MIY2);
Mouse(x,y,3,3,true);
end else;
writeln('Cannot find DTMs');
end;

and here are some inventory mouse clicking functions that use Tbox insted of coordinates.
Function InvTbox(i: integer): Tbox;
begin
row := ceil(i div 4);
col :=i mod 4
if (col < 0) then
begin
col := 4;
end;
Result.x1:=569+(42*(col-1));
Result.y1:=213+(36*(row-1));
Result.x2:=600+(42*(col-1));
Result.y2:=244+(36*(row-1));
end;

Procedure MMouseItemBox(i: integer);
var Box: Tbox;
begin
Box:=InvTbox(i);
x:=RandomRange(Box.X1,Box.X2);
y:=RandomRange(Box.Y1,Box.Y2);
MMouse(x,y,0,0);
end;

Procedure MouseItemBox(i: integer;Left: boolean);
var Box: Tbox;
begin
Box:=InvTbox(i);
x:=RandomRange(Box.X1,Box.X2);
y:=RandomRange(Box.Y1,Box.Y2);
Mouse(x,y,0,0,Left);
end;
//by lorax made with InvBox
procedure DropItemBox(i: Integer);
begin
GameTab(4);
if ExistsItem(i) then
begin
MouseItemBox(i, False);
Wait(50 + Random(100));
if ChooseOption(x, y, 'Drop') then
Wait(200 + Random(100));
end;
end;
//By lorax with InvBox
Procedure DropAllBox;
begin
for i:=1 to 28 do
Dropitembox(i);
end;
//by sdcit made with invbox
procedure DropTobox(x, y: Integer);
var
todr: Integer;
begin
for todr := x to y do
DropItembox(todr)
end;
//By RSN with Invbox
procedure DragItembox(inv1, inv2: Integer);
var
x, y: Integer;
begin
MMouseItemBox(Inv1);
GetMousePos(x, y);
HoldMouse(x, y, True);
Wait(150 + Random(50));
MMouseItembox(Inv2);
GetMousePos(x, y);
ReleaseMouse(x, y, True);
Wait(100 + Random(100));
MMouse(x, y, 2, 2)
end;

can someone explain what mod does because i discovered that that worked by accident and i would like to know what it actually does.

Miitchyy

2007-07-12 09:42:36

Mod = Remainder of a division sum.
Eg. 5 Mod 2 Returns 1, 10 Mod 4 returns 2.

Nice Functions btw, I like the idea of using DTM's incase you didnt know where an item is, although if there was more then 1 it might cause problems :P

Also, Shouldnt it be if (col = 0) then not if (col < 0) then?
And there shouldnt be a semicolon after and else statement or it will void it and the script will do whatever is after it anyway(I think)

Actually, I really really really like the idea of TBoxes o_O Nice Job

Oh, I didnt know there was ceil in Scar, is there Floor aswell?
^I feel stupid :P
Woah theres div too

Santa_Clause

2007-07-12 10:00:52

So, I guess Mod divides by the highest divisible integer it can, and then returns the remainder?

10 Mod 5 would return 0?

shaunthasheep

2007-07-12 10:39:01

From: SantaClause
So, I guess Mod divides by the highest divisible integer it can, and then returns the remainder?

10 Mod 5 would return 0?


yes. 10 mod 7 = 3, etc
also, good work on the functions!

Jagex_Fagex

2007-07-12 10:56:13

im pretty sure that(from the quick look i took) we have something similar.. Inventory.scar

jhildy

2007-07-12 11:33:29

nothing that uses a tbox the mmouseitem kind of does it but it uses a random(7) integer this clicks anywhere possible and i havnt got any feedback for like 4 days then in 1 day i get a bunch of feedback. yes i figured out what mod does.

Jagex_Fagex

2007-07-12 11:50:28

kk, np. i havent really looked closely through srl since i got back.

n3ss3s

2007-07-18 09:41:39

Good joob, useful functions.

jhildy

2007-07-18 16:53:25

Thanks