KillerTHC
2010-12-06 21:29:55
Im having trouble opening a door because there are 2 closed doors near me and when I do find the door I want, it clicks on the tile in front of the door(which happens to be the objects tile) and not the door it self. I have tried with different heights and various amounts of random x and y variations. Yet I still cannot get it to open the door every time…
OpenDoor function
OpenDoor function
function OpenDoor(RandomX, RandomX, Height: Integer): Boolean;
var
I: Integer;
DoorObjs: TRSObjectArray;
DoorTile: TTile;
begin
DoorTile := Tile(2949,3450);//Tile from debugging objects near the player
DoorObjs := GetObjectsByID([DoorClosedID], OBJECT_TYPE_WALLOBJECT, 10);
for I := 0 to High(DoorObjs) do
begin
if (DoorObjs[I].Tile.x = DoorTile.x) and (DoorObjs[I].Tile.y = DoorTile.y) then
begin
TP := TileToMS(DoorObjs[I].Tile, Height);
if TP.x > 0 then
begin
Mouse(TP.x, TP.y, RandomX, RandomX, False);
if not R_ChooseOptionMulti(['Open','open','pen']) then
begin
WriteLn('Reflection ChooseOptionMulti failed, using SRL');
Result := ChooseOptionMulti(['Open','open','pen']);
Exit;
end else
begin
Result := True;
Exit;
end;
end;
end;
end;
end;