SRL Archive - OSR Help

Help with my First script - any help is appreciated :)


h4x_

2012-04-29 11:34:23

Been following YoHoJo's youtube tutorials, except making a script that mines copper in lumbridge mine.

im sorta stuck with a dropping method does want to compile at
"MouseItem(OrePatter,False);":

Procedure DropOres;
var
x, y, OreDTM, I : Integer;
SlotBox : Tbox;
OrePattern : TIntegerArray;
begin

OreDTM := DTMFromString('mKgEAAHic42NgYPBhYmDwYoLQgUAcDsQRQBwNxMFQOTsgtoFiJyB2BWJuIJYEYmEgFgJiQSDmAmIWIGYE4r+MDAxsUHWCUDViQLw7xxpoKxMGNlBQwCqOwOQBRjIxKgAAQyYIBQ==');
OrePattern:=[1,5,9,13,17,21,25,2,6,10,14,18,22,26,3,7,11,15,19,23,27,4,8,12,16,20,28];

For I:=0 to 27 Do
Begin
SlotBox:=InvBox(OrePattern[I]);
If FindDTM(OreDTM,x,y,SlotBox.X1,SlotBox.Y1, SlotBox.X2, SlotBox.Y2)
Then
Begin
MouseItem(OrePattern[I],False);
ChooseOption('Dro');
end;
end;

end;

It says its a type mismatch, but im sure im doing it right? :s

thanks in advance for any help (and to YoHoJo for making the Tut's)

putonajonny

2012-04-29 11:44:48

Procedure DropOres;
var
x, y, OreDTM, I : Integer;
SlotBox : Tbox;
OrePattern : TIntegerArray;
begin

OreDTM := DTMFromString('mKgEAAHic42NgYPBhYmDwYoLQgUAcDsQRQBwNxMFQOTsgtoFiJyB2BWJuIJYEYmEgFgJiQSDmAmIWIGYE4r+MDAxsUHWCUDViQLw7xxpoKxMGNlBQwCqOwOQBRjIxKgAAQyYIBQ==');
OrePattern:=[1,5,9,13,17,21,25,2,6,10,14,18,22,26,3,7,11,15,19,23,27,4,8,12,16,20,28];

For I:=0 to 27 Do
Begin
SlotBox:=InvBox(OrePattern[I]);
If FindDTM(OreDTM,x,y,SlotBox.X1,SlotBox.Y1, SlotBox.X2, SlotBox.Y2)
Then
Begin
MouseItem(OrePattern[I],mouse_Left); //This line :) since SRL5 integers are used for mouse buttons not booleans
ChooseOption('Dro'); //WaitOption is more reliable
end;
end;

//Free that DTM!!! :P

end;

Imanoobbot

2012-04-29 11:48:58


procedure DropItemAll(i:integer);
begin
if ExistsItem(i) then
begin
MouseItem(i, mouse_Right);
if (WaitOptionEx('rop', 'action', ClickLeft, 250)) then
Wait(RandomRange(20, 50));
end;
end;

procedure DropEverythingExcept(SkipArr : TIntegerArray);
var
startI,CurrI : Integer;
begin
For StartI := 1 to 4 do
begin
CurrI := StartI;
while CurrI <= 28 do
begin
if not InIntArray(SkipArr,CurrI) then
DropItem(CurrI);
CurrI := CurrI + 4;
end;
end;
end;


This should drop everything (gems too lol) out of your invintory. It won´t drop from the first invintory slot so you can put your pickaxe in there if you can´t wear it due to low attack lvl.

h4x_

2012-04-29 11:58:50

From: putonajonny
Procedure DropOres;
var
x, y, OreDTM, I : Integer;
SlotBox : Tbox;
OrePattern : TIntegerArray;
begin

OreDTM := DTMFromString('mKgEAAHic42NgYPBhYmDwYoLQgUAcDsQRQBwNxMFQOTsgtoFiJyB2BWJuIJYEYmEgFgJiQSDmAmIWIGYE4r+MDAxsUHWCUDViQLw7xxpoKxMGNlBQwCqOwOQBRjIxKgAAQyYIBQ==');
OrePattern:=[1,5,9,13,17,21,25,2,6,10,14,18,22,26,3,7,11,15,19,23,27,4,8,12,16,20,28];

For I:=0 to 27 Do
Begin
SlotBox:=InvBox(OrePattern[I]);
If FindDTM(OreDTM,x,y,SlotBox.X1,SlotBox.Y1, SlotBox.X2, SlotBox.Y2)
Then
Begin
MouseItem(OrePattern[I],mouse_Left); //This line :) since SRL5 integers are used for mouse buttons not booleans
ChooseOption('Dro'); //WaitOption is more reliable
end;
end;

//Free that DTM!!! :P

end;


Thanks! now just to find out how to "Free that DTM" ….. lol

putonajonny

2012-04-29 12:02:44

From: h4x_
Thanks! now just to find out how to "Free that DTM" ….. lol


This will help: http://villavu.com/forum/showthread.php?t=68018

h4x_

2012-04-29 12:26:12

Nearly there, thanks btw

Procedure DropOres;
var
x, y, OreDTM, I : Integer;
SlotBox : Tbox;
OrePattern : TIntegerArray;
begin

OreDTM := DTMFromString('m1gAAAHic42JgYMhmYmCIBeIsIK4G4nIgzgHiIiCuAuIkII4HYjZGBgZuIP4J1MMIpAWAWBSIfzNA5EB8ZiCeF20IFGEiiI0YsAMjNMxIJEYAAIbmCOg=');
OrePattern:=[1,5,9,13,17,21,25,2,6,10,14,18,22,26,3,7,11,15,19,23,27,4,8,12,16,20,28];
For I:=0 to 27 Do
Begin
SlotBox:=InvBox(OrePattern[I]);
If FindDTM(OreDTM,x,y,SlotBox.X1,SlotBox.Y1, SlotBox.X2, SlotBox.Y2)
Then
Begin
MouseItem(OrePattern[I],2);
WaitOption('Drop', 500);
end;

FreeDTM(OreDTM);
end;

end;

thats how far ive got, i just keep getting this error?

"Error: Exception: The given DTM Index[2] doesn't exist at line 128
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap]"

