SRL Archive - Reflection Development

R_WalkPath


Runescapian321

2010-03-12 20:22:34

One thing the old reflection really lacked was a good walkpath. So here it is (along with a few other useful functions):

Hooks you need (Updated 3/15):

CharMotion = 'Ac';
MyPlayer = 'f.U';
BaseX = 'sc.h';
BaseY = 'pr.e';
CurrentX = 'r';
CurrentY = 'h';
FlagX = 'hh.v';
FlagY = 'eh.P';
(Updated this on 3/14/10)
{*******************************************************************************
procedure R_FFlagEx(Tile: TPoint; Dist: Integer);
By: Tad
Description: Waits until you are Dist tiles away from Tile. Use of this, if
possible, is recommended over R_FFlag because the GetFlag hooks return false
negatives every once in a while.
*******************************************************************************}

procedure R_FFlagEx(Tile: TPoint; Dist: Integer);
var
Mark: integer;
Temp: TPoint;
begin
if not(WaitToMove(1000)) then exit;
if(GetFlag(Temp)) then Tile := Temp;
Mark := GetSystemTime;
while((DistanceFrom(Tile) > Dist) and (GetSystemTime - Mark < 25000) and (CharacterMoving))do
wait(randomrange(200,700));
end;

{*******************************************************************************
function NextTileToWalk(Path: TPointArray; Max: Integer): TPoint;
By: Tad
Description: Gets a suitable tile to walk to next, starts searching from the end
of the path. If there is more than one 'suitable' tile, it will choose a random
one, prioritzing the further ones. Max is the Index of the Path which the
function will stop searching at (This way the function won't return a tile
behind you), set to 0 if you do not mind. Used in R_WalkPath.
*******************************************************************************}

function NextTileToWalk(Path: TPointArray; Max: Integer): TPoint;
var
I, FromIndex, ToIndex: Integer;
PossibleTiles: TPointArray;
FirstTile: TPoint;
begin
FirstTile := Point(0,0);
for I:=High(Path) downto Max do
begin
if TileOnMM(Path[I]) then
begin
FirstTile := Path[I];
FromIndex := I;
ToIndex := I;
break;
end else if(I = Max) then
begin
result := Point(0,0);
exit;
end;
end;
for I:=Max to FromIndex do
if(DistanceFrom(Path[i]) > 8)then
begin
ToIndex := I;
break;
end;
for I:=FromIndex downto ToIndex do
begin
if(RBool)then
begin
result := Path[I];
break;
end;
if(I = ToIndex)then
result := Path[RandomRange(ToIndex,FromIndex)];
end;
end;

{*******************************************************************************
function R_WalkPath(Path: TPointArray; Randomness: Integer): boolean;
By: Tad
Description: Walks a path of tiles.

Path: TPointArray of the tiles you wish to walk
Randomness: Goes +/- Randomness tiles when clicking on MM. Set to 0 for default
randomness (recommended)
*******************************************************************************}

function R_WalkPath(Path: TPointArray; Randomness: Integer): boolean;
var
i, Index: integer;
TileToWalk, TileInPath, FSPoint, PointNow, LastTile, CurTile: TPoint;
ChangeRand: boolean;
begin
result := DistanceFrom(Path[High(Path)]) < 10;
if result then exit;
TileToWalk := Point(0,0);
LastTile := Point(0,0);
Index := 0;
if(Randomness = 0)then
ChangeRand := true;
while(Index < GetArrayLength(Path))do
begin
if(ChangeRand)then
Randomness := random(4);
TileInPath := NextTileToWalk(Path, Index);
if(not(CharacterMoving) and not(TileOnMM(TileInPath))) then break;
TileToWalk := Point(TileInPath.x+RandomRange(-Randomness,Randomness),
TileInPath.y+RandomRange(-Randomness,Randomness));
if not(TileOnMM(TileToWalk))then Continue;
if not(WalkToTile(TileToWalk, 0, 100)) then Continue;
if not(WaitToMove(1000)) then Continue;
if GetFlag(CurTile) then
begin
if ((CurTile.x = LastTile.x) and (CurTile.y = LastTile.y)) then
Continue;
end else
if LastTile.x = -1 then
Continue;
GetFlag(LastTile);
R_FFlagEx(TileToWalk, RandomRange(5,15));
Index := TileToIndex(TileInPath, Path)+1;
end;
R_Flag;
result := DistanceFrom(Path[High(Path)]) < 10;
end;

Any comments on the code? I've been testing it, seems to work well and it's very humanlike (in my opinion). It is best used when you have a huge path (i.e. a point every 1-2 tiles along the path). This way, the function randomly selects points at random distances away along the path; you're not going to be clicking around the same location every single time.

