SRL Archive - Jr. Member General Help and Discussion

Reflection


iEatApplez

2014-09-29 11:54:55

I've really been wondering why I can't find a good reflection tutorial.
I've been searching everywhere but I really can't work it out..
Does anyone here have any leads to a somewhat explaining tutorial?
Thanks in advance :)

~Annonymus

E; Decided to note the stuff I'm having troubles with:
-Object finding (wilderness ditch, doors (without using the opendoor function) etc)
-Item finding (loot on the ground, inventory, bank, equipped items, whatevers)

E2; Almost forgot to ask but, how am I able to post in the Jr. Memb. section being a registered user? :p

Brandon

2014-09-29 16:34:34

From: Annonymus
…



1. Probably because there isn't a "stable" include with all the hooks updated. I know an include exists but I personally don't consider it stabled as there aren't very many active developers working on it and updating hooks as they get outdated.

2. There used to be a ref-monitor. By that I mean there used to be this tool/form that you run and it would show the ID's of wall objects and textures and their relationships (parent -> child -> subchild), etc.. and it'd show every details of it all. It made things easier back then. I don't think there is one anymore but what's stopping you from debugging them on screen anyway?

3. Not sure why you'd have jr. permissions but it's probably because you're a donator (don't quote me on that).

Kyle

2014-09-29 17:00:12

Yeah there is definitely a lack of tutorials for reflection due to some of the reasons Brandon pointed out. I wrote one for the unofficial include and while it doesn't break down the structure of reflection it shows how to use the functions for scripting. Not sure what you are looking for in tutorials. If you want to learn more about the structure I would check javahacking. Here's the link for my scripting tut.http://villavu.com/forum/showthread.php?t=107698

iEatApplez

2014-09-29 20:10:31

From: Brandon
1. Probably because there isn't a "stable" include with all the hooks updated. I know an include exists but I personally don't consider it stabled as there aren't very many active developers working on it and updating hooks as they get outdated.

2. There used to be a ref-monitor. By that I mean there used to be this tool/form that you run and it would show the ID's of wall objects and textures and their relationships (parent -> child -> subchild), etc.. and it'd show every details of it all. It made things easier back then. I don't think there is one anymore but what's stopping you from debugging them on screen anyway?

3. Not sure why you'd have jr. permissions but it's probably because you're a donator (don't quote me on that).


At 2; The only thing really stopping me is my inexperience with Simba :p
Thanks for the answers tho :)

From: elfyyy
Yeah there is definitely a lack of tutorials for reflection due to some of the reasons Brandon pointed out. I wrote one for the unofficial include and while it doesn't break down the structure of reflection it shows how to use the functions for scripting. Not sure what you are looking for in tutorials. If you want to learn more about the structure I would check javahacking. Here's the link for my scripting tut.http://villavu.com/forum/showthread.php?t=107698


What I'm actually having troubles with is understanding the stuff written in your tutorial (and in Reflection scripts). I've read trough it about 10 times but I still have no idea what I'm doing :p
Last time it took me 10 errors and 1½ hours to make it jump the Wilderness Ditch :\

Kyle

2014-09-29 20:17:25

From: Annonymus
At 2; The only thing really stopping me is my inexperience with Simba :p
Thanks for the answers tho :)



What I'm actually having troubles with is understanding the stuff written in your tutorial (and in Reflection scripts). I've read trough it about 10 times but I still have no idea what I'm doing :p
Last time it took me 10 errors and 1½ hours to make it jump the Wilderness Ditch :\


Well what exactly is confusing you?

iEatApplez

2014-09-29 20:31:36

From: elfyyy
Well what exactly is confusing you?


Well, besides the fact that I still do not understand TPoints at all, I've just been struggeling with all the functions and new words which I'd never have to use in color scripts.

Kyle

2014-09-29 20:37:15

From: Annonymus
Well, besides the fact that I still do not understand TPoints at all, I've just been struggeling with all the functions and new words which I'd never have to use in color scripts.


Uh, if you're still trying to learn Tpoints, I think you might be better off first learning more of simba's syntax first by making color scripts, as there is a plethora of tutorials of them in the tutorial section. You can add me on skype if you have any specific questions or just post here.


var
X, Y: Integer;
tP: tPoint;

begin
X := 5;
Y := 10;

tP := intToPoint(5, 10);

mMouse(X, Y, 2, 2);

mMouse(tP.X, tP.Y, 2, 2);

Both mMouse functions above will do the exact same thing, just one using integers and the other using tPoints.

Brandon

2014-09-29 20:51:05

From: Annonymus
Well, besides the fact that I still do not understand TPoints at all, I've just been struggeling with all the functions and new words which I'd never have to use in color scripts.


That depends on what part of TPoints you don't understand.

