PDA

View Full Version : DeadWalkVE (Walks from Lumby to Varrock East)



senrath
03-05-2008, 02:26 AM
Well, here it is, my first ever function/script. It is designed to walk from Lumby to Varrock East Bank, and has been working reliably for me ever since I got it "finished".

I'd appreciate it if people would run it themselves, and/or look over it. Tell me of any errors that come up (please use detail). Also, please tell me of any standards that I might have missed (I've been working with Java and Eclipse's autoindentation feature has me spoiled).

Feel free to use this in any FREE script, provided you give me proper credit.

And before people say anything, I'm also working on one for Varrock West Bank, one for the center of Varrock, one for Draynor, and two for Falador (East and West banks, respectively). The Varrock ones shouldn't take much longer (once I actually start on them).

{************************************************* ******************************
function DeadWalkVE: Boolean;
By: Senrath
Description: Walks from Lumbridge Courtyard to Varrock East Bank. Must include
path.scar (found SRL/SRL/misc/path.scar)
************************************************** *****************************}

function DeadWalkVE: Boolean;
var
count, x, y : Integer;
begin
if not(LoggedIn)then Exit;
MakeCompass('n');
wait(1000 + random(500));
RadialRoadWalk(FindRoadColor, 85, 95, 70, 1, 1);
RadialWalk(FindWaterColor, 60, 90, 70, 1, 1);
RadialRoadWalk(FindRoadColor, 45, 90, 60, 1, 1);
RadialRoadWalk(FindRoadColor, 45, 90, 60, 1, 1);
repeat
begin
RadialRoadWalk(FindRoadColor, 320, 360, 70, 1, 1);
count := count + 1;
end;
until(FindSymbol(x, y, 'churn'))or(count > 10);
count := 0;
repeat
begin
RadialRoadWalk(FindRoadColor, 0, 90, 70, 1, 1);
count := count + 1;
end;
until(FindSymbol(x, y, 'quest'))or(count > 10);
if(FindSymbol(x, y ,'quest'))then Mouse(x, y, 4, 4, true);
RoadColor:=FindVarrockRoadColor;
Path[0].Mainpoint.x:=700;
Path[0].Mainpoint.y:=82;
Path[0].Subpoints[0].x:=588;
Path[0].Subpoints[0].y:=63;
Path[0].Subpoints[1].x:=659;
Path[0].Subpoints[1].y:=78;
Path[0].Subpoints[2].x:=606;
Path[0].Subpoints[2].y:=82;
WalkPath(0);
Flag;
RoadColor:=FindVarrockRoadColor;
Path[1].Mainpoint.x:=689;
Path[1].Mainpoint.y:=79;
Path[1].Subpoints[0].x:=576;
Path[1].Subpoints[0].y:=75;
Path[1].Subpoints[1].x:=604;
Path[1].Subpoints[1].y:=68;
Path[1].Subpoints[2].x:=636;
Path[1].Subpoints[2].y:=82;
Path[1].Subpoints[3].x:=660;
Path[1].Subpoints[3].y:=68;
WalkPath(1);
Flag;
RoadColor:=FindVarrockRoadColor;
Path[2].Mainpoint.x:=638;
Path[2].Mainpoint.y:=36;
Path[2].Subpoints[0].x:=656;
Path[2].Subpoints[0].y:=21;
Path[2].Subpoints[1].x:=601;
Path[2].Subpoints[1].y:=78;
Path[2].Subpoints[2].x:=676;
Path[2].Subpoints[2].y:=99;
WalkPath(2);
Flag;
RoadColor:=FindVarrockRoadColor;
Path[3].Mainpoint.x:=624;
Path[3].Mainpoint.y:=24;
Path[3].Subpoints[0].x:=585;
Path[3].Subpoints[0].y:=125;
Path[3].Subpoints[1].x:=621;
Path[3].Subpoints[1].y:=130;
Path[3].Subpoints[2].x:=667;
Path[3].Subpoints[2].y:=139;
Path[3].Subpoints[3].x:=642;
Path[3].Subpoints[3].y:=102;
Path[3].Subpoints[4].x:=656;
Path[3].Subpoints[4].y:=43;
WalkPath(3);
Flag;
RoadColor:=FindVarrockRoadColor;
Path[4].Mainpoint.x:=641;
Path[4].Mainpoint.y:=24;
Path[4].Subpoints[0].x:=644;
Path[4].Subpoints[0].y:=154;
Path[4].Subpoints[1].x:=638;
Path[4].Subpoints[1].y:=134;
Path[4].Subpoints[2].x:=661;
Path[4].Subpoints[2].y:=104;
Path[4].Subpoints[3].x:=613;
Path[4].Subpoints[3].y:=57;
WalkPath(4);
Flag;
RoadColor:=FindVarrockRoadColor;
Path[5].Mainpoint.x:=612;
Path[5].Mainpoint.y:=24;
Path[5].Subpoints[0].x:=624;
Path[5].Subpoints[0].y:=159;
Path[5].Subpoints[1].x:=622;
Path[5].Subpoints[1].y:=158;
Path[5].Subpoints[2].x:=611;
Path[5].Subpoints[2].y:=136;
Path[5].Subpoints[3].x:=599;
Path[5].Subpoints[3].y:=117;
Path[5].Subpoints[4].x:=614;
Path[5].Subpoints[4].y:=102;
Path[5].Subpoints[5].x:=631;
Path[5].Subpoints[5].y:=76;
Path[5].Subpoints[6].x:=609;
Path[5].Subpoints[6].y:=57;
WalkPath(5);
RoadColor:=FindVarrockRoadColor;
Path[6].Mainpoint.x:=631;
Path[6].Mainpoint.y:=20;
Path[6].Subpoints[0].x:=648;
Path[6].Subpoints[0].y:=151;
Path[6].Subpoints[1].x:=649;
Path[6].Subpoints[1].y:=134;
Path[6].Subpoints[2].x:=628;
Path[6].Subpoints[2].y:=116;
Path[6].Subpoints[3].x:=628;
Path[6].Subpoints[3].y:=96;
Path[6].Subpoints[4].x:=629;
Path[6].Subpoints[4].y:=60;
Path[6].Subpoints[5].x:=640;
Path[6].Subpoints[5].y:=47;
WalkPath(6);
Flag;
RoadColor:=FindVarrockRoadColor;
Path[7].Mainpoint.x:=613;
Path[7].Mainpoint.y:=21;
Path[7].Subpoints[0].x:=632;
Path[7].Subpoints[0].y:=158;
Path[7].Subpoints[1].x:=629;
Path[7].Subpoints[1].y:=133;
Path[7].Subpoints[2].x:=640;
Path[7].Subpoints[2].y:=116;
Path[7].Subpoints[3].x:=633;
Path[7].Subpoints[3].y:=92;
Path[7].Subpoints[4].x:=619;
Path[7].Subpoints[4].y:=67;
Path[7].Subpoints[5].x:=628;
Path[7].Subpoints[5].y:=47;
WalkPath(7);
Flag;
RoadColor:=FindVarrockRoadColor;
Path[8].Mainpoint.x:=580;
Path[8].Mainpoint.y:=75;
Path[8].Subpoints[0].x:=624;
Path[8].Subpoints[0].y:=44;
Path[8].Subpoints[1].x:=617;
Path[8].Subpoints[1].y:=61;
Path[8].Subpoints[2].x:=595;
Path[8].Subpoints[2].y:=73;
Path[8].Subpoints[3].x:=620;
Path[8].Subpoints[3].y:=81;
Path[8].Subpoints[4].x:=638;
Path[8].Subpoints[4].y:=103;
if not(WalkPath(8))then
begin
RadialRoadWalk(FindVarrockRoadColor, 0, 20, 30, 1, 1);
WalkPath(8);
Flag;
end;
RoadColor:=FindVarrockRoadColor;
Path[9].Mainpoint.x:=571;
Path[9].Mainpoint.y:=94;
Path[9].Subpoints[0].x:=669;
Path[9].Subpoints[0].y:=68;
Path[9].Subpoints[1].x:=668;
Path[9].Subpoints[1].y:=83;
Path[9].Subpoints[2].x:=673;
Path[9].Subpoints[2].y:=99;
Path[9].Subpoints[3].x:=642;
Path[9].Subpoints[3].y:=88;
Path[9].Subpoints[4].x:=617;
Path[9].Subpoints[4].y:=89;
WalkPath(9);
Flag;
count:=0;
repeat
if(FindSymbol(x, y, 'bank'))then
begin
Mouse(x, y, 1, 1, true);
Flag;
Result := True;
end;
SymbolAccuracy := SymbolAccuracy - 0.1;
count := count + 1;
wait(1000 + random(500));
until(Result)or(count > 5);
SymbolAccuracy := 0.8;
end;

