SRL Archive - OSR Help

Two Problems With Mining Script...


Opus

2012-05-24 20:58:33

I'm having some problems with the mining script I wrote (ie. modified the script from Kyle's tutorial) for mining copper rocks. There are two things in my script so far that aren't working.

1. It doesn't stop clicking while mining the rock, it keeps clicking at about 1 sec intervals.

2. When my inventory is full, it doesn't go on to my next procedure (dropping the ore), even though I specified to repeat…until(InvFull).

I was wondering if i could get help for any of these problems :)

procedure MineRock();
var
x, y : Integer;
Box : TBox;
begin
if(not(LoggedIn))then Exit;
MakeCompass('N');
Box := IntToBox(MSCX - 10, MSCY - 25, MSCX + 15, MSCY + 15);
repeat
if(not(FindNormalRandoms))then
begin
if(FindRock(x, y))then
begin
Wait(RandomRange(150, 250));
Mouse(x, y, 2, 2, mouse_Left);
Wait(RandomRange(100, 300));
while(Animating(Box, 750, 30))do
begin
AntiBan;
Wait(RandomRange(100, 300));
end;
end else
Exit;
end;
until(InvFull);
end;

Element17

2012-05-25 03:10:23

Try using pixelshift or didredclick

J J

2012-05-25 03:46:58

From: 14578
Try using pixelshift or didredclick

He is using pixelshift already. But yeah, an animation difference of 30 pixels in 750 ms is very low. I'm pretty sure that you get a pixelshift of 30 pixels when doing nothing already. So definately increase that amount. To get the right number you can use a code like this

begin
repeat
Wait(100 + Random(200));
WriteLn(''+IntToStr(PixelShift(IntToBox(220, 100, 290, 135), 1000))+'');
until(PixelShift(IntToBox(220, 100, 290, 135), 1000)<900)
end;
This will look for animations in the box 220, 100, 290, 135 for 1000 ms aka 1 second until the pixelshift has passed 900. You can simply replace those numbers with the box you defined. Just keep testing it and look at the numbers it returns so you know what number to put in. Eventually you can replace the loop with a simple repeat, wait, until pixelshift loop.

Also, for the InvFull part
if GetCurrentTab = not(tab_Inv) then
FTab(tab_Inv);
Put that somewhere in your script because it relies on the inventory. If your inventory isn't visible the script can't determine if it's full. You can also use a failsafe by reading the chatbox text.

The problem with that is that once you dropped all the ores, the chatbox text will still be visible. But you can put something after the repeat until loop like. If FindChatBoxText('full', 8, clBlack) then MarkTime(t).
Then in your repeat until you can put or TimeFromMark(t)>60000. Then after the repeat until you can put it TimeFromMark(t)>60000 then if FindChatboxtext(blablabla) then t:=0; next procedure.

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

function FindRock:Boolean;
begin
WriteLn('Found a rock');
Result:=True;
end;

procedure Antiban;
begin
WriteLn('Antiban');
end;

procedure MineRock;
var
x, y, t : Integer;
Box : TBox;

begin
if not(LoggedIn) then Exit;
MakeCompass('N');
MarkTime(t);
Box := IntToBox(MSCX - 10, MSCY - 25, MSCX + 15, MSCY + 15);
repeat
if not(FindNormalRandoms) then
begin
if FindRock then
begin
Wait(RandomRange(150, 250));
Mouse(x, y, 2, 2, mouse_Left);
repeat
Wait(50 + Random(100));
AntiBan;
WriteLn(''+IntToStr(PixelShift(Box, 750))+'');
until(PixelShift(Box, 750)<900)
Wait(RandomRange(50, 150));
end else
Exit;
end;
until(InvFull) or ((TimeFromMark(t)>60000) and (FindChatBoxText('full', 8, clBlack)));
if TimeFromMark(t)>60000 then
t:=0;
end;

begin
ActivateClient;
MineRock;
end.

Should compile.

Opus

2012-05-25 10:38:58