There's the type itself which just holds a location (X and Y) and there's the reflection ones which also hold a location but "REPRESENT" an unnatural location.

Examples:


var
T: TPoint;
begin
T := Point(X, Y);
end;

And that would represent a location. Almost all TPoints represent a location. Where? Is up to you or the include you are using.



T := Point(50, 50);

could represent a point on your screen. But:


T := R_GetGlobalPos();

would represent a point somewhere in the game's world. It could be like: (3000, 3500) or w/e.. That point probably isn't on your "SMART" screen and so there would be functions that translate that to a location that you can click.

Perhaps:


T := R_GetMyPos();
Mouse(T, MOUSE_LEFT);

See the difference? They (the locations) are all represented by a "TPoint" but the location is different depending on what you want to do (click vs. determine where you are). One is relative to your screen and one is relative to the game's world (could be a point in varrock or falador or w/e).


You could be standing at (5000, 5000) aka somewhere in the RS world.. but if you wanted to click where you were standing it'd be something like (400, 400) aka the center of your screen/client/browser/smart.

That's all your really need to realise. The rest will come naturally.

iEatApplez

2014-09-29 20:54:27

From: elfyyy
Uh, if you're still trying to learn Tpoints, I think you might be better off first learning more of simba's syntax first by making color scripts, as there is a plethora of tutorials of them in the tutorial section. You can add me on skype if you have any specific questions or just post here.


var
X, Y: Integer;
tP: tPoint;

begin
X := 5;
Y := 10;

tP := intToPoint(5, 10);

mMouse(X, Y, 2, 2);

mMouse(tP.X, tP.Y, 2, 2);

Both mMouse functions above will do the exact same thing, just one using integers and the other using tPoints.


I suppose I'll get into TPoints a bit more, thanks.
Now for the 2nd part of my problem;
I believed NPC finding and Object finding were pretty similair so I tried copying my OpenTheBank procedure and edit it to make it find an object. Now the first bit of my problem is the part where you write
R_FindNPC('blabla', stuff);
But I never found anything like a R_FindObj. Except ofcourse
R_GetAllObjects
But wouldn't that also make it find things like trees, altars and whatnot?

E; I apologize for those stupid and obvious questions but I've actually not advanced anything for the past 3 days of getting into reflection :\

Kyle

2014-09-29 21:07:09

From: Annonymus
I suppose I'll get into TPoints a bit more, thanks.
Now for the 2nd part of my problem;
I believed NPC finding and Object finding were pretty similair so I tried copying my OpenTheBank procedure and edit it to make it find an object. Now the first bit of my problem is the part where you write
R_FindNPC('blabla', stuff);
But I never found anything like a R_FindObj. Except ofcourse
R_GetAllObjects
But wouldn't that also make it find things like trees, altars and whatnot?

E; I apologize for those stupid and obvious questions but I've actually not advanced anything for the past 3 days of getting into reflection :\


Yeah you can do it somewhat similar.

Since the way in which the include is written, object finding can be slow if we search the entire loaded region, we made it so you can either search at a specific tile, or from a set distance away from us. I assume for your use, the distance function would be most usefull:

(*
R_FindObjectDistance
~~~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

function R_FindObjectDistance(var TheObj: TRSObject; ID, ObjType, Distance: integer): Boolean;

Returns the nearest TRSObject of given ObjType within the given distance as TheObj while the
result is a boolean.

OBJ_GAME = 0;
OBJ_WALL = 1;
OBJ_FLOORDECORATION = 2;
OBJ_BOUNDARY = 3;

.. note::

by elfyyy

*)

iEatApplez

2014-09-29 21:27:38

From: elfyyy

…


Noticed that, but still struggeling. I guess what would really help me out is a simple example of Object finding in a script to play around with (that's how I learned NPC finding, and actually everything about scripting I know :p)
But I've looked at 10+ scripts already and I just can't make anything up, really.. (ie your scripts use some sort of colortolerancespeed thing, whatever that may be x_x)
So I don't know if you could help me out on this one, but if you could I'd really appericiate it :)

Kyle

2014-09-29 21:33:55

From: Annonymus
Noticed that, but still struggeling. I guess what would really help me out is a simple example of Object finding in a script to play around with (that's how I learned NPC finding, and actually everything about scripting I know :p)
But I've looked at 10+ scripts already and I just can't make anything up, really.. (ie your scripts use some sort of colortolerancespeed thing, whatever that may be x_x)
So I don't know if you could help me out on this one, but if you could I'd really appericiate it :)


Add me on skype, it'll be easier. elfyyy-

iEatApplez

2014-09-29 21:37:17

From: elfyyy
Add me on skype, it'll be easier. elfyyy-


"You must spread some Reputation around before giving it to elfyyy again."
:(

Added though :p