It's not working for several reasons
- The "CavePoint" you've designated is the Reflection tile, not the onscreen coordinate. Use TileToMS or TileToMSEx to make an onscreen coordinate from a TTile.
- There's no point in using a TNPCArray if you already know the tile.
- Are you sure it's an NPC? I'm pretty sure the cave entrance would be an Object (TRSObject).
Simba Code:
function EnterCave: Boolean;
var
i: Integer;
Objs: TRSObjectArray;
Pt: TPoint;
begin
if not(LoggedIn) then
Exit;
Objs := SortObjects(GetObjectsByID(9356, OBJECT_TYPE_INTERACTABLE,10));
for i := 0 to High(Objs) do
begin
if (Objs[i].Tile <> Tile(2439, 5167)) then
Continue;
if not(TileOnMS(Objs[i].Tile, 0)) then //May have to use Objs[i].RealTile instead
if not(WalkToTile(Objs[i].Tile, 2, 0)) then
Continue;
Pt := TileToMS(Objs[i].Tile, 0);
MMouse(Pt.x - 10, Pt.y - 10, 20, 20);
if R_WaitUptextMulti(['your uptexts here'], 900) then
begin
Wait(50 + Random(80));
ClickMouse2(False);
Wait(50 + Random(80));
Result := r_WaitOptionMulti(['your choose options here'], 900);
end;
if Result then
Break;
end;
for i := 0 to High(Objs) do //
Objs[i] := NULL_RSOBJECT; //These 3 lines should prevent memory leaks
SetLength(Objs, 0); //
end;