SRL Archive - Reflection Tutorials

[Tutorial] Making and Walking Paths


Drakan

2008-09-11 20:43:50

Hey everyone, welcome to my tutorial on Making and Walking Paths using my D-Include which can be found here: http://code.google.com/p/reflectioninclude/

Lets go ahead and start from the beginning:
program PathWalking;
{.Include SRL\SRL\Misc\Smart.Scar}
{.Include SRL\SRL.Scar}
{.Include SRL\SRL\Reflection\Reflection.Scar}
{.include D-Include\DInclude.scar}

procedure SetupSmart;
begin
SmartSetup('world109', True, True, false);
Wait(1000);
SetTargetDC(SmartGetDC);
end;

begin
SetupSRL;
SetupSmart;
end.

This is basically just including all of the needed files, and using the SetupSmart function.

Now navigate to ..\D-Include\Tools\PathMaker.scar. This is my PathMaking tool! Open it and press start. Let smart load, then log in and get to your starting location.

Once at the starting point, walk to a tile on the path you are going to take. Remember to not choose a tile too far away, but not too close. Once your character reaches that point at a stop, Press F2 to record the tile.

Continue doing this until you have every tile needed to make your path. Once you record your last tile, press F4. This will print out a function for your path. (function LoadPath1: TPointArray;).

Now we can insert this into your script. It should look something like this:
program PathWalking;
{.Include SRL\SRL\Misc\Smart.Scar}
{.Include SRL\SRL.Scar}
{.Include SRL\SRL\Reflection\Reflection.Scar}
{.include D-Include\DInclude.scar}

procedure SetupSmart;
begin
SmartSetup('world109', True, True, false);
Wait(1000);
SetTargetDC(SmartGetDC);
end;

function LoadPath1: TPointArray;
begin
SetLength(Result, 4);
Result[0] := (Point(2665, 3348));
Result[1] := (Point(2676, 3349));
Result[2] := (Point(2686, 3355));
Result[3] := (Point(2690, 3359));
end;

begin
SetupSRL;
SetupSmart;
end.

Once you have that done, you have to use the WalkPath function from my include. This is pretty simple:

function whateveryouwant: boolean;
begin
Result := WalkPath(LoadPath1);
end;

What this will do is walk the path (LoadPath1) then return whether or not it was successful. You can add to this of course, like fail safes, or opening doors, or walking another path. Simple enough?

So your finished product would look a little something like:
program PathWalking;
{.Include SRL\SRL\Misc\Smart.Scar}
{.Include SRL\SRL.Scar}
{.Include SRL\SRL\Reflection\Reflection.Scar}
{.include D-Include\DInclude.scar}

procedure SetupSmart;
begin
SmartSetup('world109', True, True, false);
Wait(1000);
SetTargetDC(SmartGetDC);
end;

function LoadPath1: TPointArray;
begin
SetLength(Result, 4);
Result[0] := (Point(2665, 3348));
Result[1] := (Point(2676, 3349));
Result[2] := (Point(2686, 3355));
Result[3] := (Point(2690, 3359));
end;

function whateveryouwant: boolean;
begin
Result := WalkPath(LoadPath1);
if Result then Writeln('Walked path!');
end;

begin
SetupSRL;
SetupSmart;
end.

Yes this isn't very graphic and super detailed, but you should be able to get through it fairly simply. Post if you have questions/comments!

Shady?

2008-09-11 22:30:52

Yet another good post from you, seems like you really like Reflection, thats good. Rep++. The tutorial is great =)

Drakan

2008-09-12 18:50:52

Thanks shady? :) Yah it's very useful. Always been a fan.

NiCbaZ

2008-09-12 19:15:43

Nice Tut just one thing


Why do you load your tiles like that?

i thinks looks heaps nicer and cleaner loading like this..



Result := [Point(3080, 3249), Point(3081, 3264), Point(3071, 3274),
Point(3065, 3261), Point(3055, 3251), Point(3042, 3242),
Point(3047, 3234)];

Drakan

2008-09-12 19:28:23

Idk, just how i like doin it. Easier to see for me.

NiCbaZ

2008-09-12 19:34:02

alright, fair enough

SubiN

2008-09-18 21:05:25

Line 78: [Error] (17489:20): Unknown identifier 'SmartGetFieldLongH' in script D:\SCAR 3.15b\includes\SRL\SRL\Reflection\Objects.Scar

Method

2008-09-18 21:12:17

From: SubiN
Line 78: [Error] (17489:20): Unknown identifier 'SmartGetFieldLongH' in script D:\SCAR 3.15b\includes\SRL\SRL\Reflection\Objects.Scar


Replace your SMART plugin with the one in the reflection folder. It's not hard to search around either as this error has been posted about so many times.

SubiN

2008-09-18 21:17:26

It wasnt that , i replaced but i renamed , didnt know ur not suppsoe to rename it
..
Well thanx for the info

eugenius1

2008-09-19 19:04:09

hey can you help me? for some reason your tile getting program doesnt work for me…
i dont know how to get tiles else wise.
im on pest control island and am trying to make a working walker from the boat to the bank. i do just as it says but either the tiles are wrong or something is wrong with pest control… can you tell me whats up?

Drakan

2008-09-21 08:45:53

From: eugenius1
hey can you help me? for some reason your tile getting program doesnt work for me…
i dont know how to get tiles else wise.
im on pest control island and am trying to make a working walker from the boat to the bank. i do just as it says but either the tiles are wrong or something is wrong with pest control… can you tell me whats up?


Well i know reflection was updated recently. You are using f2 for tile recording right? Does your keyboard have an F Mode button that changes between the f keys and the functions they perform? (A lot of logictech keyboards have these).

sirlaughsalot

2008-09-21 08:49:56

Maybe add how to make the walking have failsafes? Even reflection needs em and what about those apps with no color backup? Personally i at least have ideas, but i think it would help people tremendously…

eugenius1

2008-09-21 20:11:24

From: The[Cheese]
Well i know reflection was updated recently. You are using f2 for tile recording right? Does your keyboard have an F Mode button that changes between the f keys and the functions they perform? (A lot of logictech keyboards have these).


yeah i have those function keys where you can press Fn and get another key by pressing f2
how does this create a problem and dang how would you have guess smarty pants

Runescape Pro

2008-09-21 20:52:08

Wow, You seem to be the man to go to about reflection. I am trying to make a big reflection script, I'll PM you or post here if i have questions. Good tutorial =]

Nava2

2008-09-22 07:31:58

The whole FKeys thing, just add a writeln to SCAR so that you can tell, for some reason, I also get issues with mine. SCAR doesn't always pick up the IsFKeyDown for some reason.. :(

Nice little guide though :)

Drakan

2008-09-22 17:09:08

From: Nava2
The whole FKeys thing, just add a writeln to SCAR so that you can tell, for some reason, I also get issues with mine. SCAR doesn't always pick up the IsFKeyDown for some reason.. :(

Nice little guide though :)


I do have a writeln thing ;)
Line 39-ish:
Writeln('Recorded tile: '+inttostr(Path[i].x)+', '+inttostr(Path[i].y)+'.');

Heysus

2008-10-04 01:24:41

No matter what tile I'm at your PathMaker keeps giving me "Recorded tile: 33554430, 33554430." :confused:

EDIT: I re-installed reflection and it's working now :D

n33d scripts

2008-12-10 08:08:58

Line 8: [Error] (18359:1): Duplicate identifier 'RSBuild' in script C:\Program Files\SCAR 3.15\includes\SRL\SRL\Reflection\Hooks.Scar


Error ;(

Method

2008-12-10 10:08:51

From: n33d scripts
Line 8: [Error] (18359:1): Duplicate identifier 'RSBuild' in script C:\Program Files\SCAR 3.15\includes\SRL\SRL\Reflection\Hooks.Scar


Error ;(


Make sure that you're only including Reflection.scar and not the other files individually. If that is already the case, try deleting your files in the folder and redownloading reflection from the SVN or using Widget's reflection downloader.

Powerz

2009-02-01 15:26:22

From: Method
Make sure that you're only including Reflection.scar and not the other files individually. If that is already the case, try deleting your files in the folder and redownloading reflection from the SVN or using Widget's reflection downloader.


I've got the same problem with my hooks.scar, done everything you said still not working. Anyone else has fixes?:redface:

Method

2009-02-01 15:39:53

This include already includes reflection, so adding another include gets you that duplicate identifier error.

The include hasn't been updated in a while anyways, so I wouldn't suggest using it. Just use the normal reflection include.

slakan

2009-03-21 13:53:03

hmm, sry im a bit of a noob, but i went into the Pathmaker script and the smart world setup i get an error allways

begin
SmartSetup('world51', True, True, false);//Change the number in 'world84'
Wait(1000); //to whichever world you want.
SetTargetDC(SmartGetDC);

Line 21: [Error] (20821:41): Invalid number of parameters in script D:\Program Files\SCAR 3.15\Includes\D-include\Tools\PathMaker.scar


what to do? i tryed to set another world, change to another smart world logging from a script in srl junior members but wont work..

dorkythedork

2009-04-01 11:54:39

From: slakan
hmm, sry im a bit of a noob, but i went into the Pathmaker script and the smart world setup i get an error allways

begin
SmartSetup('world51', True, True, false);//Change the number in 'world84'
Wait(1000); //to whichever world you want.
SetTargetDC(SmartGetDC);

Line 21: [Error] (20821:41): Invalid number of parameters in script D:\Program Files\SCAR 3.15\Includes\D-include\Tools\PathMaker.scar


what to do? i tryed to set another world, change to another smart world logging from a script in srl junior members but wont work..



replace it whit this
  SmartSetupEx(95, false, true, false);
SetTargetDC(SmartGetDC);

whowever this doesnt work anymore