n3ss3s
03-05-2008, 12:35 PM
use a loop for the path walking.

Add failsafes for RRW, like If Not RadialRoadWalk..

senrath
03-05-2008, 12:48 PM
What do you mean by use a loop? The ones that are repeated more than twice already are in loops. And for the failsafes, I'm not sure what would work. Some of the RRWs don't need to be done in order for the function to work most of the time, but they are needed for certain minimap angles.

gerauchert
03-05-2008, 01:03 PM
the loop n3ss3s is refering to would be something like this:


for i := 0 to 6 do
begin
WalkPath[i];
FFlag(0);
end;


you still need failsafes for the RRW even if you dont need some of them. For the ones you actually need you should put them in, like:


if(not(RadialRoadWalk(RoadColor,70,90,50,2,2)))the n
if(not(RadialRoadWalk(RoadColor,80,100,60,2,2)))th en
begin
Writeln('Walking Failed');
NextPlayer(False);
end;
end;

stuff like that... another useful tool i find when using the walkpath, you can do something like this:


clicks := 0;
repeat
if(Clicks >= 3)then
begin
NextPlayer(False);
Exit;
end;
RadialRoadWalk(blah blah); // mostly for straight paths, use wide angles
Clicks := Clicks + 1;
until(WalkPath(1));



