SRL Archive - OSR Help

Procedure query


Applezz

2011-12-29 14:38:39

When I call a created procedure in my main loop, the mouse just moves over inventory and clicks in a periodic fashion, and does nothing else and I cannot work out why, here is the procedure:
procedure MineOre;
var x, y, OreCount, i: integer;
begin
OreCount:= InvCount + 1;
if (FindObjCustom(x, y, ['ine', 'ocks'], [16448250, 987409], 3)) then
begin;
Writeln('Found Ore');
Mouse(x, y, 3, 3, true);
Wait(100 + Random(50));
end;
MarkTime(i);
repeat
Wait(300);
if (InvCount=OreCount) then
Writeln('Mined Ore');
until (InvCount=OreCount) or (TimeFromMark(i) > 30000);
end;

HardRockers

2011-12-29 22:53:07

For one, on yours, when you use the time counter as a Fail safe you have it set to 30 seconds? I can see where that is actually logical for some ores(Rune, Addy and MAYBE Mith), I was just making sure you knew that that was a pretty long time.

Try using this:
 x:= MSCX;
y:= MSCY;
It will make it search for the color nearest the middle of the screen (Where you player stands). Maybe this will help it find it faster.


Here is what I am using to find Iron Ore, and it basically flawless so far.:


Function MineOre:Boolean;
Var
x,y, PlusOne, MineCounter: Integer;
Begin
If Not(LoggedIn) Then Exit;
PlusOne:= InvCount +1;
x:= MSCX;
y:= MSCY;

If FindObjCustom(x, y, ['Mine','Rocks','e R'], [2832738, 2502212, 2701150,2371667], 5) Then
Begin
WriteLn('There is ore here.');
GetMousePos(x, y);
Case Random(2) of
0: Mouse(x, y, 5, 5, True);
1: Begin
Mouse(x, y, 5, 5, False)
WaitOption('Mine', 500);
end;
end;
Flag;
Repeat
FindNormalRandoms;
MarkTime(MineCounter);
AntiBan;
wait(100);
If InvCount= PlusOne Then
WriteLn('You got ore');
Until (InvCount= PlusOne) OR (TimeFromMark(MineCounter) > 5000);
end;
end;

YoHoJo

2011-12-29 22:54:38

lolololz two new guys making things based on my tutorials, love it!
@Applezz dodes it ever write Find Ore in the debug box?
Also make sure your colors are good and toelrance is high enough!

HardRockers

2011-12-29 22:59:15

His tolerance is only 3, which is probably really low depending on what he is looking for.

Applezz

2011-12-30 06:57:07

From: YoHoJo
lolololz two new guys making things based on my tutorials, love it!
@Applezz dodes it ever write Find Ore in the debug box?
Also make sure your colors are good and toelrance is high enough!

If I just have the first part of the script, it works fine and the mouse moves to the rock, clicks:
This will work fine:
procedure MineOre;
var x, y, OreCount, i: integer;
begin
if (FindObjCustom(x, y, ['ine', 'ocks'], [16448507, 16448250], 3)) then
begin;
Writeln('Found Ore');
Mouse(x, y, 3, 3, true);
Wait(100 + Random(50));
end;
end;

But this won't
procedure MineOre;
var x, y, OreCount, i: integer;
begin
OreCount:= InvCount + 1;
if (FindObjCustom(x, y, ['ine', 'ocks'], [16448250, 987409], 3)) then
begin;
Writeln('Found Ore');
Mouse(x, y, 3, 3, true);
Wait(100 + Random(50));
end;

So it appears to be this line which causes the problem:
OreCount:= InvCount + 1;

HardRockers

2011-12-30 09:38:51

move it to below this line:

Mouse(x, y, 3, 3, true);

I think that might fix it