SRL Archive - OSR Help

FasterDropping


Imanoobbot

2012-03-26 06:22:35

Hey guys,
I am currently writing an IronMiner script. It is pretty good so far. It already waits until the rock is mined and got a simply but nice Autocolor function. The thing makes me feeel really bad about my script at the moment is the style how it dropes. It currently looks like this:

procedure DropOre;
var
x, y, IronOre: Integer;

begin
IronOre := DTMFromString('mbQAAAHicY2VgYPjIxMDwH4o/APF3INZmZGBQYYTQ1kBsCsSGsqJA1UwoWIQBEzBiwWAAAEEdBlk=');
repeat
If FindDTM(IronOre, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
Mouse(x, y, 2, 2, false);
WaitOption('Drop', randomrange(100, 200));
Wait(random(50));
end;
until(not(FindDTM(IronOre, x, y, MIX1, MIY1, MIX2, MIY2)))
FreeDTM(IronOre);
end;

It is mostly all the timing clicking the "drop" option of the Iron-ores in my invitory twice and then it goes to the next. I already tried to change the time of Waiting and others but it don´t seems to help. Would be nice if someone got an Idea how to make it faster.

Frement

2012-03-26 06:26:03

From 1 to 28, convert that to inventory slot coordinates (There is a function in SRL that should let you do this), and when you go through each slot, it should drop quite efficiently. Look for the functions in Inventory.scar (or .simba?)

EDIT: And add an additional check to see if the contents of that slot is what you want them to be (your DTM).

m34tcode

2012-03-26 06:33:22

What i do, is i create an array of 28 boolean values, one for each inventory slot. I then go and check every inventory slot to see whather it qualifies, for dropping using eating etc.

If it qualifies I set the appropriate value in the Boolean array to true.

If you only have ores in slots 3,4, and 5 then only indices 2,3,and 4 will be true, since they indices start at 0.

There will be a small period of time were it is searching which spots are droppeable and setting up the array, but it is very fast and accurate afterwards.

Nexz

2012-03-26 06:36:28

I use the function InvBox.

Imanoobbot

2012-03-26 06:43:11

Very good tips and thank you all for fast response. Will try to add this into the Dropping process but it´s quite hard for me cause i am at the really beginning. Will give my best ;)

Frement

2012-03-26 06:56:36

I think something like this should work:
procedure DropOre;
var x, y, IronOre: Integer;
CurrentBox: TBox;
begin
IronOre := DTMFromString('mbQAAAHicY2VgYPjIxMDwH4o/APF3INZmZGBQYYTQ1kBsCsSGsqJA1UwoWIQBEzBiwWAAAEEdBlk=');
if (InvEmpty) then
exit;
for (I := 0; I < 28; I++) do begin
CurrentBox := InvBox(I);
if (FindDTM(IronOre, x, y, CurrentBox.x1, CurrentBox.y1, CurrentBox.x2, CurrentBox.y2)) then
DropItem(I);
end;
end;

Imanoobbot

2012-03-26 07:03:37

From: Frement
I think something like this should work:
procedure DropOre;
var x, y, IronOre: Integer;
CurrentBox: TBox;
begin
IronOre := DTMFromString('mbQAAAHicY2VgYPjIxMDwH4o/APF3INZmZGBQYYTQ1kBsCsSGsqJA1UwoWIQBEzBiwWAAAEEdBlk=');
if (InvEmpty) then
exit;
for (I := 0; I < 28; I++) do begin
CurrentBox := InvBox(I);
if (FindDTM(IronOre, x, y, CurrentBox.x1, CurrentBox.y1, CurrentBox.x2, CurrentBox.y2)) then
DropItem(I);
end;
end;


Seems that something with the identifier wont work. Got a compiling errormessage. Set I to the integer vars but still got this error.

Frement

2012-03-26 07:09:00

From: Imanoobbot
Seems that something with the identifier wont work. Got a compiling errormessage. Set I to the integer vars but still got this error.


Yeah, haven't scripted in a long long time.

