gerauchert
2009-01-15 16:32:32
Here is what I am currently using in my script…
This Function seems to have a few flaws in it that I would like to get kinked out. First, the function overall seems to be working great, BUT it doesnt seem to always recognize trees that are on the main screen. For example, there may be two willows on the ms and it will click the minimap to one that is far away. So I was wondering if there was a better way to code this so that it will more readily recognize ms trees verses trees on the mm.
Second, during willow chopping it seems to have trouble locating trees (mainly when the trees are being chopped down often) and it never seems to "recover" and it will just lag out until my failsafe kicks in after 60 sec for not finding the tree. Is there anyway to speed up the tree finding or anything?
Thirdly, when there isnt any trees left on the ms (normal tree chopping) it seems to click trees via the mm from the very outside of the minimap causing my char to get lost at times. Is there a way to search for the closest trees from where your characters position is?
Any help would be appreciated.
Function ClickTree: Boolean;
var
ID: TIntegerArray;
i : Integer;
xy,xz: TPoint;
begin
if(not(LoggedIn))then Exit;
Status('Searching For Tree');
case Players[CurrentPlayer].Strings[0] of
'Normal': ID := [1278,1276];
'Oak' : ID := [1281];
'Willow': ID := [5553,5552,5551];
end;
for i := 0 to Length(ID)-1 do
begin
if(FindObject(xy,ID[i]))then
begin
if(TileOnMs(xy,150))then
begin
xz := TileToMs(xy,150);
MMouse(xz.x+40,xz.y-35,15,15);
if(RandMouse('hop'))then
begin
Status('');
Result := True;
Exit;
end;
end else
if(TileOnMM(xy))then
begin
WalkToTile(xy,2,0);
FFlag(0);
xz := TileToMs(xy,150);
MMouse(xz.x+40,xz.y-35,15,15);
if(RandMouse('hop'))then
begin
Status('');
Result := True;
Exit;
end;
end;
end;
end;
Result := False;
end;
This Function seems to have a few flaws in it that I would like to get kinked out. First, the function overall seems to be working great, BUT it doesnt seem to always recognize trees that are on the main screen. For example, there may be two willows on the ms and it will click the minimap to one that is far away. So I was wondering if there was a better way to code this so that it will more readily recognize ms trees verses trees on the mm.
Second, during willow chopping it seems to have trouble locating trees (mainly when the trees are being chopped down often) and it never seems to "recover" and it will just lag out until my failsafe kicks in after 60 sec for not finding the tree. Is there anyway to speed up the tree finding or anything?
Thirdly, when there isnt any trees left on the ms (normal tree chopping) it seems to click trees via the mm from the very outside of the minimap causing my char to get lost at times. Is there a way to search for the closest trees from where your characters position is?
Any help would be appreciated.