Wolygon
04-17-2011, 05:51 AM
Hey, I'm having a bit of trouble with opening the door. I have opened the manhole successfully.
procedure OpenDoor;
var
x, y : integer;
Obj1, Obj2 : TRSObject;
TP : TPoint;
begin
{Obj1 := GetObjectByID(Tile(3247,9892), OBJECT_TYPE_INTERACTABLE);
Obj2 :=GetObjectByID(Tile(3246,9892), OBJECT_TYPE_INTERACTABLE);}
Obj1 := GetObjectByID(29261, OBJECT_TYPE_INTERACTABLE, 6);
Obj2 := GetObjectByID(29262, OBJECT_TYPE_INTERACTABLE, 6);
if (Obj1.ID = 29261) then
begin
TP := TileToMS(Obj1.Tile, 4);
MMouse(TP.x, TP.y, 3, 3);
if R_IsUpText('pen') then
Mouse(TP.x, TP.y, 0, 0, True);
Exit;
end else if (Obj2.ID = 29262) then
begin
WriteLn('Found open door');
Exit;
end else
begin
WriteLn('[ERROR]-03 Door not found');
end;
end;
Note the commented out stuff is what I was doing to begin with.
It gets to "Door not found" meaning the object was not found. It does this if I specify the ID or the Tile. I know that I might need to offset from the tile but I'm just trying to find the object first.
I got the ID and the tiles from RSBot. But I'm guessing they're wrong though I can't figure out why. Obj1 is the closed door and 2 is the open door.
Hope you can help, thanks.
procedure OpenDoor;
var
x, y : integer;
Obj1, Obj2 : TRSObject;
TP : TPoint;
begin
{Obj1 := GetObjectByID(Tile(3247,9892), OBJECT_TYPE_INTERACTABLE);
Obj2 :=GetObjectByID(Tile(3246,9892), OBJECT_TYPE_INTERACTABLE);}
Obj1 := GetObjectByID(29261, OBJECT_TYPE_INTERACTABLE, 6);
Obj2 := GetObjectByID(29262, OBJECT_TYPE_INTERACTABLE, 6);
if (Obj1.ID = 29261) then
begin
TP := TileToMS(Obj1.Tile, 4);
MMouse(TP.x, TP.y, 3, 3);
if R_IsUpText('pen') then
Mouse(TP.x, TP.y, 0, 0, True);
Exit;
end else if (Obj2.ID = 29262) then
begin
WriteLn('Found open door');
Exit;
end else
begin
WriteLn('[ERROR]-03 Door not found');
end;
end;
Note the commented out stuff is what I was doing to begin with.
It gets to "Door not found" meaning the object was not found. It does this if I specify the ID or the Tile. I know that I might need to offset from the tile but I'm just trying to find the object first.
I got the ID and the tiles from RSBot. But I'm guessing they're wrong though I can't figure out why. Obj1 is the closed door and 2 is the open door.
Hope you can help, thanks.