SRL Archive - OSR Help

Mining Procedure skipping steps


VastlySuperior

2012-09-02 02:53:00

I have a problem I would like to sort out. I do`nt know why it is doing this as it seems to me that it should not do this with all the checks I do have in place.

I find the ore and click on it then it then I Assign a value of true to a Variable now it must go into a loop and wait until certain conditions are met before moving on, but it just continues on regardless of the checks that is in place. can anyone take a look at this and tell me why it is behaving like it does. And what can I do to remedy this situation as it is busy mining a ore and then before it finish it moves on to the next ore or clicks on the same ore once more.

I would appreciate some help with this. Thanks

Here is the code:

function IsMining: Boolean;                       // True If Mining Animation
var // Credit To Flight
PBox:TBox;
Begin
PBox := IntToBox(245, 130, 285, 195);
Result := (AveragePixelShIft(PBox, 250, 500) > 180);

  
var
x, y, RockCounter, FailSafeTime, TempTime, Counter: integer;
Mined:Boolean;
Player:Tpoint;
VBox:TBox;
Direction:TRadial;

// Writeln('The Beginning Of the Mining Sequence');
Repeat
Disguise('Starting Mining For ' + Desc);
If FindNormalRandoms then
Begin
If Not LoggedIn Then
Begin
Writeln('Found unsolvable random');
NextPlayer(False);
End;
End;
SelectRock(OreChoice);
While IsMoving Do
Begin
Wait(10);
End;
// Writeln('Start Looking For The Ore');
If (FindOre(x, y)) then
Begin
If not(Mined) Then
Begin
ClickMouse2(Mouse_Left);
MarkTime(RockCounter);
MarkTime(FailSafeTime);
Mined := True;
Ore := Point(x, y);
Player := Point(MSCX, MSCY);
End;
End;
Antiban;
Repeat
If FindNormalRandoms then
Begin
If Not LoggedIn Then
Begin
Writeln('Found unsolvable random');
NextPlayer(False);
End;
End;
Until not(Mined) or (FindBlackChatMessage('nage')) or (TimeFromMark(RockCounter) > (3700 + Random(300))) and (not(IsMining));
Mined := False;
Until (InvFull);

Le Jingle

2012-09-02 03:14:12

Well, code standards/lack of variables (for the code snippet provided) aside, if you need to wait until the ore is mined/gone, I'd suggest implementing something along the lines of checking for color that signifies the ore is found, and implement a safe type of wait + check for mining until that color that was found, is no longer found. Again this is just my p.o.v. @the problematic idea you stated. I'm sure there's other ways to go about it too.

VastlySuperior

2012-09-02 03:58:30

From: Le Jingle
Well, code standards/lack of variables (for the code snippet provided) aside, if you need to wait until the ore is mined/gone, I'd suggest implementing something along the lines of checking for color that signifies the ore is found, and implement a safe type of wait + check for mining until that color that was found, is no longer found. Again this is just my p.o.v. @the problematic idea you stated. I'm sure there's other ways to go about it too.


Le Jingle, if you can show me how to check if the color still exist where I selected the rock I will appreciate it. I already tried to do something like that but I can`t get it to work accurately. The problem is when you move to the rock you selected then the coordinates shift, how do you compensate for that, and even when I also Include that in the conditions it sometimes still skip that step and click once more on a color even though the color still exist on the rock and I can see it is checking the correct rock.

Here Is the code I use for checking the vein.

Function IsVein(var x,y:integer) : Boolean;
var
ItemX, ItemY : Integer;
TPA : Array Of TPoint;
ATPA : T2DPointArray;
i : Integer;
PlayerBox, MBox: TPointArray;
Begin
PlayerBox := TPAFromBox(IntToBox(MSCx - 15, MSCy - 25, MSCx + 15, MSCy + 20));
FindColorsSpiralTolerance(ItemX, ItemY, TPA, Colour, (MSCX - 40), (MSCY - 40), (MSCX + 40), (MSCY + 40), TolR)
ClearTPAFromTPAWrap(TPA, PlayerBox, {var}TPA);
SortTPAFrom(TPA, IntToPoint(MSCx, MSCy));
Begin
ATPA := SplitTPA(TPA, 10);
For i := 0 To High(ATPA) Do
Begin
If MiddleTPAEX(ATPA[i], ItemX, ItemY) then
Begin
MMouse(ItemX, ItemY, 1, 1);
End else
Continue;
If WaitUptext(Desc, 200) Then
Begin
x := ItemX;
y := ItemY;
SMART_ClearCanvasArea(IntToBox(MSCX - 40, MSCY - 40, MSCX + 40, MSCY + 40));
SMART_DrawBoxEx(True, False, IntToBox(ItemX - 10, ItemY - 10, ItemX + 10, ItemY + 10), ClPurple);
Result := FindColorTolerance(x, y, Colour, ItemX - 10, ItemY - 10, ItemX + 10, ItemY + 10, TolR);
Exit;
End;
End;
End;
End;


I would really appreciate help with both of these code snippets to get it to work correctly as it is supposed to.