procedure DropOre;
var x, y, IronOre, I: Integer;
CurrentBox: TBox;
begin
IronOre := DTMFromString('mbQAAAHicY2VgYPjIxMDwH4o/APF3INZmZGBQYYTQ1kBsCsSGsqJA1UwoWIQBEzBiwWAAAEEdBlk=');
if (InvEmpty) then
exit;
for I := 1 to 28 do begin
CurrentBox := InvBox(I);
if (FindDTM(IronOre, x, y, CurrentBox.x1, CurrentBox.y1, CurrentBox.x2, CurrentBox.y2)) then
DropItem(I);
end;
end;

Other programming languages seem to have gotten hold of me :(

Tickyy

2012-03-26 07:13:43

From: Frement

Other programming languages seem to have gotten hold of me :(


Looks like C++ :p.

Imanoobbot

2012-03-26 07:19:21

From: Frement
Yeah, haven't scripted in a long long time.

procedure DropOre;
var x, y, IronOre, I: Integer;
CurrentBox: TBox;
begin
IronOre := DTMFromString('mbQAAAHicY2VgYPjIxMDwH4o/APF3INZmZGBQYYTQ1kBsCsSGsqJA1UwoWIQBEzBiwWAAAEEdBlk=');
if (InvEmpty) then
exit;
for I := 1 to 28 do begin
CurrentBox := InvBox(I);
if (FindDTM(IronOre, x, y, CurrentBox.x1, CurrentBox.y1, CurrentBox.x2, CurrentBox.y2)) then
DropItem(I);
end;
end;

Other programming languages seem to have gotten hold of me :(


Looks very nice so far because it is just clicking the rocks 1 time anymore! Will look for a simulation of mousekeys.

Frement

2012-03-26 07:28:41

From: Tickyy
Looks like C++ :p.


C/C++/PHP/TCL/Java and so on.

From: Imanoobbot
Looks very nice so far because it is just clicking the rocks 1 time anymore! Will look for a simulation of mousekeys.


Cool, glad its working :)

Imanoobbot

2012-03-26 07:41:42

From: Frement
C/C++/PHP/TCL/Java and so on.



Cool, glad its working :)


+1 Reputation ;)

Kyle Undefined

2012-03-26 09:54:41

The DropAll method in SRL adds a more randomized dropping ;) However, that should work just fine, good job! :)

Ibotlots8D

2012-03-26 10:25:18

What you can also do is this -


procedure Drop;
var
i:Integer;
begin
for i := 1 to 28 do
begin
if ExistsItem(i) then //checks if item exists
begin
MouseItem(i,0); //right clicks the item
WaitOption('rop',750); //waits for the option
Wait(750); //give time for the item to drop
end;
end;
end;

Imanoobbot

2012-03-26 10:28:42

From: Ibotlots8D
What you can also do is this -


procedure Drop;
var
i:Integer;
begin
for i := 1 to 28 do
begin
if ExistsItem(i) then //checks if item exists
begin
MouseItem(i,0); //right clicks the item
WaitOption('rop',750); //waits for the option
Wait(750); //give time for the item to drop
end;
end;
end;


I already made it quite flawless. Looking for a MouseKeySimulation right now. Saw that in a video.

Ibotlots8D

2012-03-26 10:30:54

From: Imanoobbot
I already made it quite flawless. Looking for a MouseKeySimulation right now. Saw that in a video.


Alright but you do realize that MouseKeys are nothing more than really fast MouseSpeeds xD

Kyle Undefined

2012-03-26 10:34:09

YoHoJo has some mousekey dropping, he showed me the code, but I don't remember it :p

Imanoobbot

2012-03-26 21:59:12

From: Kyle Undefined
YoHoJo has some mousekey dropping, he showed me the code, but I don't remember it :p


Found it and put it into my script. :D

Frement

2012-03-27 07:07:43

From: Ibotlots8D
What you can also do is this -


procedure Drop;
var
i:Integer;
begin
for i := 1 to 28 do
begin
if ExistsItem(i) then //checks if item exists
begin
MouseItem(i,0); //right clicks the item
WaitOption('rop',750); //waits for the option
Wait(750); //give time for the item to drop
end;
end;
end;


Now as that is completely working code, it would also drop pickaxes, diamonds, etc.

Ibotlots8D

2012-03-27 09:55:43

From: Frement
Now as that is completely working code, it would also drop pickaxes, diamonds, etc.


Hello, i'm not sure if i'm being trolled or not so i'll answer this question in full seriousness :)

If it's for skiller support, we can do this -

