SRL Archive - Reflection Development

ClickObjByID?


Awkwardsaw

2010-06-07 16:25:09

i noticed it wasnt in the include, so i scrapped one up :)


{*******************************************************************************
function ClickObjByID(ID, objType, MD, height : Integer; uptext : String; left : Boolean):boolean;
By: Awkwardsaw
Description: Clicks a mainscreen object by using ID
*******************************************************************************}
function ClickObjByID(ID, objType, MD, height : Integer; uptext : String; left : Boolean):boolean;
var
Obj : TRSObject;
tp : TPoint;
x, y, c : Integer;
label
here;
begin
Obj := GetObjectByID(ID, objType, MD);
tp := TileToMS(Obj.Tile, height);
mmouse(tp.x, tp.y, 3, 3);
here:
if R_IsUpText(UpText) then
begin
getmousepos(x, y);
mouse(x, y, 0, 0, left);
result := true;
end else
begin
inc(c);
mmouse(tp.x, tp.y, 0, 0);
if c = 2 then exit;
goto here;
end;
end;

Coh3n

2010-06-07 17:39:41

Every object has it's own ID, so there's no point in a uptext check. Unless it sometimes move the mouse off the object.

Blumblebee

2010-06-07 17:43:51

I think there's better ways to loop that instead of a goto to be honest.

MylesMadness

2010-06-07 17:55:46


Method

2010-06-07 17:59:46

I don't really see a need for this in the include. I think a user should design their own object clicking function depending on the script they are making.

Gu3st...

2010-06-07 18:04:17

What he said^

Use repeat..until

Nava2

2010-06-07 18:19:59

I have to say, that would be too.. well just too easy. Sorry, champ.

mormonman

2010-06-07 18:34:10

Then some noob will come here and complain about reflection sucking because "iT CAn'T CLICK TiS TREezoR, WtF SRL SUKZ BEEG WEENY"…

Drakan

2010-06-07 18:37:40

Yah, reflection is made easy enough. Plus, that sort of thing is not something that can easily be made a generic thing. People need to write their own to their scipts' specifics.

Awkwardsaw

2010-06-07 19:20:47

wait, why is goto not any good?

Nava2

2010-06-07 19:43:20

From: Awkwardsaw
wait, why is goto not any good?


Did you *not* see the velociraptor?

Awkwardsaw

2010-06-07 19:44:43

From: Nava2
Did you *not* see the velociraptor?


i did, and whats your point?

mormonman

2010-06-07 20:34:15

http://www.codeguru.com/forum/showthread.php?t=214449

Awkwardsaw

2010-06-07 20:56:30

so basically, because its simple to use its shunned? thats pretty stupid :\

MylesMadness

2010-06-07 20:59:08

From: Awkwardsaw
so basically, because its simple to use its shunned? thats pretty stupid :\
No, because there hard to make sure they are not causeing memory leaks

Awkwardsaw

2010-06-07 21:25:59

From: MylesMadness
No, because there hard to make sure they are not causeing memory leaks


if you use them properly, its not

Blumblebee

2010-06-07 22:16:19

hurts readability. It's for lazy people :) and you can never understand lazy people.