I use that stuff alot in my Eye of Newt[er]. Its very effective. Hope that stuff helps ya ;)

senrath
03-05-2008, 01:08 PM
I understand that I need failsafes, but what I'm saying is that in any given run of the function, not all of the RRWs will be used and I don't know which ones will be used or not.

Thanks for the clarification on the loop, though. I'll put that in when I get home.

gerauchert
03-05-2008, 01:12 PM
I understand that I need failsafes, but what I'm saying is that in any given run of the function, not all of the RRWs will be used and I don't know which ones will be used or not.

Thanks for the clarification on the loop, though. I'll put that in when I get home.

*cough* thats why you run heavy testing *cough*

you should know your script inside and out till the point where you know where every click is going to be made. Try out some of the things that we posted as you get going.

BTW while testing, writeln can be your best friend.

if(RadialRoadWalk(blah blah))then Writeln('First click'); //or something to help you ID it

senrath
03-05-2008, 01:17 PM
That's not what I mean. Sorry if I was being ambiguous. I know where each click will be, depending on the angle of the minimap. As I said, some of those clicks only come into play at certain angles. And since, aside from using something like ScarScape, there is no way to get the map to perfect north (or perfect anything, for that matter), there is no real way for me to tell which ones will be used at any given time. Of course, if there IS a real way to do this, please let me know, I would love to use it.

gerauchert
03-05-2008, 01:39 PM
That's not what I mean. Sorry if I was being ambiguous. I know where each click will be, depending on the angle of the minimap. As I said, some of those clicks only come into play at certain angles. And since, aside from using something like ScarScape, there is no way to get the map to perfect north (or perfect anything, for that matter), there is no real way for me to tell which ones will be used at any given time. Of course, if there IS a real way to do this, please let me know, I would love to use it.

hehe, ok i think you are getting closer to what Im trying to point out, but you are not quite with me yet.

Say for example that you are going around by the cow pen area...

Have it search for the first radialwalk, then if it fails, have it increase the angle to what it should be for the other one and so on until you run out of options and have it do a "nextplayer"

You will still be using the same format that you are doing, just with failsafes if it cant find for example like 3 in a row...then it would be searching for an angle nowhere even close to what you want, thus messing up the script. Have it switch if it cant find something close to what you want.

It is helpful to use the WalkPaths as "marker points" to keep your script on track and more consistent. This is most useful in areas where you need to radically change the angles of you RRW, ie: Turns (around by the alkahrid desert, and the cowpen..) The WalkPath ensures that you click that specific marker before the angles start to change for the turn.

Am I making any more sense?

senrath
03-05-2008, 02:35 PM
Again, I don't think I'm quite following you. The problem with me implementing that kind of thing is sometimes all of them will need to trigger (a couple times my minimap was about 45-50 degrees off of what the compass showed, requiring all of the walks to get there properly).

At those turns, there isn't much need for extra WalkPaths. Walking around the cowpen uses angles wide enough that there can be some overlay on each side, and for going around Al-Kharid, the first time (by the gate) should walk completely up to the gate before continuing, and for the second time (around the top) I switch completely from RRW to WalkPath (except for one part incase of screen loading issues.)

Santa_Clause
03-07-2008, 12:45 PM
Use DDTMs, since you can search for them rotated.

kelly slater pro surfer
03-08-2008, 02:53 AM
nice need loop=\ and it will be nice

senrath
03-11-2008, 01:18 AM
Use DDTMs, since you can search for them rotated.

I have a couple problems with using DDTMs. First, I'd have to go and make them all, and I'm lazy :P
Second, unless I'm mistaken, it would remove the "human-like" random element that the function currently has. And by that I mean the fact that it doesn't always use the same number of clicks, and almost never clicks in the same place twice (well, until it gets to the Varrock road anyway, since I had to exchange the randomness for reliability XD).

At anyrate, I'm tweaking this now, adding the suggestions as best I can, and that sort of thing.