Would really appreciate some testers. To make your paths, you can use my extremely old, poorly coded, yet functional pathmaker (includes an option for continuously adding points as you walk, so to create the path all you'd have to do is set it up and walk your path). Here is the pathmaker:

program New;
{.include srl/srl/misc/smart.scar}
{.include srl/srl.scar}
{.include srl\srl/reflection/reflection.scar}

//F2 - Adds a Point onto the Path

var
CurPath, BackPath : Array[0..1000] of TPoint;
ObstPath : Array of Integer;
timemark : integer;
etype : boolean;

const
DoFastPath = true; //False will use the F2 commands. True will automatically create a point every 1000ms
//Press F5 to pause during FastPath
EraseDoubles = true; //Will erase all tiles that are identical and sequential


function NextEmptySpot(myArray : Array of TPoint) : integer;
var
i : integer;
begin
for i:=0 to GetArrayLength(myarray) -1 do
begin
if (myarray[i].x = -1) and (myarray[i].y = -1) then
begin
result := i;
exit;
end;
end;
end;

function NextEmptySpotInt(myArray : Array of Integer) : integer;
var
i : integer;
begin
for i:=0 to GetArrayLength(myarray) -1 do
begin
if (myarray[i] = -1) then
begin
result := i;
exit;
end;
end;
end;

procedure AddAnObs;
begin
ObstPath[NextEmptySpotInt(ObstPath)] := NextEmptySpot(CurPath) - 1;
wait(1000);
end;

procedure InitPaths;
var
i : integer;
begin
for i:=0 to 1000 do
begin
CurPath[i] := Point(-1,-1);
BackPath[i] := Point(-1,-1);
ObstPath[i] := -1;
end;
end;

procedure AddMyPos;
var
TempArray : Array of TPoint;
i : integer;
temp : TPoint;
begin
temp := GetMyPos;
if NextEmptySpot(CurPath) <> 0 then
if (EraseDoubles) and (temp.x = CurPath[NextEmptySpot(CurPath) - 1].x) and (temp.y = CurPath[NextEmptySpot(CurPath) - 1].y) then Exit;
CurPath[NextEmptySpot(CurPath)] := temp;
Alert('Point Added at ('+IntToStr(temp.x)+','+IntToStr(temp.y)+').');
end;

procedure MakeBackPath;
var
temp : TPoint;
i,j : integer;
begin
clearreport;
// addtoreport('makebackpath');
i := NextEmptySpot(CurPath) - 1;
j := 0;
//addtoreport('i = '+IntToStr(i));
repeat
// addtoreport('adding backpath');
BackPath[j] := CurPath[i];
inc(j);
i := i - 1;
until (i = -1);
{ addtoreport('about to add...');
addtoreport('next empty backpath: '+IntToStr(NextEmptySpot(BackPath)));
for i:=0 to NextEmptySpot(BackPath) -1 do
begin
addtoreport('next print');
addtoreport(IntToStr(BackPath[i].x)+','+IntToStr(BackPath[i].y));
end; }
end;

procedure AddToS(var thestring : String; addwhat : String);
var
temp : string;
begin
temp := thestring;
thestring := temp+addwhat;
end;

function RevertObst( ThePath : Array of Integer): Array of Integer;
var
i, tValue : integer;
begin
SetArrayLength(result, GetArrayLength(ThePath));
tValue := NextEmptySpot(CurPath);
for i:=0 to 1000 do
result[i] := -1;
i := 0;
while ThePath[i] <> -1 do
begin
result[i] := tValue - ThePath[i];
Inc(i);
end;
end;

procedure PrintOutStuff;
var
i : integer;
thelast: string;
temp : array of integer;
begin
ClearDebug;
thelast := ' Path := [';
for i := 0 to NextEmptySpot(CurPath) - 1 do
begin
if (i <> 0) and (i mod 5 = 0) then
begin
writeln(copy(thelast,1,Length(thelast)-1)+',');
thelast := ' ';
end;
if CurPath[i].x <> 0 then
begin
thelast := thelast + 'Point('+IntToStr(CurPath[i].x)+','+IntToStr(CurPath[i].y)+'),';
end;
end;
writeln(copy(thelast,1,Length(thelast)-1)+'];');
end;

begin
ClearDebug;
Smart_Server := 138;
Smart_Members := false;
Smart_Signed := true;
Smart_SuperDetail := false;
SetupSRL;
// SetupReflection;
SetLength(ObstPath, 1001);
InitPaths;
repeat
MarkTime(timemark);
repeat
wait(10);
if IsFKeyDown(5) then
begin
wait(500);
while not IsFKeyDown(5) do
begin
if IsFKeyDown(2) then
begin
R_Flag;
wait(1000);
AddMyPos;
end;
if IsFKeyDown(4) then
begin
R_Flag;
wait(1000);
AddanObs;
end;
end;
wait(500);
end;
if not DoFastPath then
Etype := IsFKeyDown(2) or IsFKeyDown(4)
else
Etype := TimeFromMark(timemark) > 1000;
until(Etype);
//ReWriteFile(ScriptPath + 'PathDump.text');
if not DoFastPath then
begin
if IsFKeyDown(2) then
begin
R_Flag;
wait(1000);
AddMyPos;
end;
end else
AddMyPos;
if IsFKeyDown(4) then
begin
R_Flag;
wait(1000);
AddanObs;
end;
MakeBackPath;
PrintOutStuff;
until(false);

end.

And if you're lazy, here's a testing script template :p:

program New;
{.include srl/srl/misc/smart.scar}
{.include srl/srl.scar}
{.include srl\srl/reflection/reflection.scar}

const
DebugIt = true;
//Put in your path where marked in the main loop

procedure DeclarePlayers;
begin

HowManyPlayers:= 1; // How many players are there arrays for?
CurrentPlayer:= 0; // Which player should we start with?
NumberOfPlayers(HowManyPlayers); // Do Not Change.

Players[0].Name := ''; // Username.
Players[0].Pass := ''; // Password.
Players[0].Nick := ''; //2-4 letters of your Username (that are not capital letters or spaces).
Players[0].Pin := ''; // Bank Pin. If none, leave as '' (blank).
Players[0].Active := True;

end;

var
MyPath: TPointArray;

begin
Smart_Members := true;
Smart_Signed := true;
Smart_Server := 138;
Smart_SuperDetail := false;
SetupSRL;
DeclarePlayers;
if not LoggedIn then Loginplayer;
MyPath := []; //PATH HERE
repeat
R_WalkPath(MyPath,0);
R_WalkPath(reversepath(MyPath),0);
until(False);
end.

Coh3n

2010-03-12 21:25:27

Awesome man, I'm going to be testing this tomorrow for sure! The first part of code you posted - is that all we need in MapWalk.scar? Or do we need the code from your other thread also?

EDIT: You must spread some reputation around before giving to Tad again. I don't even remember repping you. :p

mormonman

2010-03-12 21:30:17

I can't remember where, but some reflection developer said that people should make their own path walking. I don't agree, so I'll commit this asap.

Coh3n

2010-03-12 21:32:11

From: mormonman
I can't remember where, but some reflection developer said that people should make their own path walking. I don't agree, so I'll commit this asap.

Oh nice, so we just have to include reflection then? Once you've committed of course.

mormonman

2010-03-12 21:36:37

From: Coh3n
Oh nice, so we just have to include reflection then? Once you've committed of course.


Yes, but some noobs will of course try to use the other stuff that isn't fixed… :duh:

Coh3n

2010-03-12 21:38:13

From: mormonman
Yes, but some noobs will of course try to use the other stuff that isn't fixed… :duh:

Well they should quickly come to that conclusion then. :p

You don't have the Reflection checkout link handy, do you? I can't seem to find it. :(

Runescapian321

2010-03-12 21:38:50

From: Coh3n
Awesome man, I'm going to be testing this tomorrow for sure! The first part of code you posted - is that all we need in MapWalk.scar? Or do we need the code from your other thread also?

EDIT: You must spread some reputation around before giving to Tad again. I don't even remember repping you. :p


Hint: It was for pwning you ;)

From: mormonman
I can't remember where, but some reflection developer said that people should make their own path walking. I don't agree, so I'll commit this asap.


What's the reasoning behind making your own pathwalking? All it might accomplish is an extra headache in addition to less randomness, more bans, etc. Anyway, thanks. Though, it might not be perfect, will need some testers to confirm.

From: Coh3n
Oh nice, so we just have to include reflection then? Once you've committed of course.


Yeah, pretty much. I did this so people would know what was working/updated (EDIT: :ninja:), what hooks to update, how to update the hooks, etc. EDIT: Woops, got confused between my two threads.

EDIT: Link: http://scardevreflection.googlecode.com/svn/trunk

Coh3n

2010-03-12 21:44:53

Ohh yeah! :p I remember now.

Soo, once this is committed, it'll tell you to update the hooks? Or it'll to it for you? I kind of got confused a little… :o

Runescapian321

2010-03-12 22:19:04

From: Coh3n
Ohh yeah! :p I remember now.

Soo, once this is committed, it'll tell you to update the hooks? Or it'll to it for you? I kind of got confused a little… :o


You'll need to update the hooks the way I have in the other thread. Also, it might not let you run reflection because the old source hasn't been updated for a long time; you'll have to edit where it compiles everything (reflection.scar I think) so that it doesn't prompt you to download the newest version.

Basically, I don't think it's worth using the whole reflection svn until all the hooks are updated. So for now, you're better off using the include thing I made (which contains virtually every useful working function anyway).

EDIT: Also, didn't realize you edited in a question on your first post:

From: Coh3n
Awesome man, I'm going to be testing this tomorrow for sure! The first part of code you posted - is that all we need in MapWalk.scar? Or do we need the code from your other thread also?


First, you need the code from my other thread: save it in SCAR/Includes. Then, start making your script, and add the functions you wish to use from the first part of this thread into the script itself, OR add them onto the include. Although, I did make a little mistake in the script template (I should have the new functions all in the script itself, fixed now).

mormonman

2010-03-12 22:31:21

This is all in the include. Just use that.

Runescapian321

2010-03-12 22:46:36

From: mormonman
This is all in the include. Just use that.


Mormonman and I just sorted it out, and yes, all you need to do now is have an updated reflection from http://scardevreflection.googlecode.com/svn/trunk and you can use these functions.

Coh3n

2010-03-12 23:25:23

From: Tad
Mormonman and I just sorted it out, and yes, all you need to do now is have an updated reflection from http://scardevreflection.googlecode.com/svn/trunk and you can use these functions.

Sounds good! :) I'll post back with how it works out for me. :)

mormonman

2010-03-12 23:29:07

Major breakthrough with tiletoms(i think)… hopefully jp gets it finished soon.

Edit: well at least it compiled…

Coh3n

2010-03-12 23:33:10

From: mormonman
Major breakthrough with tiletoms(i think)… hopefully jp gets it finished soon.

Edit: well at least it compiled…

Nice, I have the feeling Reflection may be back in time when we become private again. :rolleyes:

Wouldn't be quite the re-opening, wouldn't you say? Reflection, SRL 5, Simba, new forums..

Nava2

2010-03-12 23:39:26

Path walking shouldn't be in reflection. This has been discussed many times, and it was decided on. Please remove it.

Coh3n

2010-03-12 23:43:28

From: Nava2
Path walking shouldn't be in reflection. This has been discussed many times, and it was decided on. Please remove it.

Care to explain the reasoning behind it? I'm not disagreeing, I'm just curious. After all, it'd not hard to make your own. There's already WalkToTile..

EDIT: Tad, you function acts really weird. It will click the point on the MM, but then a lot of the time it'll click the previous point really quickly, instead of waiting for the player to get to the area clicked. For example, I clicked on VE Bank, then outside the bank, and instead of clicking the third point, it clicked inside the bank again, then the second point again, then inside the bank again. Eventually it'll move on to the next point, but then the same thing would happen with points 2 and 3. Understand what I mean?

