Log in

View Full Version : Trying to open varrok sewer door with reflection



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.

Brandon
04-17-2011, 06:03 AM
its not an interactable object.. iunno why the hell ppl keep saying stuff like doors and other things are interact-able cuz theyre click-able.. its not.. Its a wall type object and thats y it keeps returning not found.. They mislead u.

SOME doors are interactable.. other are wall type objects like ladders.. some ladders I found to be interactable.. and some were wall type.. Trollheim ladder is wall type but the one I found in wilderness agility course was interactable..

Same goes for doors.. so try not to categorize them..

Example code for your door which you say is interactable:

Procedure FindCaveDoor;
var
CaveDoorObj : TRSObject;
CaveDoorOpenObj: TRSObject;
//CaveDoor: TTile;
//CaveDoorLoc: TTile;

begin
CaveDoorObj := GetObjectByID (3776, OBJECT_TYPE_INTERACTABLE, 52); //Closed Door
CaveDoorOpenObj := GetObjectByID (3777, OBJECT_TYPE_INTERACTABLE, 52); //Opened Door

If(FindRSObjectSimple(CaveDoorObj) = True) then
begin
Writeln('The Cave Door is found to be Closed!');
wait(500);
Mouse(CaveDoorObj.Tile.x, CaveDoorObj.Tile.y, 2, 2, True);
Writeln('Opened Cave Door.');
end else
If(FindRSObjectSimple(CaveDoorOpenObj) = True) then
begin
Writeln('The Cave Door is found to be Opened!');
wait(500);
Writeln('Opened Cave Door.');
end else
writeln('Cannot Find/Enter Door!');
end;

Flight
04-17-2011, 06:06 AM
Are you standing next to the door object when you run this bit of code?

Wolygon
04-17-2011, 06:24 AM
@ggzz

Wow thanks so much. Its finding it now.

I'm using this reflec tut here for reference http://villavu.com/forum/showthread.php?t=59400 as its the best i can find. Though it says quote:


So lets say you want to find Door ID #4599, but it could be anywhere on the map. Do this:
1) What is my ID?
4599
2) What type is it?
interactable
So I'm going to use the constant value OBJECT_TYPE_INTERACTABLE so when other people read my code they know its interactable

I see what you mean by "They mislead u".

Anyway thanks guys, great quick responses. :)