SRL Archive - OSR Help

Error: Exception: You passed wrong values to a finder function:


rj

2013-04-02 06:07:48

I have no idea why I'm getting this error:

Error: Exception: You passed wrong values to a finder function: ys > ye (15,-15). at line 26


Full code:

{$i srl/srl.simba}
{$i SSInclude/SSInclude.simba}
{$i SSInclude/Randoms.simba}
{$i SSInclude/MapWalk.simba}
Function Click: Boolean;
Var
tmpCTS, i, L,Counter: Integer;
ObjTPA: TPointArray;
ObjATPA: T2DPointArray;
X, Y, DMCount, Moves: Integer;
OBX1 ,OBY1, OBX2, OBY2:Integer;
Begin
Moves:=0;
DMCount:=0;

tmpCTS := GetToleranceSpeed;

If FindColorTolerance(X, Y, 263362, SS_MMX1, SS_MMY1, SS_MMX2, SS_MMY2, 25) Then
SS_MMToMSPoint(X, Y);
Writeln('Color found')
OBX1 := X-15;
OBY1 := Y+15;
OBX2 := X+15;
OBY2 := Y-15;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.00, 0.00);
FindColorsTolerance(ObjTPA, 1118484, OBX1, OBY1, OBX2, OBY2, 4);
SplitTPAWrap(ObjTPA, 10, ObjATPA);

SortATPAFromFirstPoint(ObjATPA, Point(SS_MSCX,SS_MSCY));
//SortATPASize(ObjATPA,True);
SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);

DMCount:=RandomRange(3,5);
L := High(ObjATPA)
MarkTime(Counter);
For i := 0 To L Do
Begin
MiddleTPAEx(ObjATPA[i], X, Y);

Repeat Begin

Moves:=Moves+1;
mmouse(x, y, 1, 1);
Wait(RandomRange(140, 200));
If (SS_IsUpTextMultiCustom(['nter','ave', 'ance'])) Then
Begin
clickmouse2(mouse_Left);
Wait(RandomRange(400, 700));
Exit;
End;
End; Until (Moves > DMCount)
If (TimeFromMark(Counter) > 5000) Then
Break;
End;
Result:=False;
End;
Begin
Click;
End.

Justin

2013-04-02 06:18:08


OBX1 := X-15;
OBY1 := Y+15;
OBX2 := X+15;
OBY2 := Y-15;

OBY2 is smaller then the first Y point

rj

2013-04-02 06:19:51

From: Justin

OBX1 := X-15;
OBY1 := Y+15;
OBX2 := X+15;
OBY2 := Y-15;

OBY2 is smaller then the first Y point

How? Their all 15? And the color on the minimap is extremely unique because they whole minimap is black

Justin

2013-04-02 06:30:21

From: RJJ95
How? Their all 15? And the color on the minimap is extremely unique because they whole minimap is black


Hard to explain;


Black = X Y

Blue = OBX1, OBY1
Purple = OBX2, OBY2

You need to switch it around

rj

2013-04-02 14:47:59

From: Justin
Hard to explain;


Black = X Y

Blue = OBX1, OBY1
Purple = OBX2, OBY2

You need to switch it around



MMToMS makes the spot, then it is supposed to make a box around that point

Sjoe

2013-04-02 14:54:16

From: RJJ95

MMToMS makes the spot, then it is supposed to make a box around that point


He's saying that yoru coords are messed up

OBX1 := X-15;
OBY1 := Y+15;
OBX2 := X+15;
OBY2 := Y-15;

Should be

OBX1 := X-15;
OBY1 := Y-15;
OBX2 := X+15;
OBY2 := Y+15;

rj

2013-04-02 14:55:21

From: Sjoekeloe
He's saying that yoru coords are messed up

OBX1 := X-15;
OBY1 := Y+15;
OBX2 := X+15;
OBY2 := Y-15;

Should be

OBX1 := X-15;
OBY1 := Y-15;
OBX2 := X+15;
OBY2 := Y+15;


Never mind, I'm still getting an error @Sjoekeloe

Error: Exception: You passed a wrong xs to a finder function: -15. That is below 0, thus out of bounds. at line 26

Apparently it can't find the color even though I just re selected it and used a tolerance of 45 and the debug said it did?

Sjoe

2013-04-02 15:22:23

just use x instead of x - 15?

You passed a wrong xs to a finder function: -15. That is below 0

rj

2013-04-02 15:23:54

From: Sjoekeloe
just use x instead of x - 15?

You passed a wrong xs to a finder function: -15. That is below 0


I think the problem is the MMtoMS function I tried to use it by itself and it clicks the top left corner of the client everytime

procedure SS_MMToMSPoint(var X, Y : Integer);
var
x1, y1 : Integer;
begin
x1 := X;
y1 := X;

X := Round((X-SS_MMCX)*255/40) + SS_MSCX;
Y := Round((Y-SS_MMCY)*176/28) + SS_MSCY;

if X < MSX1 then X := MSX1;
if Y < MSY1 then Y := MSY1;
if X > MSX2 then X := MSX2;
if Y > MSY2 then Y := MSY2;
end;

Even when I commented this line of code out

 if X < MSX1 then X := MSX1;
if Y < MSY1 then Y := MSY1;
if X > MSX2 then X := MSX2;
if Y > MSY2 then Y := MSY2;

It still did the same thing

Sjoe

2013-04-02 15:26:17

That's out of my knowledge here :) (which wasn't much in the beginning ;) )

rj

2013-04-02 15:28:12

then we shall use the magic mention tags to summon the author of this piece of art:

@Shatterhand

Shatterhand

2013-04-02 17:34:18

Is this SS priv server script? You use SS_MSCX and MSX1 too. Make sure the coords are correct.

rj

2013-04-02 17:55:56

From: Shatterhand
Is this SS priv server script? You use SS_MSCX and MSX1 too. Make sure the coords are correct.


SS_MSX1 is already calculated through the script based off the SS_MSX1 etc etc coords