mormonman

2010-03-12 23:48:59

From: Nava2
Path walking shouldn't be in reflection. This has been discussed many times, and it was decided on. Please remove it.


I removed the R_walkpath, but I am leaving the other two functions in it. They are helpful.

Runescapian321

2010-03-12 23:49:35

From: Nava2
Path walking shouldn't be in reflection. This has been discussed many times, and it was decided on. Please remove it.


Link to these discussions?

I don't see why not. Clearly, as everyone knows, reflection isn't overly complicated to script, and it's not for those who want a challenge; it's for those who want a good bot. What's wrong with simplifying it a bit more in addition to making it better?

EDIT: @Mormonman: NextTileToWalk is pretty pointless unless you basically recreate R_WalkPath with the same concepts :p

EDIT2: Also, I had this in my other thread, but it was hidden amongst the other functions:

{*******************************************************************************
function ReversePath(Path: TPointArray): TPointArray;
By: Tad
Description: Reverses the order of tiles in a path.
*******************************************************************************}
function ReversePath(Path: TPointArray): TPointArray;
var
Index, AHigh: integer;
begin
SetLength(result, GetArrayLength(Path));
AHigh := High(result);
for Index:=0 to AHigh do
result[Index] := Path[AHigh - Index];
end;

EDIT: Nevermind, I fail for not noticing the one already there :p

mormonman

2010-03-12 23:53:06

From: Tad
EDIT: @Mormonman: NextTileToWalk is pretty pointless unless you basically recreate R_WalkPath with the same concepts :p


exactly… shhhhhh:shifty:

Nava2

2010-03-13 00:03:13

{*******************************************************************************
function ReversePath(Path: TPointArray): TPointArray;
By: Wizzup
Description: Reverses the order of tiles in a path.
*******************************************************************************}
function ReversePath(var Path: TPointArray): TPointArray;
begin
InvertTPA(Path);
result := path;
end;

Also, it was decided that way because coord clicking on tiles is very bannable, so having people creating their own paths was great. It also stopped people from making stupid scripts from the include like:

begin
WalkToVarrok();
Mine();
WalkToBank();
Bank();
end.

I don't have time to look it up, but if you want a better path walking system, check out the one zeph and I wrote.
http://nzmm.googlecode.com/svn/trunk/MM.scar

Coh3n

2010-03-13 00:06:46

From: Nava2
{*******************************************************************************
function ReversePath(Path: TPointArray): TPointArray;
By: Wizzup
Description: Reverses the order of tiles in a path.
*******************************************************************************}
function ReversePath(var Path: TPointArray): TPointArray;
begin
InvertTPA(Path);
result := path;
end;

Also, it was decided that way because coord clicking on tiles is very bannable, so having people creating their own paths was great. It also stopped people from making stupid scripts from the include like:

begin
WalkToVarrok();
Mine();
WalkToBank();
Bank();
end.

I don't have time to look it up, but if you want a better path walking system, check out the one zeph and I wrote.


Ah, I figured as much. It makes sense. :)

EDIT: @mormonman: If Tad's R_FFlagEx works 100% of the time (or at least more than the current reflection one), you should replace the current one, or at least use R_FFlagEx in WalkToTile. Just a thought.

Runescapian321

2010-03-13 00:11:17

From: Nava2
{*******************************************************************************
function ReversePath(Path: TPointArray): TPointArray;
By: Wizzup
Description: Reverses the order of tiles in a path.
*******************************************************************************}
function ReversePath(var Path: TPointArray): TPointArray;
begin
InvertTPA(Path);
result := path;
end;


:redface:


Also, it was decided that way because coord clicking on tiles is very bannable, so having people creating their own paths was great. It also stopped people from making stupid scripts from the include like:

