Rich
2011-06-26 18:19:26
This isn't a thread suggesting one needs to be made, or how to do one, but instead showing one which I've made. It's fairly simple actually.
The user can call the function no matter where they are in the RS world. If they are somewhere along the path to their location when the function is called, it will detect that and carry on from there. If not, it will teleport to Lumbridge and follow the complete path. Since it uses a twist on r_WebWalk as the primary walking method, no path will be same. If, for some reason that fails, it will try to detect the characters location. If that fails too, it will teleport back to Lumbridge and use WalkPath. Resting can be used in the form a var. ResultDist is the distance needed to be from the desired location for the function to result as true. In the unlikely event of both walking methods failing to get the character where the user wants it, they can choose whether or not to teleport to Lumbridge at the end by declaring Lumb as either true or false.
I've tested it a fair amount and it works fantastically. I've checked that the smart path detection works, and it does. I said that I wanted to go to VWB, and was stood in VEB. It detected I was on the path and carried on walking. This could be really useful if you want to relocate an entire army.
More paths to other locations could easily be added if needed.
Thoughts?
{*******************************************************************************
function r_Relocate(Where : string; ResultDist : Integer; Rest, Lumb : Boolean) : Boolean;
By: Rich
Description: Walks to user specified locations
'akb' : Al Kharid bank
'veb' : Varrock East bank
'vwb' : Varrock West bank
'feb' : Falador East bank
'fwb' : Falador West bank
'eb' : Edgeville bank
'db' : Draynor bank
'ge' : Grand Exchange
'ps' : Port Sarim (next to jewellery and axe store)
'lc' : Lumbridge Castle
'rim' : Rimmington (next to the fountain)
ResultDist is the distance to be from the desired location for the function to
result as True.
Rest is whether to rest or not when running along.
Lumb is whether or not to teleport back to Lumbridge if, for some reason, the
function fails to relocate your character.
Start where ever you want to. If you're on the path to your location, it will
detect that and carry on. If not, it'll teleport to Lumbridge and follow the
complete path.
*******************************************************************************}
function r_Relocate(Where : string; ResultDist : Integer; Rest, Lumb : Boolean) : Boolean;
var
I, T, PN, PC, X, Y : Integer;
FinalPoints, Path : TPointArray;
Tele : Boolean;
begin
FinalPoints:= [Point(3270, 3164), Point(3254, 3421), Point(3187, 3439),
Point(3012, 3356), Point(2945, 3369), Point(3093, 3494),
Point(3094, 3242), Point(3165, 3488), Point(3019, 3241),
Point(3224, 3217), Point(2955, 3213)];
case Where of
'akb' : PN:= 0;
'veb' : PN:= 1;
'vwb' : PN:= 2;
'feb' : PN:= 3;
'fwb' : PN:= 4;
'eb' : PN:= 5;
'db' : PN:= 6;
'ge' : PN:= 7;
'ps' : PN:= 8;
'lc' : PN:= 9;
'rim' : PN:= 10;
end;
Result:= (DistanceFrom(FinalPoints[PN]) <= ResultDist);
if Result then
Exit;
case Where of
'akb' : Path:= [Point(3231, 3217), Point(3236, 3207), Point(3244, 3193),
Point(3243, 3178), Point(3242, 3166), Point(3255, 3166),
Point(3263, 3173), Point(3275, 3171), Point(3270, 3164)];
'veb', 'eb',
'vwb', 'ge' : begin
Path:= [Point(3230, 3217), Point(3242, 3224), Point(3257, 3226),
Point(3260, 3238), Point(3254, 3250), Point(3251, 3263),
Point(3242, 3275), Point(3239, 3290), Point(3241, 3306),
Point(3251, 3317), Point(3264, 3324), Point(3278, 3332),
Point(3287, 3345), Point(3296, 3356), Point(3296, 3369),
Point(3294, 3382), Point(3292, 3396), Point(3290, 3409),
Point(3285, 3422), Point(3277, 3429), Point(3263, 3429)];
if (Where <> 'veb') then
begin
Path:= CombineTPA(Path, [Point(3252, 3429), Point(3238, 3430),
Point(3224, 3429), Point(3208, 3429), Point(3194, 3430)]);
if (Where = 'ge') then
Path:= CombineTPA(Path, [Point(3185, 3438), Point(3187, 3447),
Point(3179, 3450), Point(3168, 3459), Point(3165, 3471),
Point(3167, 3480)]);
if (Where = 'eb') then
Path:= CombineTPA(Path, [Point(3176, 3428), Point(3164, 3423),
Point(3150, 3417), Point(3137, 3417), Point(3123, 3417),
Point(3112, 3422), Point(3099, 3420), Point(3092, 3430),
Point(3092, 3441), Point(3096, 3453), Point(3099, 3465),
Point(3097, 3478), Point(3088, 3485), Point(3089, 3492)]);
end;
end;
'ps', 'rim',
'feb', 'db',
'fwb' : begin
Path:= [Point(3228, 3216), Point(3228, 3230), Point(3221, 3242),
Point(3218, 3256), Point(3216, 3270), Point(3204, 3278),
Point(3189, 3280), Point(3175, 3284), Point(3162, 3289),
Point(3147, 3293), Point(3133, 3294), Point(3118, 3293),
Point(3110, 3293)];
if (Where = 'db') then
Path:= CombineTPA(Path, [Point(3109, 3286), Point(3105, 3273),
Point(3105, 3258), Point(3105, 3249), Point(3095, 3247)])
else
Path:= CombineTPA(Path, [Point(3101, 3294), Point(3090, 3288),
Point(3076, 3282), Point(3061, 3276), Point(3046, 3275),
Point(3033, 3276)]);
if (Where = 'ps') then
Path:= CombineTPA(Path, [Point(3029, 3270), Point(3020, 3262),
Point(3018, 3249)]);
if (Where = 'rim') then
Path:= CombineTPA(Path, [Point(3094, 3192), Point(3025, 3276),
Point(3012, 3271), Point(2997, 3266), Point(2985, 3262),
Point(2971, 3255), Point(2960, 3247), Point(2956, 3233),
Point(2956, 3222)]);
if ((Where = 'feb') or (Where = 'fwb')) then
begin
Path:= CombineTPA(Path, [Point(3022, 3277), Point(3012, 3280),
Point(3008, 3293), Point(3006, 3307), Point(3007, 3321),
Point(3007, 3334), Point(3007, 3348), Point(3007, 3362)]);
if (Where = 'fwb') then
Path:= CombineTPA(Path, [Point(2999, 3364), Point(2989, 3372),
Point(2977, 3379), Point(2962, 3381), Point(2951, 3378),
Point(2945, 3375)]);
end;
end;
end;
Path:= CombineTPA(Path, [FinalPoints[PN]]);
ClickNorth(True);
Tele:= True;
for I:= 0 to High(Path) do
begin
if (DistanceFrom(Point(Path[I].x, Path[I].y)) < 15) then
begin
if (DistanceFrom(Point(Path[I + 1].x, Path[I + 1].y)) < 15) then
Inc(I);
if r_WebWalk(Path[I]) then
begin
I:= I;
Tele:= False;
Break;
end else
I:= 0;
end;
end;
if Tele then
begin
GameTab(tab_Magic);
SetupSpells;
Cast('lumbridge home teleport', False);
while (DistanceFrom(Point(3224, 3217)) > 15) do
begin
Wait(100);
IncEx(T, 100);
if (T > 15000) then
Break;
end;
Wait(2500 + Random(2000));
end;
SetAngle(True);
for I:= I to High(Path) do
begin
case r_GetMMLevels('run') of
0..30 : if Rest then
begin
RestUntil(75);
SetRun(True);
end;
40..100 : SetRun(True);
end;
if (Rest and FindSymbolIn(X, Y, 'rest', MMCX - 45, MMCY - 45, MMCX + 45, MMCY + 45)
and (r_GetMMLevels('run') < 70)) then
begin
Mouse(X, Y, 1, 1, True);
R_Flag;
RestUntil(100);
SetRun(True);
end;
if not r_WebWalk(Path[I]) then
begin
for PC:= 0 to High(Path) do
begin
if (DistanceFrom(Path[PC]) < 15) then
begin
r_WebWalk(Path[PC]);
I:= PC;
Break;
end;
I:= -1;
end;
if (I = -1) then
begin
WriteLn('Could not walk to ' + Where + ' using r_WebWalk method - attempting WalkPath');
Break;
end;
end;
Wait(500 + Random(500));
end;
Result:= (DistanceFrom(FinalPoints[PN]) <= ResultDist);
if Result then
Exit;
Result:= WalkPath(Path);
if ((not Result) and Lumb) then
begin
Cast('lumbridge home teleport', False);
WriteLn('Could not walk to ' + Where + ' using either method');
WriteLn('May or may not be at Lumbridge Castle depending on ''Lumb''');
end;
end;
The user can call the function no matter where they are in the RS world. If they are somewhere along the path to their location when the function is called, it will detect that and carry on from there. If not, it will teleport to Lumbridge and follow the complete path. Since it uses a twist on r_WebWalk as the primary walking method, no path will be same. If, for some reason that fails, it will try to detect the characters location. If that fails too, it will teleport back to Lumbridge and use WalkPath. Resting can be used in the form a var. ResultDist is the distance needed to be from the desired location for the function to result as true. In the unlikely event of both walking methods failing to get the character where the user wants it, they can choose whether or not to teleport to Lumbridge at the end by declaring Lumb as either true or false.
I've tested it a fair amount and it works fantastically. I've checked that the smart path detection works, and it does. I said that I wanted to go to VWB, and was stood in VEB. It detected I was on the path and carried on walking. This could be really useful if you want to relocate an entire army.
More paths to other locations could easily be added if needed.
Thoughts?