JuKKa
2007-07-31 18:41:36
Why i call it Wireless ent finder is because it does NOT use the mouse :)
Functions:
Procedure GetTreePoints(Ex,Ey: Integer);
Procedure ZeroTreePoints;
Procedure AvoidEnt(Ex, Ey: Integer);
Procedure PrintPoints;
Function CompareTreePoints(Ex, Ey: Integer): Boolean;
Function FindTreeEnt(Ex, Ey: Integer): Boolean;
Function HandleEnt(Ex, Ey: Integer): Boolean;
How To Use:
When you find your "tree" you want to chop. Call: GetTreePoints(Ex,Ey: Integer); (But you should also call the normal which checks for the yellow tex)
Ex And Ey are the cordinates for the tree THESE ARE NOT ALLOWED TO CHANGE!
When you want to check for the ent. Call: HandleEnt(Ex, Ey: Integer): Boolean; Ex And Ey are the Cordinates for the tree.
Info:
It will take 9 "getcolor" and store them to a "array of array" which it then checks if the colors changed. If the colors has changed 5/9 then it has found a ent and will avoid it. If you use this please let me know how it worked.
Functions:
Procedure GetTreePoints(Ex,Ey: Integer);
Procedure ZeroTreePoints;
Procedure AvoidEnt(Ex, Ey: Integer);
Procedure PrintPoints;
Function CompareTreePoints(Ex, Ey: Integer): Boolean;
Function FindTreeEnt(Ex, Ey: Integer): Boolean;
Function HandleEnt(Ex, Ey: Integer): Boolean;
How To Use:
When you find your "tree" you want to chop. Call: GetTreePoints(Ex,Ey: Integer); (But you should also call the normal which checks for the yellow tex)
Ex And Ey are the cordinates for the tree THESE ARE NOT ALLOWED TO CHANGE!
When you want to check for the ent. Call: HandleEnt(Ex, Ey: Integer): Boolean; Ex And Ey are the Cordinates for the tree.
Info:
It will take 9 "getcolor" and store them to a "array of array" which it then checks if the colors changed. If the colors has changed 5/9 then it has found a ent and will avoid it. If you use this please let me know how it worked.
Program RelaxingEntFinder;
{.Include SRL/SRL.Scar}
Var
CTree: Array [0..2] of Array [0..2] of Integer;
I, O, P: Integer;
TempCTree: Array [0..2] of Array [0..2] of Integer;
Procedure GetTreePoints(Ex,Ey: Integer);
Begin
For I:= 0 To 2 Do
For O:= 0 To 2 Do
CTree[I][O]:= GetColor(Ex + I, Ey + O);
End;
Procedure ZeroTreePoints;
Begin
For I:= 0 To 2 Do
For O:= 0 To 2 Do
CTree[I][O]:= -1;
End;
Procedure ZeroTempTreePoints;
Begin
For I:= 0 To 2 Do
For O:= 0 To 2 Do
TempCTree[I][O]:= -1;
End;
Function GetaArrayOfBooleans: Array of Boolean;
Begin
For I:= 0 To 2 Do
For O:= 0 To 2 Do
If(TempCTree[O][I] = CTree[O][I])Then
Begin
SetArrayLength(Result, GetArrayLength(Result) + 1);
Result[getarraylength(result)-1]:= True;
End;
End;
Function CompareTreePoints(Ex, Ey: Integer): Boolean;
Var
BoolArray: Array of Boolean;
Begin
For I:= 0 To 2 Do
For O:= 0 To 2 Do
TempCTree[O][I]:= GetColor(Ex + O, Ey + I);
BoolArray:= GetaArrayOfBooleans;
Writeln('Matching: '+Inttostr(GetArrayLength(BoolArray)) + '/9');
If(GetArrayLength(BoolArray)>=(5))Then
Result:= True;
ZeroTempTreePoints;
If(Result)Then
ZeroTreePoints;
End;
Function FindTreeEnt(Ex, Ey: Integer): Boolean;
Begin
If(Not CompareTreePoints(Ex, Ey))Then
Result:= True;
End;
Procedure AvoidEnt(Ex, Ey: Integer);
Var
FailTimer, OldMouseSpeed: Integer;
Begin
Writeln('Ent Avoidment started');
OldMouseSpeed:= MouseSpeed;
MouseSpeed:= 0;
Mouse(MSCX, MSCY, 5,5, True);
Flag;
MarkTime(FailTimer);
Wait(25+Random(25));
Repeat
GetTreePoints(Ex, Ey);
Wait(2000+Random(2000));
If(Not FindTreeEnt(Ex, Ey))Then
Begin
Writeln('Ent Avoided!');
Break;
End;
If(TimeFromMark(FailTimer)>20000)Then
Begin
Writeln('Fail Safe Timer!, Couldnt Get a "Proper" Ent Avoid :/');
Break;
End;
Until(Not Loggedin);
MouseSpeed:= OldMouseSpeed;
End;
Procedure PrintPoints;
Begin
For I:= 0 To 2 Do
For O:= 0 To 2 Do
Writeln(Inttostr(O)+', '+IntToStr(I) + ': ' + IntToStr(CTree[O][I]));
End;
Function HandleEnt(Ex, Ey: Integer): Boolean;
Begin
If(FindTreeEnt(Ex, Ey))Then
Begin
Result:= True;
AvoidEnt(Ex, Ey);
End;
End;