SRL Archive - Reflection Help

Guard Killing


gerauchert

2008-08-20 01:20:09

Im trying to make my script kill guards using reflection and it is having issues…

It will click the guard sometimes, but other times it will just click the main screen repeatedly where there are no guards in sight. Ive been using this in Falador by the main gate. Any thoughts?

Function R_ClickGuard: Boolean;
var
Guard: TNPC;
begin
if(not(LoggedIn))then Exit;
FindNPC('Guard',Guard);
TileToMS(Guard.Tile,0);
Mouse(x,y,4,4,False);
if(ChooseOption('ttack'))then
begin
Result := True;
Exit;
end else
Result := False;
end;

Lee Lok Hin

2008-08-20 01:57:14

TiltoMS will return 0 if it is not on the MS, so if the guard is not on the MS, it will just rightclick repeatedly on 0,0 or where the olast guard was found.

Method

2008-08-20 09:47:23

From: gerauchert
Im trying to make my script kill guards using reflection and it is having issues…

It will click the guard sometimes, but other times it will just click the main screen repeatedly where there are no guards in sight. Ive been using this in Falador by the main gate. Any thoughts?

Function R_ClickGuard: Boolean;
var
Guard: TNPC;
begin
if(not(LoggedIn))then Exit;
FindNPC('Guard',Guard);
TileToMS(Guard.Tile,0);
Mouse(x,y,4,4,False);
if(ChooseOption('ttack'))then
begin
Result := True;
Exit;
end else
Result := False;
end;


TileToMS returns a TPoint, so as of now it being in there is useless. Assign a TPoint to it, then Mouse to that TPoint and you should find a guard. I'd also suggest using an if then conditional to make sure that a guard is actually found.

Infantry001

2008-08-21 15:53:30

Right now, you Mouse is clicking on empty coordinates (x and y have not been initialized).

Do what Method said.

And also, try including a procedure to walk to the guard if its not on the MS.

Narcle

2008-08-21 17:14:07

I'd still add a if isuptext then to it as well until you have it working perfectly.

New Reflection = All TPoints now