Yes, for doors.
SCAR Code:
function ClickDoor(DoorObj: integer; Dir, Action: string): Boolean;
var
Loc, MS: TPoint;
begin
if not FindObject(Loc, DoorObj) then Exit;
case Lowercase(Dir) of
'n': MS := TileToMSEx(Tile(Loc.x + 0.5, Loc.y + 1.1), 40);
's': MS := TileToMSEx(Tile(Loc.x + 0.5, Loc.y + 0.1), 40);
'w': MS := TileToMSEx(Tile(Loc.x + 0.1, Loc.y + 0.5), 40); //try x-.5, y-.1
'e': MS := TileToMSEx(Tile(Loc.x + 1.1, Loc.y + 0.5), 40);
end;
if MS.x = 0 then Exit;
Mouse(MS.x, MS.y, 3, 3, False);
Result := R_ChooseOption(Action);
end;
^ It will work with gates also, thats built in to reflection. But that takes a while, I would use this function I made.
SCAR Code:
function ClickDoorex(DoorObj: integer; Dir, Action: string): Boolean;
var
Loc, MS: TPoint;
begin
if not FindObjectex(Loc, DoorObj,20) then Exit;
If(distancefrom(Loc)>4)then
begin
walktotile(Loc,0,1);
wait(500+random(500));
end;
case Lowercase(Dir) of
'n': MS := TileToMSEx(Tile(Loc.x + 0.5, Loc.y + 1.1), 40);
's': MS := TileToMSEx(Tile(Loc.x + 0.5, Loc.y + 0.1), 40);
'w': MS := TileToMSEx(Tile(Loc.x + 0.1, Loc.y + 0.5), 40); //try x-.5, y-.1
'e': MS := TileToMSEx(Tile(Loc.x + 1.1, Loc.y + 0.5), 40);
end;
if MS.x = 0 then Exit;
Mouse(MS.x, MS.y, 3, 3, False);
Result := R_ChooseOption(Action);
end;
^ I changed to findobjectex cause thats way faster. Also ^ would have to copied and pasted.
A gate/door has a different i.d open or closed.