SRL Archive - Reflection Help

Handling a Fence


Nindustries

2009-02-23 08:21:34

Hi.
I'm using the Offset Tutorial from here .
Whats the notation of a UID? I think I have a wrong interpretation of a long..
I'm using this code as a Fence door Handler

Procedure OpenFence;
Begin
Writeln('-> Fence is closed ! Trying to Open .. ');
V := TileToMSEx(Tile(P.x,P.y), 13);
Mouse(v.x,v.y-10,3,3,true);
End;

Procedure CheckForFence ;
Begin
IF NOT(LoggedIn) THEN Exit;
Writeln('-> Initiating Fence-check..');
if (Findobject(P,36915)) and (DistanceFrom(P) < 6) then
Repeat
OpenFence
Until (GetObjectAt(3189,3279) <> 36915) ; // Heres the error ..
Writeln('-> Fence-check Finished');
End;

Method

2009-02-23 08:58:07

GetObjectAt(3189,3279).objType

Try that.

Nindustries

2009-02-23 12:36:32

From: Method
GetObjectAt(3189,3279).objType

Try that.

rofl

[Runtime Error] : Out of Global Vars range in line 156 in script G:\DATA STORAGE\Desktop\LameChicker.scar

Torrent of Flame

2009-02-23 12:38:40

I used this to check if a gate was open, and it clicks it if it isnt;

function R_GateOpen : Boolean;
var
GatePoint, TP: TPoint;
begin
FindObject(GatePoint, 36914);
Result := TileOnMS(GatePoint, 1);
if not (Result) then
begin
TP := TileToMS(Point(3177, 3316), 5); //OFC you will have to set the points of your gate. My gate only had one point (one gate in the script)
Mouse(TP.x, TP.y, 1, 1, True);
end;
end;

n3ss3s

2009-02-23 13:33:24

[Runtime Error] : Out of Global Vars range in line 156 in script G:\DATA STORAGE\Desktop\LameChicker.scar


You need to use a UID type variable like myUID := GetObjectAt and then myUID.objType.

Nindustries

2009-02-23 13:40:49

From: Torrent of Flame
I used this to check if a gate was open, and it clicks it if it isnt;

function R_GateOpen : Boolean;
var
GatePoint, TP: TPoint;
begin
FindObject(GatePoint, 36914);
Result := TileOnMS(GatePoint, 1);
if not (Result) then
begin
TP := TileToMS(Point(3177, 3316), 5); //OFC you will have to set the points of your gate. My gate only had one point (one gate in the script)
Mouse(TP.x, TP.y, 1, 1, True);
end;
end;

Mmh seems that if I input my tile Coords, it clicks below the gate. When I put a X+1 value, it clicks above it. I tried some things but didn't worked..
It is the gate of the West-Chicken farm of Lumby to be precise :D