PDA

View Full Version : Help with finding doors



Keelijh
01-10-2016, 01:52 AM
It seems with Reflection, relying on the Door ID or Name--sometimes when my scripts are detecting the door using FindObj, apssing in an ID, these functions, they tend to fail.

I noticed while using the ID Display debugger tool, that door IDs would strobe, infrequently so. What's up with that?


Perhaps I am not implementing my functions effectively using Reflection and this is why they are failing.


Any ideas?

AFools
01-10-2016, 02:12 AM
Function OpenDoor :boolean;
var Door: TReflectObject;
begin
if Door.Find(objGame, 'Open Door', 15) then begin
Reflect.Mouse.Move(Door.GetMSPoint, 2, 2);
fastClick(Mouse_Left);
end;
end;


Something like this doesn't work? it doesn't.

I will see if i can get something to function, can you explain what circumstance this is in? or just a general fail safe?

In the mean time you could use



R_InteractTile(Point(X, Y), 'Open Door', 3, 3, 3)


This is not desirable; But it moves the mouse over the coords if the uptext is correct it will interact; so you will need to make and end else statement. (but as stated this isn't the most desirable way)

You will also need some extra functions for that function.




function R_TileOnMS(Tile : TPoint; var OutputPoint : TPoint; x : integer = 0; y : integer = 0; z : integer = 0):boolean;
var tempB : TBox;
begin
OutputPoint := TReflectionTiles.TileToMS(Tile, x, y, z);
tempB := intToBox(MSX1, MSY1, MSX2, MSY2);
result := PointInBox(OutputPoint, tempB);
end;

procedure randomMouseInput(pnt:Tpoint; ranx, rany:integer);
begin
case random(3) of
0:humanMMouse(pnt, ranx, rany);
1:missMouse(pnt, ranx, rany);
2:mouse(pnt, ranx, rany, mouse_move);
end;
end;

function R_InteractTile(tile:Tpoint; action:string; x:integer = 0; y:integer = 0; z:integer = 0):boolean;
var RSTile : TPoint;
begin
if R_TileOnMS(Tile, RSTile, x, y, z) then begin
randomMouseInput(rsTile, 3, 3);
if(Reflect.Text.IsUpText(action)) then begin
FastClick(mouse_left);
result := didClick(true, 1000);
end else begin
if TReflectionText.OptionExists(action) then begin
FastClick(mouse_right);
result := Reflect.Text.ChooseOption(action);
end;
if not result then
randomMouseInput(Point(MSCX, MSCY), 500, 500);
end;
end;
end;

Keelijh
01-10-2016, 11:30 PM
can you explain what circumstance this is in?
[/CODE]

Spinning wheel in Lumbridge Castle, the door to room of money making machine. :sasmokin:

AFools
01-10-2016, 11:32 PM
what is wrong with spinning in falador? it slower but more reliable...

Hoodz
01-11-2016, 12:41 PM
NKN; you have the same problem right?

NKN
01-11-2016, 12:43 PM
NKN; you have the same problem right?
Sure do.

will post an answer for OP if I find one

Kyle
01-11-2016, 04:21 PM
NKN; Keelijh;

Doors tend to be Boundary Objects, so this will work:

if Obj.Find(ObjBoundary, 'Door', 10) then
Reflect.Mouse.Move(Obj.GetMSPoint, 2, 2);

Keelijh
01-16-2016, 12:35 AM
NKN; Keelijh;

Doors tend to be Boundary Objects, so this will work:

if Obj.Find(ObjBoundary, 'Door', 10) then
Reflect.Mouse.Move(Obj.GetMSPoint, 2, 2);


Does there exist a master list of the Name/IDs of objGame, objWallDecoration, objFloorDecoration, objBoundary, which I could use for reference?

If such a list exists, could we upload it as a sticky to one of the parent threads (Help or Snippets, for example)?

This would save me a lot of time, currently I use a function to writeln all of the name/ids within 25.





If a master list has yet to be compiled, I shall begin.. :D

Kyle
01-16-2016, 12:40 AM
Does there exist a master list of the Name/IDs of objGame, objWallDecoration, objFloorDecoration, objBoundary, which I could use for reference?

If such a list exists, could we upload it as a sticky to one of the parent threads (Help or Snippets, for example)?

This would save me a lot of time, currently I use a function to writeln all of the name/ids within 25.





If a master list has yet to be compiled, I shall begin.. :D

https://github.com/Elfyyy/OSR-Reflection/tree/master/lib/internal/definitions

That is where the names and other data is pulled from. Do be careful with what you open it with, as it is a massive list and will crash most text readers including notepad.. I use Notepad++ and it works fine.

Keelijh
01-16-2016, 06:43 AM
Notepad++ ftw. Thanks.