Jump to content
shadowrecon

New Walking MEthod --In Progress

Recommended Posts

So after messing around with DTM's i figured they would be a good way of walking around rs, i know SRL has a DTM walking function but its complicated and uses symbols. This uses the colors of the tiles that surround your char on the minimap. So far using this function below i have managed to walk to the same exact tile every time even after loging in and out a few times. =))) To use simply put you char where you want him to go, hold Ctrl and start script, it will print out the colors for that area, copy and paste them into the function. Strill needs some work, but just figured id share. anyone have any input.. ?

[scar]

{===============================================================================

RS 2

Walking Routines

--------------------------------------------------------------------------------

* Function: UB_Walk(Mp,Nc,Sc,Wc,Ec,Tol,FD,XOffset,YOffset,RX,RY:Integer):Boolean;

By: ShadowRecon.

* Procedure: CollectData;

By: ShadowRecon.

* Procedure: StoreLocation(Var PLoc : TIntArray);

By: ShadowRecon.

* Function: BackToStart(Var PLoc : TintArray):Boolean;

By: ShadowRecon.

 

===============================================================================}

 

{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Function: UB_Walk(Mp,Nc,Sc,Wc,Ec,Tol,FD,XOffset,YOffset,RX,RY:Integer):Boolean;

Decription: Walks to a set of colors gathered from the CollectData Function. Set

Tolerances to 5 works best or higher until you get result your looking for.

Example:

begin

UB_Walk(1983917,4774638,1854400,1155821,1854400,5,0,0,10,10);

end.

Contributors: ShadowRecon.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

Function UB_Walk(Mp,Nc,Sc,Wc,Ec,Tol,FD,XOffset,YOffset,RX,RY:Integer): Boolean;

Var

DTM: TDTM;

WDDTM,X,Y,SA,T: Integer;

AF: Extended;

begin

SA := 3;

dtm.MainPoint.x := (MMCX+2);

dtm.MainPoint.y := (MMCY+2);

dtm.MainPoint.areashape := shpRectangle;

dtm.MainPoint.color := MP;

dtm.MainPoint.Tolerance := Tol;

 

SetLength(DTM.SubPoints, 4);

 

dtm.SubPoints[0].x := MMCX; // North

dtm.SubPoints[0].y := (MMCY-SA);

dtm.SubPoints[0].Color := Nc;

dtm.SubPoints[0].Tolerance := Tol;

 

dtm.SubPoints[1].x := MMCX; // South

dtm.SubPoints[1].y := (MMCY+SA);

dtm.SubPoints[1].Color := Sc;

dtm.SubPoints[1].Tolerance := Tol;

 

dtm.SubPoints[2].x := (MMCX-SA); // West

dtm.SubPoints[2].y := MMCY;

dtm.SubPoints[2].Color := Wc;

dtm.SubPoints[2].Tolerance := Tol;

 

dtm.SubPoints[3].x := (MMCX+SA); // East

dtm.SubPoints[3].y := MMCY;

dtm.SubPoints[3].Color := Ec;

dtm.SubPoints[3].Tolerance := Tol;

 

WDDTM := AddDTM(DTM);

T := GetSystemTime + 7000;

Try

Flag;

except

wait(1000);

end;

Try

repeat

if FindDTMRotated(WDDTM,X,Y,MMCX-75,MMCY-75,MMCX+75,MMCY+75,0,365,5,AF) then

begin

//Writeln('X: '+IntToStr(X)+' Y: '+IntToStr(Y));

Result := True;

MouseFlag(X,Y,RX,RY);

FlagEx(FD);

end

else

Result := False; //Writeln('MM Poistion Not Found');

until (T < GetSystemTime) or (Result = True);

except

Result := False;

Finally

FreeDTM(WDDTM);

end;

end;

{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Procedure CollectData;

Decription: Collects colors for a certain location. Move you guy to where you

would like him to walk to, Hold Ctrl and start example script below. Colors will

pring out in debug box. Try to have all different colors.

Example:

begin

CollectData;

end.

Example Debug:

Main Color: 1983917

North Color: 4774638

South Color: 1854400

West Color: 1155821

East Color: 1854400

Color String: 1983917,4774638,1854400,1155821,1854400

Contributors: ShadowRecon.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

Procedure CollectData;

Var

Mp,Nc,Sc,Wc,Ec,SA:Integer;

begin

SA := 3;

if IsFunctionKeyDown(1) then

begin

Mp := GetColor(MMCX+3,MMCY+3);

Nc := GetColor(MMCX,(MMCY-Sa));

Sc := GetColor(MMCX,(MMCY+Sa));

Wc := GetColor((MMCX-Sa),MMCY);

Ec := GetColor((MMCX+Sa),MMCY);

Writeln(' Main Color: '+IntToStr(Mp));

Writeln(' North Color: '+IntToStr(Nc));

Writeln(' South Color: '+IntToStr(Sc));

Writeln(' West Color: '+IntToStr(Wc));

Writeln(' East Color: '+IntToStr(Ec));

Writeln('Color String: ' // Writeln's string so u can copy and paste into function

+IntToStr(Mp)+','

+IntToStr(Nc)+','+IntToStr(Sc)+','

+IntToStr(Wc)+','+IntToStr(Ec));

wait(1000);

end;

end;

{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Procedure StoreLocation(Var Player_Loc: TIntArray);

Decription: Call this at the begining of a script to store the players location.

Example:

Please Look at the BackToStart Example.

Contributors: ShadowRecon.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

Procedure StoreLocation(Var PLoc : TIntArray);

begin

SetLength(PLoc,5);

PLoc[0] := GetColor(MMCX+3,MMCY+3);

PLoc[1] := GetColor(MMCX,(MMCY-2));

PLoc[2] := GetColor(MMCX,(MMCY+2));

PLoc[3] := GetColor((MMCX-2),MMCY);

PLoc[4] := GetColor((MMCX+2),MMCY);

end;

{=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Function: BackToStart(Var P.Loc: TintArray):Boolean;

Decription: Call this after a location has been stored, and it will move back to the

location that was stored. (Good for script that require's keeping a player within a

area)

Example:

Var

Player_Loc: TIntArray;

begin

StroeLocation(Player_Loc);

MouseFlag(610,87,0,0); // moves char

Flag;

if BackToStart(Player_Loc) then // moves back to starting point

Writeln('Made it back to start location');

end.

Contributors: ShadowRecon.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=}

Function BackToStart(Var PLoc : TintArray):Boolean;

begin

Result := UB_Walk(PLoc[0],PLoc[1],PLoc[2],PLoc[3],PLoc[4],0,0,0,0,0,0);

end;[/scar]

Edited by shadowrecon
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...