begin
WalkToVarrok();
Mine();
WalkToBank();
Bank();
end.

I don't have time to look it up, but if you want a better path walking system, check out the one zeph and I wrote.


Coord clicking?

Own paths? You still make your own path with this

Stupid scripts? Isn't that the point of reflection: to simplify things?

The way I see it, having a WalkPath in the include simply keeps people from doing

function DoMyWalk: boolean;
var
i: integer;
begin
Path := [Point(3000,2000),Point(3000,2000),Point(3000,2000),Point(3000,2000),
Point(3000,2000),Point(3000,2000),Point(3000,2000),Point(3000,2000)];
for i:=0 to 7 do
if not(WalkToTile(Path[i],3,3)) then exit;
result := true;
end;

Nava2

2010-03-13 00:13:00

But it also removes the crafting of a proper system out of it too! We are here to encourage people to learn. Its not RSBot, for shits sake.

E: btw, if reflection is fixed, zeph and I might have to fix up zesty nacho..

Runescapian321

2010-03-13 00:18:03

From: Nava2
But it also removes the crafting of a proper system out of it too! We are here to encourage people to learn. Its not RSBot, for shits sake.

E: btw, if reflection is fixed, zeph and I might have to fix up zesty nacho..


I'd wager that 90% of reflection scripters walk like I mentioned above; that takes 10 seconds to make, and makes scripts horribly botlike and inefficient.

As for reflection, it (Primarily MS stuff, esp. TileToMS) isn't fixed yet. JP is working on it though, and says he'll be done soon. EDIT: Nor has anyone made an updater, though I suppose that isn't of utmost importance.

EDIT: @Coh3n: R_FFlagEx is basically just a failsafe'd version of R_FFlag and requires a Destination Tile not based off of GetFlag (as mentioned in the comments, it can return false negatives), which, depending on the circumstances, might not be available. I suppose they could be integrated somehow, but I didn't want to break other scripts.

Coh3n

2010-03-13 00:29:56

From: Tad
EDIT: @Coh3n: R_FFlagEx is basically just a failsafe'd version of R_FFlag and requires a Destination Tile not based off of GetFlag (as mentioned in the comments, it can return false negatives), which, depending on the circumstances, might not be available. I suppose they could be integrated somehow, but I didn't want to break other scripts.

Alright, well I edited my WalkToTile to use R_FFlagEx anyhow. From what I've tested, it works awesome! :)

E: Oh, and I also edited one of my posts way up in the thread with feedback about your WalkPath function.

Runescapian321

2010-03-13 00:33:30

From: Coh3n
Alright, well I edited my WalkToTile to use R_FFlagEx anyhow. From what I've tested, it works awesome! :)

E: Oh, and I also edited one of my posts way up in the thread with feedback about your WalkPath function.


Oh, yeah, it would work nicely with WalkToTile.

As for WalkPath, I noticed that once or twice too while testing. I'll have to check it out (tomorrow probably), thanks.

Coh3n

2010-03-13 00:34:25

From: Tad
Oh, yeah, it would work nicely with WalkToTile.

As for WalkPath, I noticed that once or twice too while testing. I'll have to check it out (tomorrow probably), thanks.

No problem :)

nielsie95

2010-03-13 09:50:54

From: Tad
function DoMyWalk: boolean;
var
i: integer;
begin
Path := [Point(3000,2000),Point(3000,2000),Point(3000,2000),Point(3000,2000),
Point(3000,2000),Point(3000,2000),Point(3000,2000),Point(3000,2000)];
for i:=0 to 7 do
if not(WalkToTile(Path[i],3,3)) then exit;
result := true;
end;


Nava, what's wrong with something like this? Isn't it better to have a general system instead of everyone making their own system? And besides, reflection is about making things easier, no?

And if it's detectable, why don't you include something that's easy and not detectable? :p

Sir R. M8gic1an

2010-03-13 11:03:07

From: nielsie95
Nava, what's wrong with something like this? Isn't it better to have a general system instead of everyone making their own system? And besides, reflection is about making things easier, no?

And if it's detectable, why don't you include something that's easy and not detectable? :p


I honestly see nothign wrong with it, as people still create their own paths, and it uses randomization, meaning that it wouldn't be exactly coord clicking.. Also, just make the path along somewhere normal to walk… either the fastest way or on roads etc and it won't look suspicious….

~RM

Runescapian321

2010-03-13 18:16:46

From: Coh3n

EDIT: Tad, you function acts really weird. It will click the point on the MM, but then a lot of the time it'll click the previous point really quickly, instead of waiting for the player to get to the area clicked. For example, I clicked on VE Bank, then outside the bank, and instead of clicking the third point, it clicked inside the bank again, then the second point again, then inside the bank again. Eventually it'll move on to the next point, but then the same thing would happen with points 2 and 3. Understand what I mean?


I can't seem to reproduce the bug after half an hour of testing :\ If you can get it to reproduce, mind going on msn to help me out a bit?

Thanks for the support RM and nielsie :)

Coh3n

2010-03-13 18:38:11

From: Tad
I can't seem to reproduce the bug after half an hour of testing :\ If you can get it to reproduce, mind going on msn to help me out a bit?

Thanks for the support RM and nielsie :)

Yeah it keeps happening. I don't think I have you on MSN, I'll PM you my address. :)

Runescapian321

2010-03-14 00:31:24

From: Coh3n
Yeah it keeps happening. I don't think I have you on MSN, I'll PM you my address. :)


Yay, Coh3n and I were able to fix it (minor flaw which caused major failure). Here is the updated version (modified NextTileToWalk and R_WalkPath)

{*******************************************************************************
function NextTileToWalk(Path: TPointArray; Max: Integer): TPoint;
By: Tad
Description: Gets a suitable tile to walk to next, starts searching from the end
of the path. If there is more than one 'suitable' tile, it will choose a random
one, prioritzing the further ones. Max is the Index of the Path which the
function will stop searching at (This way the function won't return a tile
behind you), set to 0 if you do not mind. Used in R_WalkPath.
*******************************************************************************}

function NextTileToWalk(Path: TPointArray; Max: Integer): TPoint;
var
I, FromIndex, ToIndex: Integer;
PossibleTiles: TPointArray;
FirstTile: TPoint;
begin
FirstTile := Point(0,0);
for I:=High(Path) downto Max do
begin
if TileOnMM(Path[I]) then
begin
FirstTile := Path[I];
FromIndex := I;
ToIndex := I;
break;
end else if(I = Max) then
begin
result := Point(0,0);
exit;
end;
end;
for I:=Max to FromIndex do
if(DistanceFrom(Path[i]) > 8)then
begin
ToIndex := I;
break;
end;
for I:=FromIndex downto ToIndex do
begin
if(RBool)then
begin
result := Path[I];
break;
end;
if(I = ToIndex)then
result := Path[RandomRange(ToIndex,FromIndex)];
end;
end;

{*******************************************************************************
function R_WalkPath(Path: TPointArray; Randomness: Integer): boolean;
By: Tad
Description: Walks a path of tiles.

Path: TPointArray of the tiles you wish to walk
Randomness: Goes +/- Randomness tiles when clicking on MM. Set to 0 for default
randomness (recommended)
*******************************************************************************}

function R_WalkPath(Path: TPointArray; Randomness: Integer): boolean;
var
i, Index: integer;
TileToWalk, TileInPath, FSPoint, PointNow, LastTile, CurTile: TPoint;
ChangeRand: boolean;
begin
TileToWalk := Point(0,0);
LastTile := Point(0,0);
Index := 0;
if(Randomness = 0)then
ChangeRand := true;
while(Index < GetArrayLength(Path))do
begin
cleardebug;
if(ChangeRand)then
Randomness := random(5);
TileInPath := NextTileToWalk(Path, Index);
if(not(CharacterMoving) and not(TileOnMM(TileInPath))) then break;
TileToWalk := Point(TileInPath.x+RandomRange(-Randomness,Randomness),
TileInPath.y+RandomRange(-Randomness,Randomness));
if not(TileOnMM(TileToWalk))then Continue;
if not(WalkToTile(TileToWalk, 0, 100)) then Continue;
if GetFlag(CurTile) then
begin
if ((CurTile.x = LastTile.x) and (CurTile.y = LastTile.y)) then
Continue;
end else
if LastTile.x = -1 then
Continue;
GetFlag(LastTile);
R_FFlagEx(TileToWalk, RandomRange(5,15));
Index := TileToIndex(TileInPath, Path)+1;
end;
R_Flag;
result := DistanceFrom(Path[High(Path)]) < 10;
end;

I will probably test some more tomorrow.

Runescapian321

2010-03-14 15:33:07

Last one wasn't working too well. I finally got a chance to test it thoroughly and have finally succeeded.

Succeeded in spread formation 130 times
Failed in spread formation 3 times
Grand total of 98%

Succeeded in close formation 132 times
Failed in close formation 0 times
Grand total of 100%


Spread vs close formation is…

MyPath := [Point(3205,3279),Point(3216,3272),Point(3216,3262),Point(3217,3252),Point(3221,3244),
Point(3225,3236),Point(3230,3230),Point(3236,3221),Point(3229,3219),Point(3221,3220)];

MyPath := [Point(3222,3218),Point(3223,3218),Point(3224,3218),Point(3226,3218),Point(3228,3218),
Point(3229,3218),Point(3231,3218),Point(3232,3218),Point(3234,3219),Point(3235,3220),
Point(3235,3222),Point(3235,3224),Point(3235,3225),Point(3234,3227),Point(3233,3228),
Point(3231,3230),Point(3230,3231),Point(3229,3233),Point(3228,3234),Point(3226,3236),
Point(3225,3237),Point(3223,3239),Point(3222,3240),Point(3222,3242),Point(3221,3243),
Point(3220,3245),Point(3220,3246),Point(3220,3248),Point(3220,3250),Point(3219,3251),
Point(3219,3253),Point(3218,3254),Point(3217,3256),Point(3217,3258),Point(3216,3260),
Point(3216,3262),Point(3216,3263),Point(3216,3265),Point(3216,3267),Point(3216,3269),
Point(3216,3270),Point(3216,3272),Point(3216,3274),Point(3216,3275),Point(3215,3276),
Point(3213,3278),Point(3212,3278),Point(3211,3279),Point(3209,3280),Point(3208,3280),
Point(3206,3279),Point(3205,3279),Point(3204,3279)];

(Those are essentially the same path. EDIT: In reverse though :p)

Here is the code

{*******************************************************************************
function NextTileToWalk(Path: TPointArray; Max: Integer): TPoint;
By: Tad
Description: Gets a suitable tile to walk to next, starts searching from the end
of the path. If there is more than one 'suitable' tile, it will choose a random
one, prioritzing the further ones. Max is the Index of the Path which the
function will stop searching at (This way the function won't return a tile
behind you), set to 0 if you do not mind. Used in R_WalkPath.
*******************************************************************************}

function NextTileToWalk(Path: TPointArray; Max: Integer): TPoint;
var
I, FromIndex, ToIndex: Integer;
PossibleTiles: TPointArray;
FirstTile: TPoint;
begin
FirstTile := Point(0,0);
for I:=High(Path) downto Max do
begin
if TileOnMM(Path[I]) then
begin
FirstTile := Path[I];
FromIndex := I;
ToIndex := I;
break;
end else if(I = Max) then
begin
result := Point(0,0);
exit;
end;
end;
for I:=Max to FromIndex do
if(DistanceFrom(Path[i]) > 8)then
begin
ToIndex := I;
break;
end;
for I:=FromIndex downto ToIndex do
begin
if(RBool)then
begin
result := Path[I];
break;
end;
if(I = ToIndex)then
result := Path[RandomRange(ToIndex,FromIndex)];
end;
end;

{*******************************************************************************
function R_WalkPath(Path: TPointArray; Randomness: Integer): boolean;
By: Tad
Description: Walks a path of tiles.

Path: TPointArray of the tiles you wish to walk
Randomness: Goes +/- Randomness tiles when clicking on MM. Set to 0 for default
randomness (recommended)
*******************************************************************************}

function R_WalkPath(Path: TPointArray; Randomness: Integer): boolean;
var
i, Index: integer;
TileToWalk, TileInPath, FSPoint, PointNow, LastTile, CurTile: TPoint;
ChangeRand: boolean;
begin
result := DistanceFrom(Path[High(Path)]) < 10;
if result then exit;
TileToWalk := Point(0,0);
LastTile := Point(0,0);
Index := 0;
if(Randomness = 0)then
ChangeRand := true;
while(Index < GetArrayLength(Path))do
begin
if(ChangeRand)then
Randomness := random(4);
TileInPath := NextTileToWalk(Path, Index);
if(not(CharacterMoving) and not(TileOnMM(TileInPath))) then break;
TileToWalk := Point(TileInPath.x+RandomRange(-Randomness,Randomness),
TileInPath.y+RandomRange(-Randomness,Randomness));
if not(TileOnMM(TileToWalk))then Continue;
if not(WalkToTile(TileToWalk, 0, 100)) then Continue;
if not(WaitToMove(1000)) then Continue;
if GetFlag(CurTile) then
begin
if ((CurTile.x = LastTile.x) and (CurTile.y = LastTile.y)) then
Continue;
end else
if LastTile.x = -1 then
Continue;
GetFlag(LastTile);
R_FFlagEx(TileToWalk, RandomRange(5,15));
Index := TileToIndex(TileInPath, Path)+1;
end;
R_Flag;
result := DistanceFrom(Path[High(Path)]) < 10;
end;

mormonman

2010-03-14 15:45:25

So your close path is essentially every tile that you would walk on? or close to it?

Runescapian321

2010-03-14 15:47:32

From: mormonman
So your close path is essentially every tile that you would walk on? or close to it?


Yeah, the script I posted in the first post gets that for you as you walk the path.

Blumblebee

2010-03-15 16:00:31

I am attempting to get tiles to test but I am getting weird results here.

tell me if I am somehow doing this wrong:

var
position: tPoint;

begin
Smart_Members:= False;
Smart_Server := 81;
Smart_Signed := True;
SetUpSRL;
repeat
if IsFKeyDown(6) then
begin
position := getMyPos();
writeLn('point('+IntToStr(Position.x)+', '+IntToStr(Position.y)+');');
wait(750+random(750));
end;
until False;
end.

I continually get this:

point(33554430, 33554430);

has RS been updated recently or am I just totally out to lunch with this.

Coh3n

2010-03-15 16:04:48

I get the exact same point. RS was updated today, so the hooks could be outdated? It was working fine for me yesterday.

Blumblebee

2010-03-15 16:05:43

From: Coh3n
I get the exact same point. RS was updated today, so the hooks could be outdated? It was working fine for me yesterday.


hmmm, Ok so I tried to update via Widget's thing and the new URL but I got access denied on that. Would you care to try to update your hooks as well to confirm?

Coh3n

2010-03-15 16:10:38

From: Blumblebee
hmmm, Ok so I tried to update via Widget's thing and the new URL but I got access denied on that. Would you care to try to update your hooks as well to confirm?

