Runescapian321
2009-05-18 02:52:54
See/Download the whole script here - http://www.villavu.com/forum/showthread.php?t=45152
1) I use a variation of WalkToTileMS to chop trees. Basically it just clicks the tiles on which the trees are standing. Problem is, even though I've included randomness on the tiles, it always clicks the same tile to chop the tree.
When it detects the door as open (not ID = 1533), it does that really quickly, but when it's closed, it takes a good bit of time (5-8 seconds) for it to open it. I guess this is because of ClickDoor, any suggestions on how to speed it up?
1) I use a variation of WalkToTileMS to chop trees. Basically it just clicks the tiles on which the trees are standing. Problem is, even though I've included randomness on the tiles, it always clicks the same tile to chop the tree.
{*******************************************************************************
Function ChopItMS(Tile: TPoint; Randomness, FlagD: Integer): Boolean;
By: Nava2 edited by Runescapian to chop trees instead
Description: Walks to the tile using the mainscreen. Similar to SRLs version.
Thanks to lordsaturn for the idea.
*******************************************************************************}
function ChopItMS(Tile: TPoint; Randomness, FlagD: Integer): Boolean;
var
P: TPoint;
T : Integer;
begin
Result := False;
Tile := Point(RandomRange(Tile.X - Randomness, Tile.X + Randomness), RandomRange(Tile.Y - Randomness, Tile.Y + Randomness));
P := TileToMS(Tile, Random(5));
if not TileOnMS(Tile, 0) then Exit;
MMouse(P.x, P.y, 5, 5);
Wait(RandomRange(80, 100));
GetMousePos(P.x, P.y);
if Pos('hop', GetUpText) <> 0 then
Mouse(P.x, P.y, 0, 0, True)
else
begin
Mouse(P.x, P.y, 0, 0, False);
Wait(RandomRange(80, 100));
ChooseOption('hop');
end;
T := GetSystemTime;
Wait(RandomRange(80, 100));
R_FFlag(FlagD);
Result := (GetSystemTime - T) < 60000;
End;Function ChopTrees: boolean;
var
ChopTime,Chopping,strikes: integer;
TreeInfo1, TreeInfo2, TreeInfo3, TreeInfo4: UID;
begin
if not(loggedin) then
begin
SwitchPlayer(true);
exit;
end;
Distat('Chopping Trees');
SetRun(true);
MarkTime(ChopTime);
repeat
if not(loggedin) then loginplayer;
TreeInfo1 := GetObjectAt(randomrange(2968,2969),3194);
if (TreeInfo1.objtype = 5553) then
begin
ChopItMS(point(2968+random(1),3194),0,0); //Note the +random(1)
FindNormalRandoms;
R_FindRandoms;
wait(3000+Random(500));
strikes := 0;
MarkTime(Chopping);
repeat
if not(GetAnimation > 840) then
break;
if (InvFull) then
break;
DoAntiban;
FindNormalRandoms;
R_FindRandoms;
Distat(InttoStr(InvCount)+' Inventory Spots filled');
until(TimeFromMark(chopping) > 600000);
end else
begin
TreeInfo2 := GetObjectAt(2970,3194);
if (TreeInfo2.objtype = 5552) then
begin
ChopItMS(point(2970+random(1),3193+random(1)),0,0);
wait(3000+Random(500));
strikes := 0;
FindNormalRandoms;
R_FindRandoms;
MarkTime(Chopping);
repeat
if not(GetAnimation > 840) then
break;
if (InvFull) then
break;
DoAntiban;
FindNormalRandoms;
R_FindRandoms;
Distat(InttoStr(InvCount)+' Inventory Spots filled');
until(TimeFromMark(Chopping) > 600000);
end else
begin
TreeInfo3 := GetObjectAt(2973,3196);
if (TreeInfo3.objtype = 5551) then
begin
ChopItMS(point(2973+random(1),3195+random(1)),0,0);
wait(3000+Random(500));
FindNormalRandoms;
R_FindRandoms;
strikes := 0;
MarkTime(Chopping);
repeat
if not(GetAnimation > 840) then
break;
if (InvFull) then
break;
DoAntiban;
FindNormalRandoms;
R_FindRandoms;
Distat(InttoStr(InvCount)+' Inventory Spots filled');
until(TimeFromMark(Chopping) > 600000);
end else
begin
TreeInfo4 := GetObjectAt(2968,3192);
if (TreeInfo4.objtype = 5551) then
begin
ChopItMS(point(2968+random(1),3191+random(1)),0,0);
wait(3000+Random(500));
strikes := 0;
FindNormalRandoms;
R_FindRandoms;
MarkTime(Chopping);
repeat
if not(GetAnimation > 840) then
break;
if (InvFull) then
break;
DoAntiban;
FindNormalRandoms;
R_FindRandoms;
Distat(InttoStr(InvCount)+' Inventory Spots filled');
until(TimeFromMark(Chopping) > 600000);
end else
begin
WalkToTile(point(2969,3195),0,0);
Inc(strikes);
FindNormalRandoms;
R_FindRandoms;
debug('strikes = '+IntToStr(strikes));
if (strikes > 100) then
begin
writeln('Haven''t found any trees for a while. Next Player.');
Players[CurrentPlayer].strings[0] := 'Didn''t find trees for a while';
SwitchPlayer(false);
result := false;
exit;
end;
wait(1000+random(500));
end;
end;
end;
end;
until(InvFull) or (TimeFromMark(choptime) > 3600000);
if (InvFull) then
result := true;
end;2) There's a large delay when my script is trying to open a door. Function HandleDoor: boolean;
var
DoorInfo: UID;
begin
if not(loggedin) then
begin
SwitchPlayer(true);
exit;
end;
FindNormalRandoms;
R_FindRandoms;
DoorInfo := GetObjectAt(2951,3214);
if (DoorInfo.ObjType = 1533) then
begin
debug('DOOR CLOSED, attempting to open');
if (ClickDoor(DoorInfo.objtype,'w','pen')) then
begin
wait(2000+random(1000));
debug('Opened door');
Inc(DoorsOpened);
result := true;
exit;
end;
result := false;
writeln('Failed opening closed door. Next Player.');
Players[CurrentPlayer].strings[0] := 'Door opening failed';
switchplayer(false);
exit;
end;
result := true;
end;When it detects the door as open (not ID = 1533), it does that really quickly, but when it's closed, it takes a good bit of time (5-8 seconds) for it to open it. I guess this is because of ClickDoor, any suggestions on how to speed it up?