Imanoobbot

2012-04-29 12:31:08

From: h4x_
Nearly there, thanks btw

Procedure DropOres;
var
x, y, OreDTM, I : Integer;
SlotBox : Tbox;
OrePattern : TIntegerArray;
begin

OreDTM := DTMFromString('m1gAAAHic42JgYMhmYmCIBeIsIK4G4nIgzgHiIiCuAuIkII4HYjZGBgZuIP4J1MMIpAWAWBSIfzNA5EB8ZiCeF20IFGEiiI0YsAMjNMxIJEYAAIbmCOg=');
OrePattern:=[1,5,9,13,17,21,25,2,6,10,14,18,22,26,3,7,11,15,19,23,27,4,8,12,16,20,28];
For I:=0 to 27 Do
Begin
SlotBox:=InvBox(OrePattern[I]);
If FindDTM(OreDTM,x,y,SlotBox.X1,SlotBox.Y1, SlotBox.X2, SlotBox.Y2)
Then
Begin
MouseItem(OrePattern[I],2);
WaitOption('Drop', 500);
end;

FreeDTM(OreDTM);
end;

end;

thats how far ive got, i just keep getting this error?

"Error: Exception: The given DTM Index[2] doesn't exist at line 128
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap]"


Is it working so can you use it and the error is in the debug box after shutting down the script or is it not working?

Rich

2012-04-29 12:33:25

Wrong section bro. This is for tuts.

h4x_

2012-04-29 12:37:43

From: Rich
Wrong section bro. This is for tuts.

Sorry is there anyway someone can move it?
From: Imanoobbot
Is it working so can you use it and the error is in the debug box after shutting down the script or is it not working?


the script runs, hovers over the ore as if it is just about to rightclick/drop, but instead it stopped and i get the error

putonajonny

2012-04-29 12:46:50

Which line is line 128?

Edit:

Procedure DropOres;
var
x, y, OreDTM, I : Integer;
SlotBox : Tbox;
OrePattern : TIntegerArray;
begin

OreDTM := DTMFromString('m1gAAAHic42JgYMhmYmCIBeIsIK4G4nIgzgHiIiCuAuIkII4HYjZGBgZuIP4J1MMIpAWAWBSIfzNA5EB8ZiCeF20IFGEiiI0YsAMjNMxIJEYAAIbmCOg=');
OrePattern:=[1,5,9,13,17,21,25,2,6,10,14,18,22,26,3,7,11,15,19,23,27,4,8,12,16,20,28];
For I := 0 to 27 Do
Begin
SlotBox:=InvBox(OrePattern[I]);
If FindDTM(OreDTM,x,y,SlotBox.X1,SlotBox.Y1, SlotBox.X2, SlotBox.Y2) then
Begin
MouseItem(OrePattern[I],2);
WaitOption('Drop', 500);
end;
end;
FreeDTM(OreDTM); //Move this to outside of the loop :)

end;

Also don't worry about it being in the wrong section, everybody makes mistakes, an admin will come across it and move it

h4x_

2012-04-29 12:47:44

From: putonajonny
Which line is line 128?


128: If FindDTM(OreDTM,x,y,SlotBox.X1,SlotBox.Y1, SlotBox.X2, SlotBox.Y2)

putonajonny

2012-04-29 13:25:36

From: h4x_
128: If FindDTM(OreDTM,x,y,SlotBox.X1,SlotBox.Y1, SlotBox.X2, SlotBox.Y2)


See edited post above :)

h4x_

2012-04-29 13:47:28

From: putonajonny
See edited post above :)


Thanks for the help, but i still get the same error… very strange

Rich

2012-04-29 13:57:09

From: h4x_
Sorry is there anyway someone can move it?

No need to be sorry. Just pointing out so you don't make the same mistake in the future :)