SRL Archive - Help and Support

My TPA Works but whenever it finds it...


Camaro'

2008-11-04 18:11:36

Function ChopAnyTree:Boolean;
var
TPA:TpointArray;
TpatoTpa: T2DPointArray;
z,x,y,i,fail:integer;
utbool,tbool:boolean;
begin
if (not(loggedin)) then exit;
utbool:=false;
marktime(fail);
colortolerancespeed(2);
SetColorspeed2Modifiers(0.1, 1.4);
Case WhatTree of
'willow':FindColorsTolerance(TPA, randomwillowcolor, 135,75,473,307,3);
'oak':begin
SetColorspeed2Modifiers(0.1, 1.4);
FindColorsTolerance(TPA, 4819838, 135,75,473,307,3);
end;
'tree':begin
FindColorsTolerance(TPA, 4819838, 135,75,473,307,3);
SetColorspeed2Modifiers(0.1, 1.4);
end;

end;
ColorToleranceSpeed(1);
SetColorspeed2Modifiers(0.2, 0.2);
TPAtoTPA := TPAtoATPAEx(TPA, 15, 15);
z:=high(tpatotpa);
For I:= 0 to z do
MiddleTPAEx(TpaToTPA[i], x, y);
if inRange(x,msx1,msx2) then
if inRange(y,msy1,msy2) then
begin
MMouse(x,y,5,5);
Case WhatTree Of
'willow': begin
if isUpTextMultiCustom(['ill','illow']) then
end;
'oak': begin
if isUpText('ak') then
end;
'tree': begin
if isUpTextMultiCustom(['re','ee']) then
end;
end;
begin
//c2 := Getcolor(x,y);
//checkent;
UTbool:=true;
result:=true;
end;
If not UTBOOL Then
begin
exit;
end;
wait(50+random(50));
If UTBool then
begin
mouse(x,y,0,0, false);
writeln('clicked');
wait(30+random(20));
Case WhatTree of
'oak':begin
if chooseoption('ak') then
TBool:=true;
end;
'tree':begin
if chooseoption('ree') then
Tbool:=true;
end;
'willow':begin
if chooseoption('illow') then
Tbool:=true;
end;
end;
If not TBool then exit;
If UTBool then
begin
writeln('Took '++IntToStr(TimeFromMark(fail))+' Ms to find the tree');
randoms;
///checkent;
axebroken;
theantiban;
result:=true;
wait(7130+random(2120));
end;
end;
end;
end;


There is my TPA, it finds the TPA Fine, but lets say im searching for oaks. It will keep right clicking a regular tree thinking its an oak. Same if im searching for trees it will keep right clicking an oak.

Example:

