SRL Archive - OSR Help

UpText Broken?


King

2013-03-31 11:05:08

function for the life of me will not find the uptext period >.< Is it broken?

My code:
function FindRocks: Boolean;
var
TPA: TPointArray;
ATPA: T2DPointArray;
I, X, Y: Integer;
R: TPoint;
begin
FindNormalRandoms;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.24);
if FindColorsSpiralTolerance(X, Y, TPA, 4422036, MSX1, MSY1, MSX2, MSY2, 15) then
begin
if (Length(TPA) >= 5) then
begin
ATPA := TPAtoATPAEx(TPA, 40, 40);
SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));
DebugATPA(ATPA, '');
for i := Low(ATPA) to High(ATPA) do
begin
if GetArrayLength(ATPA[i]) > 5 then
begin
MMouse(x, y, 2, 2);
if (waitUpTextMulti(['Mine', 'Rock'], 250)) then
begin
BeforeClick := InvCount;
ClickMouse2(true);
wait(RandomRange(250, 300));
FFlag(1);
status := 'Clicked Rock';
writeln('Staus:' + Status);
result := True;
exit;
end
else
begin
result := false;
status := 'Couldnt Find Rock';
writeln('Staus:' + Status);
exit;
end;
end;
end;
end;
end;
end;

My debug box (so you know it is finding the color):

Debug says, could not find rock, which means that it isn't finding the uptext after finding the color, how do I fix this? :P

Justin

2013-03-31 11:08:10

From memory, it could be caused by the 'ColorSpeed2Modifiers' being changed. Try resetting them back to (0.2, 0.2) when detecting up-text, see how that goes.

Total

2013-03-31 11:08:39

Have it hover over the rock then Writeln(GetUpText); to see what you are getting. Oh and that ^

King

2013-03-31 11:09:52

From: Justin
From memory, it could be caused by the 'ColorSpeed2Modifiers' being changed. Try resetting them back to (0.2, 0.2) when detecting up-text, see how that goes.


:duh: Thankyou. I thought I set it to do this.

Justin

2013-03-31 11:10:59

Also take a look at this thread; (Seems to have the same problem as you) http://villavu.com/forum/showthread.php?t=92875

King

2013-03-31 11:13:08

It still doesnt work /:

The script doesnt move the mouse to the rocks even if it finds them,finds them, but doesnt move the mouse over them /; my current function,

function FindRocks: Boolean;
var
TPA: TPointArray;
ATPA: T2DPointArray;
I, X, Y: Integer;
R: TPoint;
begin
FindNormalRandoms;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.24);
if FindColorsSpiralTolerance(X, Y, TPA, 4422036, MSX1, MSY1, MSX2, MSY2, 15) then
begin
ColorToleranceSpeed(1);
SetColorSpeed2Modifiers(0.2, 0.2);
if (Length(TPA) >= 5) then
begin
ATPA := TPAtoATPAEx(TPA, 40, 40);
SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));
DebugATPA(ATPA, '');
for i := Low(ATPA) to High(ATPA) do
begin
if GetArrayLength(ATPA[i]) > 5 then
begin
MMouse(x, y, 2, 2);
if (waitUpTextMulti(['Mine', 'Rock'], 250)) then
begin
BeforeClick := InvCount;
ClickMouse2(true);
wait(RandomRange(250, 300));
FFlag(1);
status := 'Clicked Rock';
writeln('Staus:' + Status);
result := True;
exit;
end
else
begin
result := false;
status := 'Couldnt Find Rock';
writeln('Staus:' + Status);
exit;
end;
end;
end;
end;
end;
end;

Justin

2013-03-31 11:13:50

What Simba version are you using?

King

2013-03-31 11:18:02

From: Justin
What Simba version are you using?

the newest, the function was working yesterday, now it doesnt :P, I can try reupdating SRL-OSR?

Total

2013-03-31 11:22:05

You should just throw Writeln's everywhere to see exactly where its going wrong. It may be at if GetArrayLength(ATPA) > 5 then.

King

2013-03-31 11:25:00

From: Total
You should just throw Writeln's everywhere to see exactly where its going wrong. It may be at if GetArrayLength(ATPA) > 5 then.


I forgot to redefine my X, Y coordinates, so it didnt have any thing to click, it should have been this

function FindRocks: Boolean;
var
TPA: TPointArray;
ATPA: T2DPointArray;
I, X, Y: Integer;
R: TPoint;
begin
FindNormalRandoms;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.24);
if FindColorsSpiralTolerance(X, Y, TPA, 4422036, MSX1, MSY1, MSX2, MSY2, 15) then
begin
ColorToleranceSpeed(1);
SetColorSpeed2Modifiers(0.2, 0.2);
if (Length(TPA) >= 5) then
begin
FindNormalRandoms;
ATPA := TPAtoATPAEx(TPA, 40, 40);
SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));
// DebugATPA(ATPA, '');
for i := Low(ATPA) to High(ATPA) do
begin
if (GetArrayLength(ATPA[i]) > 5) then
begin
FindNormalRandoms;
[B] R := MiddleTPA(ATPA[i]);[/B] //I forgot to refine where to click
MMouse(r.x, r.y, 2, 2);
if (waitUpTextMulti(['Mine', 'Rock'], 250)) then
begin
FindNormalRandoms;
BeforeClick := InvCount;
ClickMouse2(true);
wait(RandomRange(250, 300));
FFlag(1);
status := 'Clicked Rock';
writeln('Staus:' + Status);
result := True;
exit;
end
else
begin
result := false;
status := 'Couldnt Find Rock';
writeln('Staus:' + Status);
exit;
end;
end;
end;
end;
end;
end;

Justin

2013-03-31 11:25:05

From: SRLKing
the newest, the function was working yesterday, now it doesnt :P, I can try reupdating SRL-OSR?


Try look for 993, it has the better uptext, not the hackish one :P

King

2013-03-31 11:26:17

From: Justin
Try look for 993, it has the better uptext, not the hackish one :P


Ill do that as well, uptext has been giving me issues for a while :P