From: J J
He is using pixelshift already. But yeah, an animation difference of 30 pixels in 750 ms is very low. I'm pretty sure that you get a pixelshift of 30 pixels when doing nothing already. So definately increase that amount. To get the right number you can use a code like this

begin
repeat
Wait(100 + Random(200));
WriteLn(''+IntToStr(PixelShift(IntToBox(220, 100, 290, 135), 1000))+'');
until(PixelShift(IntToBox(220, 100, 290, 135), 1000)<900)
end;
This will look for animations in the box 220, 100, 290, 135 for 1000 ms aka 1 second until the pixelshift has passed 900. You can simply replace those numbers with the box you defined. Just keep testing it and look at the numbers it returns so you know what number to put in. Eventually you can replace the loop with a simple repeat, wait, until pixelshift loop.

Also, for the InvFull part
if GetCurrentTab = not(tab_Inv) then
FTab(tab_Inv);
Put that somewhere in your script because it relies on the inventory. If your inventory isn't visible the script can't determine if it's full. You can also use a failsafe by reading the chatbox text.

The problem with that is that once you dropped all the ores, the chatbox text will still be visible. But you can put something after the repeat until loop like. If FindChatBoxText('full', 8, clBlack) then MarkTime(t).
Then in your repeat until you can put or TimeFromMark(t)>60000. Then after the repeat until you can put it TimeFromMark(t)>60000 then if FindChatboxtext(blablabla) then t:=0; next procedure.

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

function FindRock:Boolean;
begin
WriteLn('Found a rock');
Result:=True;
end;

procedure Antiban;
begin
WriteLn('Antiban');
end;

procedure MineRock;
var
x, y, t : Integer;
Box : TBox;

begin
if not(LoggedIn) then Exit;
MakeCompass('N');
MarkTime(t);
Box := IntToBox(MSCX - 10, MSCY - 25, MSCX + 15, MSCY + 15);
repeat
if not(FindNormalRandoms) then
begin
if FindRock then
begin
Wait(RandomRange(150, 250));
Mouse(x, y, 2, 2, mouse_Left);
repeat
Wait(50 + Random(100));
AntiBan;
WriteLn(''+IntToStr(PixelShift(Box, 750))+'');
until(PixelShift(Box, 750)<900)
Wait(RandomRange(50, 150));
end else
Exit;
end;
until(InvFull) or ((TimeFromMark(t)>60000) and (FindChatBoxText('full', 8, clBlack)));
if TimeFromMark(t)>60000 then
t:=0;
end;

begin
ActivateClient;
MineRock;
end.

Should compile.


Thank you for the helpful post +rep.
Lots of stuff you said doesn't make sense to me yet, but I'll figure it out.

Element17

2012-05-25 11:03:34

Ahhh, didn't notice while Animation.

J J

2012-05-25 13:20:34

From: Opus
Thank you for the helpful post +rep.
Lots of stuff you said doesn't make sense to me yet, but I'll figure it out.


FindChatBoxText('full', 8, clBlack)));
It reads the chatbox and looks for the text 'full' on line 8 of the chatbox, that is the bottom line, with the color Black (clBlack = Color Black)

TimeFromMark(t)>60000
if 60.000 milli seconds (60 seconds) have passed since starting a time marker (t) it will do something. It's like a stopwatch.

t:=0;
This resets the time t back to zero.

Opus

2012-05-25 20:22:32

From: J J
FindChatBoxText('full', 8, clBlack)));
It reads the chatbox and looks for the text 'full' on line 8 of the chatbox, that is the bottom line, with the color Black (clBlack = Color Black)

TimeFromMark(t)>60000
if 60.000 milli seconds (60 seconds) have passed since starting a time marker (t) it will do something. It's like a stopwatch.

t:=0;
This resets the time t back to zero.


That makes more sense, thank you :)

Opus

2012-05-25 20:49:49

Now I'm having another issue. There's a popup in my chatbox saying my inv is full, and not writing it on a line. I tried making a DTM to recognize the button when it came up, and then dropping the ore when it was recognized, but that didn't seem to work (I probly just have the order or something messed up)