SRL Archive - Reflection Development

ClickObject; and HoverObject;


Shady?

2008-09-14 01:54:42

Well i know this aren't hard-to-script functions, but i'm just starting with this and i wanted to share what i've done, so here they are:

function ClickObject(id :integer; left: boolean): boolean;
var
xx : TPoint;
begin
if FindObject(xX,id) then
begin
Result:= True;
XX:= TileToMS(XX, 0);
Mouse(xx.x, xx.y, 2, 2, Left);
Wait(30 + Random(10));
end;
end;

function HoverObject(id :integer): boolean;
var
xx : TPoint;
begin
if FindObject(xX,id) then
begin
Result:= True;
XX:= TileToMS(XX, 0);
MMouse(xX.x,xX.y,2,2);
Wait(30 + Random(10));
end;
end;

Examples:

HoverObject(1111);
It will move the mouse over the object, where 1111 is the UID.

ClickObject(1111, true);
It will click the object with whe UID you input, true for left click, and false for right click.

Credits go to NiCbaZ and Nava2, wanna see why? read the first 5 or 6 posts =)

NiCbaZ

2008-09-14 05:24:13

Looks nice, but nothing a user cannot include in there script ;)

if left then Mouse(xX.x,xX.y,2,2,true);
if not left then Mouse(xX.x,xX.y,2,2,false);



Mouse(xX.x,xX.y,2,2,left);


case left of
'True': Mouse(xX.x,xX.y,2,2,true);
'False': Mouse(xX.x,xX.y,2,2,false);
end;



see this is fromy Tut, nice

Nava2

2008-09-14 09:34:52

function ClickObject(id :integer; left: boolean): boolean;
var
xx : TPoint;
begin
if FindObject(xX,id) then
begin
Result:= True;
XX:= TileToMS(XX, 0);
{ if left then Mouse(xX.x,xX.y,2,2,true);
if not left then Mouse(xX.x,xX.y,2,2,false); }
Mouse(xx.x, xx.y, 2, 2, Left);
Wait(30 + Random(10));
// FindNormalRandoms; Dont call this in an included function, let the user define this.
end;
end;

function HoverObject(id :integer): boolean;
var
xx : TPoint;
begin
if FindObject(xX,id) then
begin
Result:= True;
XX:= TileToMS(XX, 0);
//Mouse(xX.x,xX.y,2,2,false);
MMouse(xx.x, xx.y, 2, 2);
Wait(30 + Random(10));
FindNormalRandoms;
end;
end;

Shady?

2008-09-14 12:02:02

From: Nava2
function ClickObject(id :integer; left: boolean): boolean;
var
xx : TPoint;
begin
if FindObject(xX,id) then
begin
Result:= True;
XX:= TileToMS(XX, 0);
{ if left then Mouse(xX.x,xX.y,2,2,true);
if not left then Mouse(xX.x,xX.y,2,2,false); }
Mouse(xx.x, xx.y, 2, 2, Left);
Wait(30 + Random(10));
// FindNormalRandoms; Dont call this in an included function, let the user define this.
end;
end;

function HoverObject(id :integer): boolean;
var
xx : TPoint;
begin
if FindObject(xX,id) then
begin
Result:= True;
XX:= TileToMS(XX, 0);
//Mouse(xX.x,xX.y,2,2,false);
MMouse(xx.x, xx.y, 2, 2);
Wait(30 + Random(10));
FindNormalRandoms;
end;
end;


Oh yea, thanks, i forgot to remove that "false" there, i'm editing out now.

Nava2

2008-09-17 20:53:23

Credit?

Also, apply everything to both..

Shady?

2008-09-17 21:18:00

Credit'd