SRL Archive - First Scripts

Simple Reflection Script


Makeshift

2011-07-19 03:51:42

Hi guys,

I've been trying for the past few days to learn how to use Simba. Since I learn primarily by reading others code, the public scripts forum has been invaluable to me, though the tutorial for reflection is hurting my poor brain.

All the scripts I can find that contain automatic walking with reflection are insanely complicated, so I can't find a very, very simple walking pattern to expand on.

So far, I've used Sumilion's Pathmaker to create a quick path from Varrock East bank to Varrock West bank, I understand that all of the points must be within view of the starting location.
function LoadPath: TPointArray;
begin
SetLength(Result, 8);

Result[0] := Point(4017, 2793);
Result[1] := Point(4006, 2793);
Result[2] := Point(3992, 2794);
Result[3] := Point(3980, 2793);
Result[4] := Point(3969, 2794);
Result[5] := Point(3959, 2795);
Result[6] := Point(3950, 2794);
Result[7] := Point(3949, 2803);
end;

What I'm having trouble is is converting this to a usable format, and then actually putting it into a script.

So what I'm asking here isn't for a tutorial - It's for a walking script that, using reflection and the points above, does a quick walk that I can use for reference in my first script, hence why I posted it here. Being that I learn primarily by fiddling with scripts, I thought this would be the fastest and easiest way to get a solid footing.

Thanks in advance,

Makeshift.


Edit: I just realized I posted this in 'First Scripts' rather than requests, and since I don't have permission to delete, I couldn't move it. Sorry!

Shuttleu

2011-07-19 04:15:15

there are many scripts which you can look at, but i will give you the basics

to put that in a usable format you want to do something like this


procedure WalkTehPath;
var
TehPath: TPointArray;
begin
TehPath:= LoadPath;
WalkPath(TehPath);
end;

or a shorter way

WalkPath(LoadPath);

however i would suggest you use the first one because then you can do this


//Global variable
var
TehPath: TPointArray;

//setting script variables
TehPath:= LoadPath;

//to walk the path
WalkPath(TehPath);

//to walk back from the path
InvertPath(TehPath);
WalkPath(TehPath);
InvertPath(TehPath);

~shut

KingKong

2011-07-19 05:02:31

From: Makeshift
Hi guys,

I've been trying for the past few days to learn how to use Simba. Since I learn primarily by reading others code, the public scripts forum has been invaluable to me, though the tutorial for reflection is hurting my poor brain.

All the scripts I can find that contain automatic walking with reflection are insanely complicated, so I can't find a very, very simple walking pattern to expand on.

So far, I've used Sumilion's Pathmaker to create a quick path from Varrock East bank to Varrock West bank, I understand that all of the points must be within view of the starting location.
function LoadPath: TPointArray;
begin
SetLength(Result, 8);

Result[0] := Point(4017, 2793);
Result[1] := Point(4006, 2793);
Result[2] := Point(3992, 2794);
Result[3] := Point(3980, 2793);
Result[4] := Point(3969, 2794);
Result[5] := Point(3959, 2795);
Result[6] := Point(3950, 2794);
Result[7] := Point(3949, 2803);
end;

What I'm having trouble is is converting this to a usable format, and then actually putting it into a script.

So what I'm asking here isn't for a tutorial - It's for a walking script that, using reflection and the points above, does a quick walk that I can use for reference in my first script, hence why I posted it here. Being that I learn primarily by fiddling with scripts, I thought this would be the fastest and easiest way to get a solid footing.

Thanks in advance,

Makeshift.


Edit: I just realized I posted this in 'First Scripts' rather than requests, and since I don't have permission to delete, I couldn't move it. Sorry!


If the tile offsets in the pathmaker are right, all you need to do is remove the extra bits, so all you're left with is this:

Point(4017, 2793)
Point(4006, 2793)
Point(3992, 2794)
Point(3980, 2793)
Point(3969, 2794)
Point(3959, 2795)
Point(3950, 2794)
Point(3949, 2803)

Then you put that in square brackets then put that in walkpath, like so:

WalkPath([Point(4017, 2793), Point(4006, 2793), Point(3992, 2794),
Point(3980, 2793), Point(3969, 2794), Point(3959, 2795),
Point(3950, 2794), Point(3949, 2803)]);

Makeshift

2011-07-19 05:16:52

Thanks for your help guys, I'll try both methods and pick my favourite :).

And sorry again for the wrong forum!

Drakan

2011-07-19 10:08:40

Use shuttleu's method of doing it. No offense to kingkong of course but there is a reason those points exist in the LoadPath function. You want to save those tiles in the function so you can manipulate them easier like shuttleu said, using invertpath. But it's all good, just post in reflection help next time or something :)