i have a script that goes to player owned houses in yanille and makes tabs, i figured out how to some of the things such as walking and banking but i cannot figure out some functions that ik are in the scripts but cant apply them, such as getting the current position that your at, having to not type the friends name every time, these would make it better, also i would need it to disable simba so that you can manually go to the study then turn it on to make it get the current tile. i have it all figured out in my head and the procedures all work by themselves but i cant make them work together. if someone could help me make it work, i think it would be a good addition to the scripting bank since no one has a working script on player owned houses. this could also be made into a guilded alter script. im also missing the exit procedure but i need to save the portal tile so i need the current position thing.

Simba Code:
program POH_Tabs;
{$DEFINE SMART}
{$i AeroLib/AeroLib.Simba}
{$i Reflection/Reflection.Simba}

var
loginName, password, Where, HouseName : string;
ReflectPlayer: TReflectLocalPlayer;
softId: TIntegerArray;
Study: Tpoint;
procedure declarePlayer;
begin
  Me.Active := true;
  Me.Name := 'username';
  Me.Pass := 'password';
  where:='Friend'; //or home
  HouseName:= ''; // if its your friends house it needs a name.
  Study:= Point(11866, 10069); // would be nice to use gobal get current position instead of having to enter it manually
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_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;
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, 5, 5);
    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;
procedure dismissAllRandoms;
var
  i, j, me_indice: integer;
  _npcs: TReflectNPCArray;
  randoms: tstringarray;
begin
  randoms := ['molly', 'niles', 'miles', 'giles', 'sandwich lady', 'drunken dwarf', 'genie', 'highwayman', 'dr jekyll', 'cap' 'n hand', 'security guard', 'rick turpentine', 'mysterious old man', 'frog', 'null', 'mime', 'sergeant damien', 'freaky forester', 'postie pete', 'tilt', 'flippa', 'leo', 'pillory guard', 'evil bob'];
  _npcs.GetAll;
  me_indice := TReflectLocalPlayer.GetPlayerIndex;
  for i := 0 to high(_npcs) do
  begin
    if (_npcs[i].getInteractingIndex = me_indice) then
    begin
      for j := 0 to high(randoms) do
      begin
        if (pos(randoms[j], lowercase(_npcs[i].getName)) > 0) then
        begin
          if R_InteractTile(_npcs[i].getTile, 'Dismiss', 0, 0, 50) then
          begin
            sleep(2500 + random(1000));
            writeln('Dismissed random: ' + _npcs[i].getname + '  Time Running: ' + TimeRunning);
          end;
        end;
      end;
    end;
  end;
end;
procedure walktobank;
var
  tobank: TTileArray;
  endpnt: TPoint;
begin
  setCompass('N');
  tobank := [Point(2558,3091), Point(2569, 3089), Point(2581, 3096), Point(2591, 3097), Point(2604, 3095), Point(2611, 3092)];
  endpnt := tobank[5];

  if PointInBox(TReflectionTiles.TileToMS(endpnt), intToBox(MSX1, MSY1, MSX2, MSY2)) then
    exit;
  if (getRunEnergy >= 20) and not isUsingRun then
    toggleRunning(true);
  repeat
    if not PointInBox(TReflectionTiles.TileToMS(endpnt), intToBox(MSX1, MSY1, MSX2, MSY2)) then
      Reflectplayer.WalkPathMM(Tobank, 1);
        while Reflectplayer.isMoving do
              wait(50);
  until (PointInBox(TReflectionTiles.TileToMS(endpnt), intToBox(MSX1, MSY1, MSX2, MSY2)));
end;
 procedure walktoPortal;
var
  toPortal: TTileArray;
  endpnt: TPoint;
begin
  setCompass('N');
  toPortal:= [Point(2604, 3095), Point(2591, 3097), Point(2581, 3096), Point(2569, 3089), Point(2558,3091), Point(2544, 3094)];
  endpnt := toPortal[5];

  if PointInBox(TReflectionTiles.TileToMS(endpnt), intToBox(MSX1, MSY1, MSX2, MSY2)) then
    exit;
  if (getRunEnergy >= 20) and not isUsingRun then
    toggleRunning(true);
  repeat
    if not PointInBox(TReflectionTiles.TileToMS(endpnt), intToBox(MSX1, MSY1, MSX2, MSY2)) then
      Reflectplayer.WalkPathMM(ToPortal, 1);
        while Reflectplayer.isMoving do
              wait(50);
  until (PointInBox(TReflectionTiles.TileToMS(endpnt), intToBox(MSX1, MSY1, MSX2, MSY2)))
end;
procedure dobank;
var
    Bankpoint : TPoint;
  _items : TReflectInvItemArray;
  h, i :integer;
  _objects : TReflectObjectArray;
  Softclay: Integer;
begin
    Softclay:= 1761;
   case Random(2) of
          0: Bankpoint := Point(2614, 3091);
          1: Bankpoint := Point(2614, 3092);
          2: Bankpoint := Point(2614, 3093);
       end;
 repeat
    setCompass('E');
    if (TReflectionTiles.NearTile(Point(2611, 3092), 10)) then
    begin
      if R_InteractTile(bankpoint, 'Bank') then
      begin
        Mouse(Point(262, 433), 10, 10, Mouse_Left);
        wait(200);
      end;
    end;
  until (TReflectionBank.IsOpen);
    TReflectionBank.Withdraw(SoftClay, 28);
    wait(200);
    CloseInterface;
 end;
Procedure EnterPortal;
var
PortalPoint: Tpoint;
Begin
  Case Random(3) of
  1: PortalPoint:= Point(2543, 3097);
  2: PortalPoint:= Point(2544, 3097);
  3: PortalPoint:= Point(2545, 3097);
  end;
  if (TReflectionTiles.NearTile(Point(2544, 3094), 10)) then
    begin
      if R_InteractTile(Portalpoint, 'Portal') then
      begin
        Mouse(Point(262, 433), 10, 10, Mouse_Left);
        While ReflectPlayer.IsMoving do
        wait(200);
      end;
    end;
    wait(RandomRange(200,300));
    Case LowerCase(Where) of
    'home': findNPCChatText('Your House', Mouse_left);
    'friend':
            Begin
            if not TReflectionText.ChooseOption('Friend')then begin
            wait(500);
             end else
             wait(RandomRange(2000, 3000));
             TypeSend(HouseName);
            end;
       end;
   end;
Procedure Inhouse;
var
_Objects: TReflectObjectArray;
Rstile: Tpoint;
begin
if  not (TReflectionTiles.NearTile(Study, 3)) then  begin
 Reflectplayer.BlindWalkMM(Study);
 while ReflectPlayer.IsMoving do
 wait(50);
 end else
      if R_InteractTile(study, 'Lectern') then
      begin
        Mouse(Point(262, 433), 10, 10, Mouse_Left);
        wait(50);
        While ReflectPlayer.IsMoving do
        wait(200);
      end;
    end;
procedure Findtabs;
var
clay: TReflectInvItem;
Begin
wait(200);
Mouse(Point(250, 250), 5, 5, Mouse_Right);
wait(1000);
mouse(Point(250, 310), 5, 5, Mouse_left);
while clay.find('SoftClay') do
wait(50);
End;
Procedure exithouse;
begin
  initAL;
  Reflect.Setup;
  declarePlayer;
    begin
      setCompass('N');
      setAngle(ANGLE_HIGH);
      ReflectPlayer.Create;
      repeat
      //dobank;
      //walktoportal;
      //enterPortal;
      //InHouse;
     // FindTabs;
     //walktobank;
      until(false);
    end;
  end.