SRL Archive - Research & Development Lounge

WebWalk Include


ReadySteadyGo

2011-03-27 20:17:50

It's here :)

Put this in your Includes folder: http://rsg.frement.net/WebWalk.simba

You can test it out with the script below. WebWalkEx will walk to a tile specified by it's co-ordinates, WebWalk will walk to a tile specified by it's bookmark ID (these are defined by Constants at the top of the include.) You will need to be in varrock until the web is more completed.

Currently I have only made a web for Varrock and that's still not complete. To contribute by building the web, please see this thread: http://villavu.com/forum/showthread.php?p=793027

program WebWalkTest;
{$DEFINE SMART}
{.include SRL/SRL.scar}
{.include Reflection/Reflection.simba}
{.include WebWalk.simba}

const
WORLD = 121;
MEMBERS = false;
SIGNED = true;

begin
Smart_Members := MEMBERS;
Smart_Server := WORLD;
Smart_Signed := SIGNED;
SetupSRL;
SetUpReflection;

LoadWeb;

//WebWalkEx(Point(3186, 3439), WorldMap); // Varrock West Bank
WebWalk(VARROCK_WEST_BANK, WorldMap);
end.

TomTuff

2011-03-27 23:04:10

Do you have a p2p web as well? :)

ReadySteadyGo

2011-03-27 23:57:29

I don't have a p2p account. The idea is that I made webber (in the link) so that anybody can add or contribute areas. This takes the work load off one person.

MaryJane

2011-03-30 01:49:48

154 WriteLn('Walked shortest path to Target Node');
155 else
156 WriteLn('Failed to make it through the web!');

[Error] C:\Simba\Includes\WebWalk.simba(156:5): Identifier expected at line 155
Compiling failed.

Confusion.

Iamadam

2011-03-30 01:57:33

remove the semicolon from the end of line 154

beats-

2011-03-30 11:06:17

Thankyou, Iamadam.

Walker works great!
=D!

Emaziz

2011-03-30 11:58:30

Jizz! I'm totally gonna try this out :D

grats

2011-04-09 21:29:01

Did jagex do something to break web walking for us..? all my scripts go in a totally different direction now.

