SRL Archive - Reflection Tutorials

Offsets. Clicking doors/mixed tiled objects |TUT|


ZaSz

2009-02-09 00:36:05

Welcome to the Great Offset Tutorial!!!

In here we will learn how to use offsets to click on objects that are in between tiles such as doors.

Have you ever tried using reflection to click a door but it would just click the floor and you have to make the script go:
setangle(false);

Well the answer to your problems is offsets!

Offsets just move the mouse the x or the y direction to the object.

An example:

var P,v : TPoint;

begin
if findobject(p,11714) and (DistanceFrom(p) < 6) then
begin
v := TileToMS(p, Random(5));
mouse(v.x,v.y-30,3,3,true);
end;
end.

the above is to my auto-miner Iron Man.

Breaking down the procedure:

if findobject(p,11714) and (DistanceFrom(p) < 6) then

p is just the var the tile is assigned to. 11714 is the id to a door. That will be different for you unless you use the door for the falador mines.

DistanceFrom(p) < 6 | This is if the door is in clicking range. (you can expand a little more i think.)

begin
v := TileToMS(p, Random(5));
mouse(v.x,v.y-30,3,3,true);
end;

v is another var the tile is assigned to.
TileToMS(p, Random(5)): this makes the tile go to the mainscreen.

mouse(v.x,v.y-30,3,3,true);

The above is what you probably came here for, the offsets. lets say the door is on tile (3303,3304). so the click would be the center of (3303,3304).

but the door is to the north of the point right? Thats why in this case we minus 30 pixels so the click will be higher. The nice thing is you can change the x and the y around to get the right offset for you.

Also if the object is south of the point and you want to go down. You could go v.y+30 or so on.

The above method does work on v.x for object east or west of the point.

If you find this tut useful in anyway, feel free to rep me.

lordsaturn

2009-02-09 00:55:37

tbh, TileToMSEx is much, much easier.

Pt := TileToMsEx(Tile(3303.5, 3304), 15);

Nava2

2009-02-09 09:40:12

From: lordsaturn
tbh, TileToMSEx is much, much easier.

Pt := TileToMsEx(Tile(3303.5, 3304), 15);


Not to mention more accurate..

Home

2009-02-09 14:17:41

But this tutorial still had a good point ;) No one can't denied it!

Rep+

~Home

Nindustries

2009-02-23 01:35:56

How could I check if a door is open or not?

ZaSz

2009-02-23 03:39:31

Get the id of a closed door and an open door….

Nindustries

2009-02-23 05:45:41

From: zasz
Get the id of a closed door and an open door….

K ty, will be adding this to my script.

GrTz.:bart: