SRL Archive - OSR Help

2007 object finding and clicking


blockay

2013-03-02 05:36:45

i have narrowed this error down to the line if P07_IsUpTextMultiCustom(['Cho', 'hop', 'Dow', 'own', 'Tree']) then
IsUpTextMultiCustom isn't working for me, i've also tried if P07_Containstext(P07_getUptext, ['own', 'ree']) then
so i guess p07_getUpText isn't working correctly, if anyone has a solution or an idea i would greatly appreciate it.
Procedure ChopTree;
var
treeTPA:TPointArray;
timeTree, tmpCTS, L, R, K: integer;
begin
MarkTime(timeTree);
tmpCTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(3.88, 0.00) //hue and sat
//FindColorsTolerance(keysTPA, 269853, MSX1, MSY1, MSX2, MSY2, 2);
FindColorsSpiralTolerance(256, 165, treeTPA, 6155, P07_MSX1, P07_MSY1, P07_MSX2, P07_MSY2, 2);
L := High(treeTPA);
R := random(L);
K := RandomRange(1,28);
mmouse(treeTPA[R].x,treeTPA[R].y, 1, 1);
Wait(200);
if P07_IsUpTextMultiCustom(['Cho', 'hop', 'Dow', 'own', 'Tree']) then
repeat
if K < 2 then
begin
ClickMouse2(mouse_right);
P07_ChooseOptionMulti(['hop']);
Wait(500);
end
else if K > 1 then
begin
ClickMouse2(mouse_left);
Wait(500);
end;
if not P07_IsUpTextMultiCustom(['Cho', 'hop', 'Dow', 'own', 'Tree']) then break;
until P07_DidClick(true,200) or (TimeFromMark(timeTree) > 5000);
SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
end;
function keyTurn(Key:integer): boolean;
var
keysTPA:TPointArray;
timekey, tmpCTS, L, R: integer;
begin
case key of
1: KeyToHold:=37;
2: KeyToHold:=39;
end
MarkTime(timeKey);
tmpCTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(3.88, 0.00) //hue and sat
FindColorsSpiralTolerance(256, 165, keysTPA, 6155, P07_MSX1, P07_MSY1, P07_MSX2, P07_MSY2, 2);
L := High(keysTPA);
R := random(L);
if not FindColorsSpiralTolerance(256, 165, keysTPA, 6155, P07_MSX1, P07_MSY1, P07_MSX2, P07_MSY2, 2) then
repeat
begin
KeyDown(KeyToHold);
Wait(100);
if TimeFromMark(timeKey) > RandomRange(1500, 3400) then Break;
end;
Result := True;
until FindColorsTolerance(keysTPA,6155,P07_MSX1, P07_MSY1, P07_MSX2,P07_MSY2, 2);
Result := False;
KeyUp(KeyToHold);
SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
end;
after looking at my code a second time im noticing a lot of things i can change, but lets focus on the clicking part please

Mark

2013-03-02 08:12:42

Your using the wrong main screen coords

these:
MSX1, MSY1, MSX2, MSY2

Should be:
P07_MSX1, P07_MSY1, P07_MSX2, P07_MSY2

is just a guess havn't tested the include just from looking.

Xeronate

2013-03-02 12:27:21

Post the entire script please.

blockay

2013-03-02 13:47:38

From: CRU1Z1N
Your using the wrong main screen coords

these:
MSX1, MSY1, MSX2, MSY2

Should be:
P07_MSX1, P07_MSY1, P07_MSX2, P07_MSY2

is just a guess havn't tested the include just from looking.

i never seem to have any issues with msx1 msy1 etc, i tried ur suggestion and changed to p07 but that didn't work.

@xeronate, i just need help with the clicking method..
Updated code (still not working) any ideas?
Procedure ChopTree;
var
treeTPA:TPointArray;
timeTree, tmpCTS, L, R, K: integer;
begin
MarkTime(timeTree);
tmpCTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(3.88, 0.00) //hue and sat
//FindColorsTolerance(keysTPA, 269853, MSX1, MSY1, MSX2, MSY2, 2);
FindColorsSpiralTolerance(256, 165, treeTPA, 6155, P07_MSX1, P07_MSY1, P07_MSX2, P07_MSY2, 2);
L := High(treeTPA);
R := random(L);
K := RandomRange(1,28);
mmouse(treeTPA[R].x,treeTPA[R].y, 1, 1);
Wait(200);
if P07_IsUpTextMultiCustom(['Cho', 'hop', 'Dow', 'own', 'Tree']) then
repeat
if K < 2 then
begin
ClickMouse2(mouse_right);
P07_ChooseOptionMulti(['hop']);
Wait(500);
end
else if K > 1 then
begin
ClickMouse2(mouse_left);
Wait(500);
end;
if not P07_IsUpTextMultiCustom(['Cho', 'hop', 'Dow', 'own', 'Tree']) then break;
until P07_DidClick(true,200) or (TimeFromMark(timeTree) > 5000);
SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
end;
function keyTurn(Key:integer): boolean;
var
keysTPA:TPointArray;
timekey, tmpCTS, L, R: integer;
begin
case key of
1: KeyToHold:=37;
2: KeyToHold:=39;
end
MarkTime(timeKey);
tmpCTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(3.88, 0.00) //hue and sat
FindColorsSpiralTolerance(256, 165, keysTPA, 6155, P07_MSX1, P07_MSY1, P07_MSX2, P07_MSY2, 2);
L := High(keysTPA);
R := random(L);
if not FindColorsSpiralTolerance(256, 165, keysTPA, 6155, P07_MSX1, P07_MSY1, P07_MSX2, P07_MSY2, 2) then
repeat
begin
KeyDown(KeyToHold);
Wait(100);
if TimeFromMark(timeKey) > RandomRange(1500, 3400) then Break;
end;
Result := True;
until FindColorsTolerance(keysTPA,6155,P07_MSX1, P07_MSY1, P07_MSX2,P07_MSY2, 2);
Result := False;
KeyUp(KeyToHold);
SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
end;

my main loop

begin
DTM;
CallThings;
P07_DeclarePlayer;
SetupP07Include;
ActivateClient;
Addonterminate('FreeThings');
login;
Wait(100);
If P07_LoggedIn then
begin
randInt := Random(125);
repeat
login;
if (run = 0) then
begin
turnRunOn;
run := 1;
z := 1;
end;
if(P07_InvFull) then
repeat
makeShafts;
until not FindBitMapToleranceIn(logs, x, y, P07_MIX1, P07_MIY1, P07_MIX2, P07_MIY2, 50)
else
if not (P07_InvFull) then
repeat
ChopTree;
keyTurn(2);
waiting;
P07_MakeCameraAngleHigh;
until (P07_InvFull);
Until (false)
end;
FreeThings;
TerminateScript;
End.
it will hover over the trees, just not click ;/ any1 got any ideas?

Xeronate

2013-03-02 15:42:26

Try putting SRL_EnableNavBar; at the beginning of your chop procedure.
If that doesn't work get rid of ActivateClient; and try it.

blockay

2013-03-02 18:41:55

From: Xeronate
Try putting SRL_EnableNavBar; at the beginning of your chop procedure.
If that doesn't work get rid of ActivateClient; and try it.

neither worked :(