procedure Drop;
var
i,Value:Integer;
Skiller:Boolean;
begin
Skiller := True;
if Skiller then
Value := 27 else Value := 28;

for i := 1 to Value do
begin
MouseItem(i,3); //moves mouse to item
if IsUptext('ron') then //checks for uptext
begin
ClickMouse2(False); //right clicks
WaitOption('rop',750); //chooses
Wait(750 + random(50));
end;
end;
end;

Frement

2012-03-27 10:06:07

From: Ibotlots8D
Hello, i'm not sure if i'm being trolled or not so i'll answer this question in full seriousness :)

If it's for skiller support, we can do this -

procedure Drop;
var
i,Value:Integer;
Skiller:Boolean;
begin
Skiller := True;
if Skiller then
Value := 27 else Value := 28;

for i := 1 to Value do
begin
MouseItem(i,3); //moves mouse to item
if IsUptext('ron') then //checks for uptext
begin
ClickMouse2(False); //right clicks
WaitOption('rop',750); //chooses
Wait(750 + random(50));
end;
end;
end;


This would leave the last slot not to be dropped, pickaxes are usually in the first slot, so it is better to use a DTM that would detect all the pickaxes (Or bitmap mask would be more better in this case), or all the diamonds.

Ibotlots8D

2012-03-27 10:14:39

From: Frement
This would leave the last slot not to be dropped, pickaxes are usually in the first slot, so it is better to use a DTM that would detect all the pickaxes (Or bitmap mask would be more better in this case), or all the diamonds.


Haha true, but that can be changed easily :p
if Skiller then    
Value := 2 else Value := 1;
for i := Value to 28 do

:p

Kyle Undefined

2012-03-27 10:18:11

Here's how I do it in my Shilo Script :) It's a stripped down example.


program new;
{$i srl/srl.simba}

const
BOOL_PICK = 0;
{
Many booleans between these two
}
BOOL_GEMBAG = 5;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := ''; // Your RuneScape Account Name
Pass := ''; // Your RuneScape Account Password
Pin := ''; // Your RuneScape Bank Pin
Active := True; // Use in the Script. True / False.
Integers[0] := 999; // How many Loads to do
Booleans[BOOL_PICK] := False; // Pickaxe in Inventory
Booleans[BOOL_GEMBAG] := False; // Use Gem Bag
end;
end;

procedure Drop;
var
i : Integer;
begin
if(Players[CurrentPlayer].Booleans[BOOL_PICK])then
Inc(i);
if(Players[CurrentPlayer].Booleans[BOOL_GEMBAG])then
Inc(i);
{
I do it this way so I can add many items in the inventory and not have to
worry about remaking the droping procedure
}
for i := i + 1 to 28 do
begin
if(ExistsItem(i))then //checks if item exists
begin
MouseItem(i, mouse_Right); //right clicks the item
WaitOption('rop',750); //waits for the option
Wait(750); //give time for the item to drop
end;
end;
end;

begin
SetupSRL();
DeclarePlayers();
Drop();
end.

Frement

2012-03-27 10:19:00

From: Ibotlots8D
Haha true, but that can be changed easily :p
if Skiller then    
Value := 2 else Value := 1;
for i := Value to 28 do

:p


True, but using a bitmap mask or a DTM will allow any slot to become available for pickaxe/axe/etc.

Ibotlots8D

2012-03-27 10:19:00

Yayaya, it's the same as mine xD

E*
From: Frement
True, but using a bitmap mask or a DTM will allow any slot to become available for pickaxe/axe/etc.


True that, but why would they have a pick in the middle of their invy?
It just slows the script down o.O

E2*
I just realized, my fix would work for the pick being in any slot since it checks for the uptext of the iron ore LOL.

Kyle Undefined

2012-03-27 10:21:59

From: Ibotlots8D
Yayaya, it's the same as mine xD

E*


True that, but why would they have a pick in the middle of their invy?
It just slows the script down o.O

E2*
I just realized, my fix would work for the pick being in any slot since it checks for the uptext of the iron ore LOL.


But mousing over your pick every time you go to drop isn't a very good thing to do.

Ibotlots8D

2012-03-27 10:24:30

From: Kyle Undefined
But mousing over your pick every time you go to drop isn't a very good thing to do.


