From: ZephyrsFury
Open doors and closed doors have different object IDs so it is possible to check and open/close doors accordingly. But because doors are actually positioned on the edges of tiles you have to be careful where you move the mouse. The best way to click a door would be to use TileToMSEx where you can specify the point as on the edge or in the middle of a tile.
{*******************************************************************************
function TileToMSEx(tile: TTile; offx, offy : extended; height : integer): TPoint;
By: BenLand100
Description: Converts the global tile position, a position on that tile in the
range [(0,0), (1,1)] with (0.5, 0.5) being center and a height above
ground level to a screen location on the main screen, taking camera
position and rotation into account.
*******************************************************************************}
i will use that
~shut
EDIT: this?
function Door(id: Integer; DoorDirection: string; OpenDoor: Boolean): Boolean;
var
TheDoor: TRSObject;
MSPos: TPoint;
DoorX, DoorY: Extended;
begin
case DoorDirection of
'n': begin
DoorX:= 0.5;
DoorY:= 0.0;
end;
'e': begin
DoorX:= 1.0;
DoorY:= 0.5;
end;
's': begin
DoorX:= 0.5;
DoorY:= 1.0;
end;
'w': begin
DoorX:= 0.0;
DoorY:= 0.5;
end;
end;
TheDoor:= GetObjectByID(id, , 15);
MSPos:= TileToMSEx(TheDoos.Tile, DoorX, DoorY, 10);
Mouse(MSPos.x, MSPos.y, 0, 0, False);
if OpenDoor then
Result:= ChooseOptionMulti(['pen', 'oor'])
else
Result:= ChooseOptionMulti(['lose', 'oor'])
end;