SRL Archive - OSR Help

PO7Include findobj problem


Occidio

2013-02-26 18:11:37

Hey I just started scripting and having some problems using FindObj, this is the part of my script not working.


 
procedure findTree;
var
X,Y:Integer;
begin
if P07_FindObj(x, y, 'Chop', 3232106, 6) then
begin
mmouse(x, y,0,0);
wait(250);
ClickMouse(X, Y, mouse_Right)
end;
end;

When I run this procedure in an area with trees it will simply hover the mouse to each tree in the area and then stop, so it seems like it actually finds the right object it just won't run the if clause when it does and continues to find more. Total noob so if I missed something fundamental about how findObj works please explain :redface:

Noob King

2013-02-26 18:27:21

Yesterday when I was making a script I found that up text is acting funny. Try 'Chop down Treename' or 'Chop down Treename'(Double Spaces. Yesterday it was picking up spaces as two spaces for me)

pyryny

2013-02-26 21:02:47

I seem to be having the same problem as OP.
Using the P07_FindObj will make the mouse hover over the selected color with the appropriate uptext, but it just keeps hovering on different spots without ever clicking.

I used a similar code :

Program finddoor;

{$I SRL/SRL.Simba}
{$I P07Include.Simba}

var
x, y: integer;

Procedure door;

Begin
if P07_FindObj(x, y, 'arge', 1858422, 5) then
ClickMouse2(mouse_left)
else
writeln('fail');
End;

Begin
SetupP07Include;
door;
End.


Anyone who had this problem or knows how to fix it can help?

DannyRS

2013-02-26 21:11:20

From: pyryny
I seem to be having the same problem as OP.
Using the P07_FindObj will make the mouse hover over the selected color with the appropriate uptext, but it just keeps hovering on different spots without ever clicking.

Anyone who had this problem or knows how to fix it can help?


It's because my Uptext function is not 110% accurate like the normal srl one, you need to use one string from the white text, and one from the blue/yellow text,

For example, for mining, If P07_FindObjCustom(x,y,['Mine','Rock'],,5) Then ClickMouse2(mouse_left);

pyryny

2013-02-26 21:13:58

Thanks for quick answer Danny.
Works like a charm now :)

DannyRS

2013-02-26 21:21:47

From: pyryny
Thanks for quick answer Danny.
Works like a charm now :)


No Problem ;)

Glad I've located an issue people keep having, now I know its probably because they don't understand that things can not be 100% accurate,

Imagine if you used only white text while the main screen (behind the text) is covered in snow? Not going to work very well if at all :p

Occidio

2013-02-27 03:41:29

Thanks for the help Danny but still having problems using this code

procedure findTree;
var
X,Y:Integer;
begin
If P07_FindObjCustom(x,y,['Chop','Tree'],[323106,3561845],5) then
begin
ClickMouse2(mouse_left);
end;
end;

It will hover from tree trunk to tree trunk including oaks etc so it just finds the colors but not the text apparently :/