SRL Archive - SRL Archives

MineDone


timmyboy

2006-05-01 17:27:22

Yep, another function from me :p
Returns true if you mined a rock, false if not.
Remember to set time-out(Mtime). Must be the max time you think it will take for your
character to min the ore.


{*******************************************************************************
function MineDone(Mtime: Integer): Boolean;
By: Timmyboy
Description: Returns true if you mined a ore, false if not.
Remember to set time-out(Mtime). Must be the max time you think it will take for your
character to min the ore.
*******************************************************************************}
function MineDone(Mtime:Integer): Boolean;
var
Mmark, a : Integer;
begin
MarkTime(Mmark);
repeat
A:=A+1
wait(100)
until(FindChatText('swing your pick')) or (A=25);
begin
repeat
wait(500+random(400));
until(FindChatText('to mine some')) or (TimeFromMark(Mmark)>Mtime);
if(FindChatText('to mine some'))then
begin
Result:=true;
end else
if (TimeFromMark(Mmark)>Mtime)then
begin
Result:=false;
end;
end;
end;

Any comments appreciated.

WhiteShadow

2006-05-01 19:03:07

From: timmyboy
Yep, another function from me :p
This checks to see the the ore color has changed from the cords x,y, and if it has, it returns true. It basicly tells you if you mined the ore.(as when you do, it changes from the ore color to a grey color). You can use this for tree's to…I think.:D


{*******************************************************************************
function MineDone(x, y: Integer): Boolean;
By: Timmyboy
Description:Checks to see if the ore has changed color from the start, and if
it has, returns True.
*******************************************************************************}
function MineDone(x, y: Integer): Boolean;
var
scol, ecol: Integer;
begin
scol:=getcolor(x,y);
ecol:=getcolor(x,y);
if(scol<>ecol)then
begin
Result:=true;
end;
end;

Any comments appreciated.


This wouldn't possibly work. First of all your suppose to use GetMousePos(x, y);

And even if you added that.

after it gets color twice on those two same coords the color will always be the same.
More descriptive:

Your getting the color of one coord actually and comparing the same color with the same color. (If you actually even added getmousepos)

Nice idea though…

Renax

2006-05-01 20:08:42

getmousepos has nothing to do with it… but it still won't work.

driger1592

2006-05-01 20:13:25

You have the x,y part right, but what you need to do is add another parameter for the original color of the ore (which can be saved in a global variable previously).

The Prince of Randomness?

2006-05-01 20:45:51

The better way to do it is see if your inventory increases in count
do

procedure mine;
var prevcount:integer;
begin
prevcount:=invCount
begin
if findobj(X,y,'mine',436874) then
mouse(X,y);
repeat
Wait(500)
until(PrevCount < InvCount);
end;

or something like that

timmyboy

2006-05-01 20:48:35

I'm working on it right know, will be done soon with a new working procedure. When I tested this one with my miner, it worked, but I guess it was just a coinceidence(sp?)

Pwnd

2006-05-01 22:05:47

From: The Prince of Randomness
The better way to do it is see if your inventory increases in count
do

procedure mine;
var prevcount:integer;
begin
prevcount:=invCount
begin
if findobj(X,y,'mine',436874) then
mouse(X,y);
repeat
Wait(500)
until(PrevCount < InvCount);
end;

or something like that

If someone steals your ore, then you're screwed ;)

Also, this is what I did for my tree cutting procedures:
I would findob.. Click, flag.. Find Obj again (using the x any y coords the coords are my feet.)
Then, getcolor.. then repeat wait i:= i + 1; until not(getcolor or until i > 15

It lagged a little, but that was for the tree.. A few other aspects were put into it.

Dark_Sniper

2006-05-01 22:25:30

basicly on the right track but this one works ive used it.

procedure MineDone;
var
InvC ,ICount, xx, yy : integer;
begin
InvC:= InvCount;
GetMousePos(xx, yy)
repeat
ICount:= InvCount;
wait(10+random(3))
until(ICount > InvC) or
findcolortolerance(x, y, 4737615, xx+1, yy+1, xx-1, yy-1, 15) or
findcolortolerance(x, y, 5263447, xx+1, yy+1, xx-1, yy-1, 15)
end;

Pyro

2006-05-02 01:34:33

The best way to do it is to either look for the text at the bottem congrats you got a ore or whatever it is. AND a time out. I learnt this from stupid. Very smart way of doing it

Pwnd

2006-05-02 07:54:50

From: Pyro
The best way to do it is to either look for the text at the bottem congrats you got a ore or whatever it is. AND a time out. I learnt this from stupid. Very smart way of doing it

I haven't looked at stupid's code, but that's how he/she did it? I thought I was a genius using it at times :( :P

And the invcount thing lagged for me before, but idk.

XxKanexX

2006-05-02 08:59:06

For my miner script that i stopped due to quitting Scar and Runescape i just made it detect if the pickaxe colors were moving. Therefore animating; Mining.

It looked for 5 seconds, grabbing the colors at the start then went into a loop where if they were found in a different position the loop would break and function result as true. :)

timmyboy

2006-05-02 09:08:04

From: Pyro
The best way to do it is to either look for the text at the bottem congrats you got a ore or whatever it is. AND a time out. I learnt this from stupid. Very smart way of doing it

Thats what I was doing for the past 20min :p Good idea for the time out, i'm going to ad that.

Kane, I tried to do something like that, but me being the stupid guy I am, and you being not stupid, I couldn't do it so I decided to do something else:p

timmyboy

2006-05-02 09:29:23

I made a new function for this, and it works:p


Edit:Opps, for double posting, forgot I already posted before this:rolleyes:

Dark_Sniper

2006-05-02 15:55:36

change it so it has time to wait for the guy to get to the rock like so :p


function MineDone: Boolean;
var
Mmark, a : Integer;
begin
MarkTime(Mmark);
repeat
A:=A+1
wait(100)
until(FindChatText('swing your pick')) or (A=25);
begin
repeat
wait(500+random(400));
until(FindChatText('to mine some')) or (TimeFromMark(Mmark)>Mtime);
if(FindChatText('to mine some'))then
begin
Result:=true;
end else
if (TimeFromMark(Mmark)>Mtime)then
begin
Result:=false;
end;
end;
end;

timmyboy

2006-10-23 08:49:31

Errr…SRL still dosn't have anything like this, so i'm bumping this thread up so that other people can use this. Any comments are still appreciated. :)

Thanks dark_sniper for the help.

lardmaster

2006-10-23 15:03:20

i say invcount and color tracker and timeout all together are best method.

tarajunky

2006-10-24 03:07:47

From: timmyboy
Errr…SRL still dosn't have anything like this, so i'm bumping this thread up so that other people can use this. Any comments are still appreciated. :)

Thanks dark_sniper for the help.


It's true that SRL doesn't have this exact procedure, but most mining scripts already include this function. If you ever notice a GetColor(x,y)= 0 in the mining procedure, that's what they're looking for.

The text color is 0, and the position of the text between the two statements moves. Some of them aren't -perfect- because they look at pixels too far to the left, which can sometimes overlap with someone's name, giving a false read-out.

Looking for a color 0 pixel that changes between the 'swing' statement and the 'manage statement is all you need. Searching for text probably doesn't take up much more time, but I think it would be more prone to error.