only the WebWalkEx(

does it.. idk why.. used the same thing like 10 + times already & now it's walking the exact opposite way no matter what I put the points as

sm0k3

2011-04-09 21:55:09

WebWalking still works fine for me .. my snaperunners pulling snape in doubletime .. im using Webwalk(); and Blindwalk();

grats

2011-04-09 22:45:14

From: sm0k3
WebWalking still works fine for me .. my snaperunners pulling snape in doubletime .. im using Webwalk(); and Blindwalk();


Yea, all those work fine for me.. along with the ultimate firemaker script, that works great..

idk =[

ReadySteadyGo

2011-04-11 06:18:44

From: grats
Yea, all those work fine for me.. along with the ultimate firemaker script, that works great..

idk =[


Have you checked the offsets in options? Then export the web again.

Glad to see it being used. I'll try to solve the maximum amount of input bug this week.

sm0k3

2011-04-25 13:36:05

Heyup i hope you dont mind readySteadyGo but i have made a few modifications to your webWalk ..

i have found it slow to Begin the Walk at times
i have fixed this i think .. works for me :)
by Moving Closest Node into its own Function and
Added DoWalk to detect Run energy over 50% and to Enable Run


// WebWalk.simba by ReadySteadyGo
// Updated By Sm0K3 : Moved ClosestNode into own Function . Reason: i found that this would speed up the start of the walking process

// : Added Energy detection and running . Reason: So You Can RUN
const // Location Bookmarks
VARROCK_EAST_BANK = 0;
VARROCK_WEST_BANK = 48;


const // Maps
WORLD_MAP = 0;

type
TGraph = record
Node : TPointArray;
Edge : TPointArray;
Dist : TIntegerArray;
Previous : TIntegerArray;
Visited : Array Of Boolean;
end;

var
WorldMap: TGraph;


// Loads the Web information
procedure LoadWeb;
begin
WorldMap.Node := [Point(3254, 3422), Point(3248, 3430), Point(3235, 3431), Point(3224, 3429), Point(3213, 3425), Point(3203, 3430), Point(3191, 3431), Point(3177, 3429), Point(3165, 3426), Point(3155, 3418), Point(3142, 3417), Point(3131, 3417), Point(3117, 3420), Point(3109, 3422), Point(3097, 3421), Point(3271, 3430), Point(3282, 3429), Point(3287, 3421), Point(3289, 3412), Point(3291, 3400), Point(3292, 3389), Point(3260, 3429), Point(3263, 3416), Point(3259, 3406), Point(3253, 3401), Point(3252, 3395), Point(3242, 3390), Point(3230, 3391), Point(3220, 3391), Point(3212, 3390), Point(3211, 3402), Point(3211, 3411), Point(3211, 3419), Point(3212, 3378), Point(3216, 3366), Point(3223, 3359), Point(3198, 3422), Point(3204, 3412), Point(3212, 3436), Point(3201, 3444), Point(3191, 3453), Point(3178, 3458), Point(3167, 3464), Point(3164, 3474), Point(3164, 3486), Point(3172, 3453), Point(3173, 3440), Point(3185, 3450), Point(3186, 3440), Point(3170, 3414), Point(3171, 3403), Point(3174, 3392), Point(3179, 3383)];
WorldMap.Edge := [Point(0, 1), Point(1, 2), Point(2, 3), Point(3, 4), Point(4, 5), Point(5, 6), Point(6, 7), Point(7, 8), Point(8, 9), Point(9, 10), Point(10, 11), Point(11, 12), Point(12, 13), Point(13, 14), Point(15, 16), Point(16, 17), Point(17, 18), Point(18, 19), Point(19, 20), Point(0, 21), Point(21, 22), Point(22, 23), Point(23, 24), Point(22, 0), Point(1, 21), Point(21, 15), Point(23, 25), Point(25, 26), Point(26, 27), Point(27, 28), Point(28, 29), Point(29, 30), Point(30, 31), Point(31, 32), Point(32, 4), Point(29, 33), Point(33, 34), Point(34, 35), Point(6, 36), Point(36, 37), Point(37, 30), Point(3, 38), Point(38, 39), Point(39, 40), Point(40, 41), Point(41, 42), Point(42, 43), Point(43, 44), Point(42, 45), Point(45, 46), Point(41, 47), Point(47, 48), Point(48, 6), Point(48, 7), Point(7, 46), Point(46, 8), Point(8, 49), Point(49, 50), Point(50, 51), Point(51, 52)];
end;
procedure DoRun;
begin
if R_GetMMLevels('run') > 50 then
SetRun(True);
end;
// Finds the Closest Node in 'Graph' from the location 'Source'
function ClosestNode(Source: TPoint; Graph: TGraph): Integer;
var i: Integer;
begin
Result := 0;
for i:= 0 to High(Graph.Node) do
begin
if Distance(Source.x, Source.y, Graph.Node[i].x, Graph.Node[i].y) < Distance(Source.x, Source.y, Graph.Node[Result].x, Graph.Node[Result].y) then
Result := i;
end;
end;

// Blindly Walks to 'Target'
function BlindWalk(Target: TPoint): Boolean;
begin
Result := r_WebWalk(PointToTile(Target));
end;

// Uses the Dijkstra algorithm to determine the shortest path
function ShortestPath(Source, Target: Integer; Graph: TGraph):TIntegerArray;
var
i, u: Integer;
Current, TempDist: Integer;
Neighbours: TIntegerArray;
begin
SetLength(Graph.Dist, Length(Graph.Node));
SetLength(Graph.Previous, Length(Graph.Node));
SetLength(Graph.Visited, Length(Graph.Node));

for i:= 0 to high(Graph.Node) do // Initializations
begin
Graph.Dist[i] := -1; // Unknown distance function from source to v
Graph.Previous[i] := -1; // Previous node in optimal path from source
Graph.Visited[i] := False;
end;

Graph.Dist[source] := 0; // Distance from source to source
Current := source;

repeat
SetLength(Neighbours, 0);
for i := 0 to high(Graph.Edge) do
begin
if Graph.Edge[i].x = Current then
begin
SetLength(Neighbours, Length(Neighbours) + 1);
Neighbours[High(Neighbours)] := Graph.Edge[i].y;
end;
if Graph.Edge[i].y = Current then
begin
SetLength(Neighbours, Length(Neighbours) + 1);
Neighbours[High(Neighbours)] := Graph.Edge[i].x;
end;
end;

for i := 0 to High(Neighbours) do //Check Unvisited Neighbour Nodes
begin
if Graph.Visited[Neighbours[i]] then
Continue;

TempDist := Distance(Graph.Node[Neighbours[i]].x, Graph.Node[Neighbours[i]].y, Graph.Node[Current].x, Graph.Node[Current].y);

TempDist := Graph.Dist[Current] + TempDist;
if (TempDist < Graph.Dist[Neighbours[i]]) or (Graph.Dist[Neighbours[i]] = -1) then
begin
Graph.Dist[Neighbours[i]] := TempDist;
Graph.Previous[Neighbours[i]] := Current;
end;
end;
Graph.Visited[Current] := True;

if (Current = Target) then
Break;

Tempdist := -1;
for i:= 0 to high(Graph.Node) do // Node with smallest Dist
begin

if (Graph.Dist[i] = - 1) or Graph.Visited[i] then
Continue;
if (Graph.Dist[i] < TempDist) or (TempDist = -1) then
begin
TempDist := Graph.Dist[i];
Current := i;
end;

end;

until False;
// Traces Shortest Path

u := Target;
SetLength(Result, 0);
repeat
SetLength(Result, Length(Result)+1);
for i := High(Result) - 1 downto 0 do
Result[i+1] := Result[i];
Result[0] := u; //insert u at the beginning of S
if u = Source then
Break;
u := Graph.Previous[u];
until False;
end;

// Walks to the Closest node in the TGraph: CGraph
Function WalkTOcNode(CLoc:Integer; CGraph:TGraph): Boolean;
var i, cNode: Integer;
begin
cNode := ClosestNode(GetMyPos,CGraph);
if BlindWalk(CGraph.Node[cNode]) then
begin
WriteLn('Blind Walked to nearest Node');
end else
WriteLn('Failed to reach nearest node!');
end;


// Walks from your current position to the TargetNode which uses the Bookmark Constants at the top of this Include
function WebWalk(TargetNode: Integer; Graph: TGraph): Boolean;
var
i, cNode: Integer;
IntArray: TIntegerArray;
PtArray: TPointArray;
begin
cNode := ClosestNode(GetMyPos, Graph);
IntArray := ShortestPath(cNode, TargetNode, Graph);
SetLength(PtArray, Length(IntArray));

for i:= 0 to High(IntArray) do
PtArray[i] := Graph.Node[IntArray[i]];
DoRun;
Result := WalkPath(PtArray);
if Result then
begin
WriteLn('Walked shortest path to Target Node');
end else
WriteLn('Failed to make it through the web!');
end;

// Walks from your current position to the tile defined by 'Target'
function WebWalkEx(Target: TPoint; Graph: TGraph): Boolean;
var
ClosestToTarget: Integer;
begin
Result := False;
ClosestToTarget := ClosestNode(Target, Graph);
DoRun;
if WebWalk(ClosestToTarget, Graph) then
Result := BlindWalk(Target);
if Result then
begin
WriteLn('Blind Walked to Target Tile');
end else
WriteLn('Failed to Walk from Target Node to Target Tile!');
end;