Yupyup, that's true, is there a way to skip over a certain number in a for..to..do loop?

Kyle Undefined

2012-03-27 10:27:23

To be honest, making a user setup their inventory a certain way is the best, and fastest way to account for an item. I have skiller support in my Shilo scripts, but the pick and gem bag have to be in the first two inventory slots.

That is the easiest.

Ibotlots8D

2012-03-27 10:30:11

From: Kyle Undefined
To be honest, making a user setup their inventory a certain way is the best, and fastest way to account for an item. I have skiller support in my Shilo scripts, but the pick and gem bag have to be in the first two inventory slots.

That is the easiest.


This >=o
Why feed them leechers ;p

Borland

2012-03-27 11:28:17

When mining the fastest exp hour comes by do the following.

Have all inv spaces taken up except slots 1 and 5 (First 2 slots going down left most side of your invent).

Then mine 1 ore, click a second ore to mine and move the mouse straight to the first ore you just mined in you inventory and have the drop option hovered over, as soon as your exp goes up click drop and mine another.

You just need to alternate between inv spots 1 and 5 for dropping and at any ore spot where you can mine 3 without moving your character this method yields very high exp/hour rates.

Set the Mouse Speed to a fairly high number with a ir of random, try having it get set in each function to resemble how fast you need it to move, for example moving down the "drop" after right clicking would be slower than when moving to and from the invent.

I got 99 mining doing granite and iron ore like this. Iron was better exp.

Littellj

2012-03-27 14:32:52

you could make a for loop 0-27 and make the 0-27 the invy spots "squares" and have it check for the DTM of iron ore/saph/emer… what ever you don't want and then have it drop it
something like this maybe

if (FindDtm(____)) then
drop;

Kyle Undefined

2012-03-27 14:34:37

From: Littellj
you could make a for loop 0-27 and make the 0-27 the invy spots "squares" and have it check for the DTM of iron ore/saph/emer… what ever you don't want and then have it drop it
something like this maybe

if (FindDtm(____)) then
drop;


That's not very efficient, and the InvSlots start with 1 ;)

Littellj

2012-03-27 14:42:08

From: Kyle Undefined
That's not very efficient, and the InvSlots start with 1 ;)


Oh so it would be 0-28? Yeah i know but it might save some skillers rune pick's if they somehow get moved "by the bot":duh: lol, But having a certain setup and telling it to just drop at each invy spot would be fastest probably.

Kyle Undefined

2012-03-27 14:59:04

It would be for i := 1 to 28 do :)

Imanoobbot

2012-03-28 04:45:28

From: Kyle Undefined
Here's how I do it in my Shilo Script :) It's a stripped down example.


program new;
{$i srl/srl.simba}

const
BOOL_PICK = 0;
{
Many booleans between these two
}
BOOL_GEMBAG = 5;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := ''; // Your RuneScape Account Name
Pass := ''; // Your RuneScape Account Password
Pin := ''; // Your RuneScape Bank Pin
Active := True; // Use in the Script. True / False.
Integers[0] := 999; // How many Loads to do
Booleans[BOOL_PICK] := False; // Pickaxe in Inventory
Booleans[BOOL_GEMBAG] := False; // Use Gem Bag
end;
end;

procedure Drop;
var
i : Integer;
begin
if(Players[CurrentPlayer].Booleans[BOOL_PICK])then
Inc(i);
if(Players[CurrentPlayer].Booleans[BOOL_GEMBAG])then
Inc(i);
{
I do it this way so I can add many items in the inventory and not have to
worry about remaking the droping procedure
}
for i := i + 1 to 28 do
begin
if(ExistsItem(i))then //checks if item exists
begin
MouseItem(i, mouse_Right); //right clicks the item
WaitOption('rop',750); //waits for the option
Wait(750); //give time for the item to drop
end;
end;
end;

begin
SetupSRL();
DeclarePlayers();
Drop();
end.


That seems to be great. Tomorrow in the evening my School stress is over and I got time for scripting again. Then I will test this all. Also I want to add this into my script.

1. Keep gems? - quite easy to make
2. Progress report - already finished just not included
3. Simulation of Mousekeys if false use fast dropping methode - working on
4. Random solving support - easy to add
5. Banking support (makes no sense for me in this script but I want to apply for membership with it so ;) ). - Not worked on yet