I've never updated my hooks before, but I ran his script and got this:


HTTP/1.1 404 Not Found
length: 0
Successfully executed

Blumblebee

2010-03-15 16:12:36

From: Coh3n
I've never updated my hooks before, but I ran his script and got this:


HTTP/1.1 404 Not Found
length: 0
Successfully executed


samsies, good to know I'm not crazy. Although this could prove a problem for us* (*the community, namely people resurrecting reflection) as we can't steal hooks anymore…

Coh3n

2010-03-15 16:13:27

From: Blumblebee
samsies, good to know I'm not crazy. Although this could prove a problem for us* (*the community, namely people resurrecting reflection) as we can't steal hooks anymore…

Yeah, right when we were about to add reflection to MSI. Lol.

Runescapian321

2010-03-15 17:27:58

Ugh. Apparently RSBot has password protected their googlecode, where all the hooks are stored. I'll try to see if there's another bot we can leech from.

EDIT: Never mind, they just moved their Svn. Hooks are now at http://runedev.googlecode.com/svn/trunk/data/info.dat.

At the top of the first post I've posted the new ones

ZephyrsFury

2010-03-16 11:08:13

From: Nava2
But it also removes the crafting of a proper system out of it too! We are here to encourage people to learn. Its not RSBot, for shits sake.

E: btw, if reflection is fixed, zeph and I might have to fix up zesty nacho..


Oh yay! But with the walking system I reckon we should have some sort of basic system in the include. Its a lot more beginner-friendly to have some high-level functions like that to both encourage scripting and to allow it to be used as a learning tool.

Coh3n

2010-03-16 13:38:19

From: Tad
Ugh. Apparently RSBot has password protected their googlecode, where all the hooks are stored. I'll try to see if there's another bot we can leech from.

EDIT: Never mind, they just moved their Svn. Hooks are now at http://runedev.googlecode.com/svn/trunk/data/info.dat.

At the top of the first post I've posted the new ones

Awesome, thanks. :)

Nava2

2010-03-16 14:03:54

Sorry, but that issue about hooks is exactly why I don't think Reflection should be used in big projects to be spread around..

Anyways, Erik: I think ours are better than these ones, they created more random paths, and *never* failed. Were also very fast ;)

Coh3n

2010-03-16 14:17:21

From: Nava2
Sorry, but that issue about hooks is exactly why I don't think Reflection should be used in big projects to be spread around..

Anyways, Erik: I think ours are better than these ones, they created more random paths, and *never* failed. Were also very fast ;)

If you're talking about MSI, we are going to make it so you can easily disable reflection in case of this issue.

Nava2

2010-03-16 14:18:50

Fair enough, I just fear that the MSI project will take a lot of recovery to fix the Reflection breaking issue.

rya

2010-03-16 14:23:38

What is the MSI project?

Coh3n

2010-03-16 14:24:28

From: Nava2
Fair enough, I just fear that the MSI project will take a lot of recovery to fix the Reflection breaking issue.

That's why I'm trying to persuade everyone to use my idea that way if reflection breaks, the user changes one line and vuala.

Nava2

2010-03-16 15:14:34

Nuff said, this should probably go back on topic and the MSI conversation can move somewhere else.

rya, dw about it :D

Sabzi

2010-03-18 13:28:19

Your last link seems to be protected now as well. Or I am stooopid?
Can someone help me getting some hooks?

Coh3n

2010-03-18 17:01:23

From: Sabzi
Your last link seems to be protected now as well. Or I am stooopid?
Can someone help me getting some hooks?

This link? http://runedev.googlecode.com/svn/trunk/data/info.dat

Also, he has the hooks on the first post. Unless they're been updated since Monday (I think).

Sabzi

2010-03-18 19:24:53

From: Coh3n
This link? http://runedev.googlecode.com/svn/trunk/data/info.dat

Also, he has the hooks on the first post. Unless they're been updated since Monday (I think).


Yes, that link. If I go there it requires user/pass and if I use it in the hook stealer it says the error.
But Timer has helped me out.

ZephyrsFury

2010-03-19 03:36:03

From: Nava2
Sorry, but that issue about hooks is exactly why I don't think Reflection should be used in big projects to be spread around..

Anyways, Erik: I think ours are better than these ones, they created more random paths, and *never* failed. Were also very fast ;)


Could walk from Varrock to Falador with a path as small as 3 or 4 tiles TPoint ;)

nebster

2010-03-21 21:07:00

Hmm,

I updated the Hooks.scar with those values but it doesn't seem to work.

Do I need to copy the plugin from the folder in reflection?
If I do I get an error with SmartSetupEx saying there's a invalid number of parameters

Coh3n

2010-03-21 21:25:02

From: nebster
Hmm,

I updated the Hooks.scar with those values but it doesn't seem to work.

Do I need to copy the plugin from the folder in reflection?
If I do I get an error with SmartSetupEx saying there's a invalid number of parameters

SmartSetupEx is outdated. See -> http://villavu.com/forum/showthread.php?t=48023

Also, I may be wrong, but I think the hooks are outdated.