Searching for Oak. It finds a regular tree by mistake instead of an oak, but it keeps right clicking it hoping the choose option will change =[. If it happens to find an oak before it finds the tree. IT runs very well.

Can anyone help me on this? Maybe try and get it to move the mouse to a different spot. I have no idea, i have been working on this for a while.

Narcle

2008-11-04 18:33:04

I think I just remade your function, but its the same concept:
Function ChopAnyTree:Boolean;
var
TreeText: TStringArray;
TreeChooseOption: string;
TPA:TpointArray;
TpatoTpa: T2DPointArray;
z,x,y,i,fail, TreeColor:integer;
utbool,tbool:boolean;
begin
if (not(loggedin)) then
Exit;

Case WhatTree of
'willow':
begin
TreeText := ['ill','illow'];
reeColor := randomwillowcolor;
TreeChooseOption := 'illow';
end;
'oak':
begin
TreeText := ['ak','Oak'];
TreeColor := 4819838;
TreeChooseOption := 'ak';
end;
'tree':
begin
TreeText := ['re','ee','ree'];
TreeColor := 4819838;
TreeChooseOption := 'ree';
end;
end;
marktime(fail);

{Case WhatTree of //All of this isnt needed
'willow':FindColorsTolerance(TPA, randomwillowcolor, 135,75,473,307,3);
'oak':begin
SetColorspeed2Modifiers(0.1, 1.4);
FindColorsTolerance(TPA, 4819838, 135,75,473,307,3);
end;
'tree':begin
FindColorsTolerance(TPA, 4819838, 135,75,473,307,3);
SetColorspeed2Modifiers(0.1, 1.4);
end;

end; }

colortolerancespeed(2);
SetColorspeed2Modifiers(0.1, 1.4);
FindColorsTolerance(TPA, TreeColor, 135,75,473,307,3);
ColorToleranceSpeed(1);
SetColorspeed2Modifiers(0.2, 0.2);
TPAtoTPA := TPAtoATPAEx(TPA, 15, 15);
z:=high(tpatotpa);
For I:= 0 to z do//you have no begin, this will only loop the one line below it
begin//added
MiddleTPAEx(TpaToTPA[i], x, y);
{ if inRange(x,msx1,msx2) then
if inRange(y,msy1,msy2) then}
if PointInBox(Point(x, y), IntToBox(MSX1, MSY1, MSX2, MSY2)) then
begin
MMouse(x,y,5,5);
Wait(150+random(100));//This wait is NEEDED.

{Case WhatTree Of //This is your problem you can't have if-then in a case afaik
'willow': begin
if isUpTextMultiCustom(['ill','illow']) then
end;
'oak': begin
if isUpText('ak') then
end;
'tree': begin
if isUpTextMultiCustom(['re','ee']) then
end;
end; }

{ begin
//c2 := Getcolor(x,y);
//checkent;
UTbool:=true;
result:=true;
end;
If not UTBOOL Then
Exit;
}
//wait(50+random(50)); this wait isn't needed

if isUpTextMultiCustom(TreeText) then
begin
GetMousePos(x,y);//Very important!!!
mouse(x,y,0,0, false);
writeln('clicked');
wait(30+random(20));
{
Case WhatTree of //This is your problem you can't have if-then in a case afaik
'oak':begin
if chooseoption('ak') then
TBool:=true;
end;
'tree':begin
if chooseoption('ree') then
Tbool:=true;
end;
'willow':begin
if chooseoption('illow') then
Tbool:=true;
end;
end; }

If ChooseOption(TreeChooseOption) then
begin
writeln('Took '++IntToStr(TimeFromMark(fail))+' Ms to find the tree');
randoms;
///checkent;
axebroken;
theantiban;
result := true;
wait(7130+random(2120));
end;
end;
end;
end;//added for loop
end;

Camaro'

2008-11-04 18:50:37

From: Narcle
I think I just remade your function, but its the same concept:
Function ChopAnyTree:Boolean;
var
TreeText: TStringArray;
TreeChooseOption: string;
TPA:TpointArray;
TpatoTpa: T2DPointArray;
z,x,y,i,fail, TreeColor:integer;
utbool,tbool:boolean;
begin
if (not(loggedin)) then
Exit;

Case WhatTree of
'willow':
begin
TreeText := ['ill','illow'];
reeColor := randomwillowcolor;
TreeChooseOption := 'illow';
end;
'oak':
begin
TreeText := ['ak','Oak'];
TreeColor := 4819838;
TreeChooseOption := 'ak';
end;
'tree':
begin
TreeText := ['re','ee','ree'];
TreeColor := 4819838;
TreeChooseOption := 'ree';
end;
end;
marktime(fail);

{Case WhatTree of //All of this isnt needed
'willow':FindColorsTolerance(TPA, randomwillowcolor, 135,75,473,307,3);
'oak':begin
SetColorspeed2Modifiers(0.1, 1.4);
FindColorsTolerance(TPA, 4819838, 135,75,473,307,3);
end;
'tree':begin
FindColorsTolerance(TPA, 4819838, 135,75,473,307,3);
SetColorspeed2Modifiers(0.1, 1.4);
end;

end; }

colortolerancespeed(2);
SetColorspeed2Modifiers(0.1, 1.4);
FindColorsTolerance(TPA, TreeColor, 135,75,473,307,3);
ColorToleranceSpeed(1);
SetColorspeed2Modifiers(0.2, 0.2);
TPAtoTPA := TPAtoATPAEx(TPA, 15, 15);
z:=high(tpatotpa);
For I:= 0 to z do//you have no begin, this will only loop the one line below it
begin//added
MiddleTPAEx(TpaToTPA[i], x, y);
{ if inRange(x,msx1,msx2) then
if inRange(y,msy1,msy2) then}
if PointInBox(Point(x, y), IntToBox(MSX1, MSY1, MSX2, MSY2)) then
begin
MMouse(x,y,5,5);
Wait(150+random(100));//This wait is NEEDED.

{Case WhatTree Of //This is your problem you can't have if-then in a case afaik
'willow': begin
if isUpTextMultiCustom(['ill','illow']) then
end;
'oak': begin
if isUpText('ak') then
end;
'tree': begin
if isUpTextMultiCustom(['re','ee']) then
end;
end; }

{ begin
//c2 := Getcolor(x,y);
//checkent;
UTbool:=true;
result:=true;
end;
If not UTBOOL Then
Exit;
}
//wait(50+random(50)); this wait isn't needed

if isUpTextMultiCustom(TreeText) then
begin
GetMousePos(x,y);//Very important!!!
mouse(x,y,0,0, false);
writeln('clicked');
wait(30+random(20));
{
Case WhatTree of //This is your problem you can't have if-then in a case afaik
'oak':begin
if chooseoption('ak') then
TBool:=true;
end;
'tree':begin
if chooseoption('ree') then
Tbool:=true;
end;
'willow':begin
if chooseoption('illow') then
Tbool:=true;
end;
end; }

If ChooseOption(TreeChooseOption) then
begin
writeln('Took '++IntToStr(TimeFromMark(fail))+' Ms to find the tree');
randoms;
///checkent;
axebroken;
theantiban;
result := true;
wait(7130+random(2120));
end;
end;
end;
end;//added for loop
end;


LOL Nice job NARCLE. Ill Test it and get back to you.

Oh wow, didnt see all minor mistakes i messed up on. Im gonna test it

Narcle

2008-11-04 18:52:48

Oh need to add a Exit in if ChooseOption then part

Nava2

2008-11-04 19:13:16

By the way, you can have an if in a case :)

Camaro'

2008-11-04 19:21:14

Narcle - Thanks it works really good now. I just gotta lower the tolerance just a little bit. Finds the floor sometimes. Thanks!

P1nky

2008-11-04 19:24:29

narcle= TPA Master.

btw thought your gonna be inactive now?

Camaro'

2008-11-04 19:51:02

From: ~~Joker~~
narcle= TPA Master.

btw thought your gonna be inactive now?


I am going to release my last script to the community, within my spare time. Then im gonna be seriously inactive.(today i had day off) election day.

Narcle

2008-11-05 01:06:42

From: Nava2
By the way, you can have an if in a case :)


Can you? Looks horrible imo. :eek:

MylesMadness

2008-11-05 18:56:36

From: Narcle
Can you? Looks horrible imo. :eek:
I though it was just an else. I KNOW you can do an else