killm3
2014-11-15 22:41:24
I'm new and thought I'd contribute.
spinDo is a single function that does pretty much everything you'd want from a script in a single function.
The script makes sure your character has stayed within the pre-defined area (and walks there if not), finds whatever object you're looking for, and performs an action.
MAKE SURE TO SET CAMERA TO HIGHEST ANGLE
Feel free to include it in any script you want.
Here's an example of a very stable and short power-woodcutting script that can run for hours if you add in antirandoms.
spinDo is a single function that does pretty much everything you'd want from a script in a single function.
The script makes sure your character has stayed within the pre-defined area (and walks there if not), finds whatever object you're looking for, and performs an action.
MAKE SURE TO SET CAMERA TO HIGHEST ANGLE
{*******************************************************************************
Function R_spinDo(objectName, objectAction: String; centerOfRovingArea: TPoint;
radiusOfRovingArea, searchDistance, howLongToSearch: Integer;)
By: A Proud American
Description: Basically an AIO function to reliably search an area for an object
and perform an action on it. Works best if object isn't moving (non-NPC).
*******************************************************************************}
Function R_spinDo(objectName, objectAction: String; centerOfRovingArea: TPoint; radiusOfRovingArea, searchDistance, howLongToSearch: Integer): Boolean;
var
Timer: Integer;
hereWeAre, hereWeAreLooking: TPoint;
begin
//Make sure we are within (radiusOfRovingArea) of (centerOfRovingArea)
if not (R_NearTile(centerOfRovingArea,radiusOfRovingArea)) then
begin
R_BlindWalk(centerOfRovingArea[ATTACH]24445[/ATTACH]);
end;
//Begin Spinning
KeyDown(VK_RIGHT);
//Mark the time we started Spinning
markTime(Timer);
//Start Main search Cycle
repeat
//Log out current tile
hereWeAre := R_GetTileGlobal();
//Move the Mouse to a a random tile within (searchDistance)
hereWeAreLooking := Point((hereWeAre.x + RandomRange(1, searchDistance)), hereWeAre.y);
hereWeAreLooking := R_TileToMs(hereWeAreLooking);
MMouse(hereWeAreLooking.x,hereWeAreLooking.y,10,10);
Wait(RandomRange(1111, 2222)+RandomRange(1, 555));
//Continue Spinning until we find the object or we timeout
until((R_IsUpText(objectName) = true) or (timeFromMark(Timer)>howLongToSearch))
//Stop Spinning
KeyUp(VK_RIGHT);
KeyUp(VK_LEFT);
//Confirm that object and action are under the mouse
if(R_IsUpText((objectAction + ' ' + objectName)) = true) then
begin
ClickMouse2(Mouse_Right);
Wait(RandomRange(11, 77)+RandomRange(1, 555));
R_ChooseOption((objectAction + ' ' + objectName));
Result := true;
end else
begin
Result := false;
end;
end;Feel free to include it in any script you want.
Here's an example of a very stable and short power-woodcutting script that can run for hours if you add in antirandoms.
procedure cutTrees;
begin
repeat
repeat
//objectName, objectAction, centerOfRovingArea, radiusOfRovingArea, searchDistance, howLongToSearch
if(R_spinDo('Willow', 'Chop down', Point(2917, 3298), 15, 5, 10000) = true) then
begin
//If the above returned true, give the character time to start performing action
Wait(RandomRange(3333, 5555)+RandomRange(1, 555));
while (R_IsAnimating = true) do
begin
Writeln('Performing Action!');
Wait(RandomRange(3333, 5555)+RandomRange(1, 555));
end;
end;
until(R_InvCount = 28)
Writeln('Finished Chopping, Dropping Logs!');
DropArray([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28]);
clearDebug;
until(false);
end;