Results 1 to 16 of 16

Thread: How to Find Player after tele?

  1. #1
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default How to Find Player after tele?

    K guys Im using reflection2 beta to write a script.. so far everything is fine (well except object clicking :c) But I wanna know how to find a player after teleport...

    I have:
    Simba Code:
    Procedure FillPrayer;
    var
    InvItem: TInvItem; MyPos: TTile;
    begin
      if(R_ItemExists(HouseTab, InvItem)) then
      Repeat
        R_ClickItemBy(HouseTab, true, '');
        WaitForAnimation(5000);
      Until(CharacterAnimating);
      MyPos:= GetMyPos;
      If((MyPos = PointToTile(3439,3454)) or (MyPos = PointToTile(3436, 3453))) then
      begin
        Wait
      end;
    end;
    How do I wait until the player appears in the house?? Every house is different so the Box the player appears in will be different if I were to use SelfInBox: TBox.. to check if they're in the house.. So How would I go about this? Thing is when the player teleports, they animate.. then the screen goes black and u see the house interface thing saying "Home Sweet Home" and during that time, animation is -1.. so basically it doesn't wait till u appear because your no longer animating but rather the function just continues on :c
    Help..
    Last edited by Brandon; 07-11-2011 at 02:53 AM.
    I am Ggzz..
    Hackintosher

  2. #2
    Join Date
    Nov 2010
    Location
    West Philadelphia, born and raised
    Posts
    522
    Mentioned
    1 Post(s)
    Quoted
    19 Post(s)

    Default

    I'd say add a BMP of the "Home Sweet Home" splash and wait until it is no longer found before proceeding. Once the splash is gone, you can assume the char is in the house.

    As for doing it specifically with R2, I'm not sure.
    Long ago, the '90s Nicktoons lived together in harmony. Then, everything changed when the century turned. Only Avatar, the best of the 2000's Nicktoons, could save them. But when the channel needed it most, the show finished. Four years passed and Mike and Bryan created the new Avatar: Legend of Korra. And although the show itself is great, it has a long way to go before it can live up to The Last Airbender. But I believe Korra can save Nickelodeon.

  3. #3
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by Tlachtli View Post
    I'd say add a BMP of the "Home Sweet Home" splash and wait until it is no longer found before proceeding. Once the splash is gone, you can assume the char is in the house.

    As for doing it specifically with R2, I'm not sure.
    The BMP isn't fast enough.. it doesn't detect it even when in a Repeat loop.. Well it fails when the thing shows up really fast and then disappears.. If I lag a little (so Rare :c), the BMP works.. I tried to check if its an interface but its not cuz Not even RSBot is finding it even when its on screen.. Only thing I can think of is to wait until I appear at the portal meaning I'd have to loop findrsobject but it finds it before the character even appears..
    I am Ggzz..
    Hackintosher

  4. #4
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Afaik teleporting might be an animation, so just wait til the player is no longer animating .
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

  5. #5
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by Sex View Post
    Afaik teleporting might be an animation, so just wait til the player is no longer animating .
    LOL... that is the problem.. I did wait until they stop animating.. but this isn't just teleing.. its teleing to the house.. when you tele to teh house, there is a screen that says "Homesweet Home" and shows a picture of a house.. During the time that the picture is on screen, it will return animation as -1 meaning the player isn't animating.. and if the house has a dungeon, it shows the picture of the house first, then it shows the dungeon, then the player will appear at a portal.. all of which will return the animation as -1.. and I can't put a timer because each computer is different (lag or not), each house is different (Some with a dungeon and some without)..

    So Im not sure how to actually tell when the player has appeared in a house.
    I am Ggzz..
    Hackintosher

  6. #6
    Join Date
    Mar 2006
    Location
    Behind you
    Posts
    3,193
    Mentioned
    61 Post(s)
    Quoted
    63 Post(s)

    Default

    Check if mini is Black until it's not? Does the Animation happen after the wait period? Get creative and check a couple place the are in the user Interface. The inface disappears while at that waiting screen, yes? check for the inventory or some tabs.

    ~BraK

    "Sometimes User's don't need the Answer spelled out with Code. Sometimes all they need is guidance and explanation of the logic to get where they are going."

  7. #7
    Join Date
    Jul 2008
    Location
    Canada
    Posts
    1,612
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Simba Code:
    Function DidWeTele: boolean;
    begin
        Result := R_TileOnMM(Point(0, 0));
    end;

    Just use a tile that you know will be on the MM after the teleport.

  8. #8
    Join Date
    Dec 2009
    Location
    R_GetPlayerLoc;
    Posts
    2,235
    Mentioned
    0 Post(s)
    Quoted
    14 Post(s)

    Default

    Heres something I sue in my scripts:

    Simba Code:
    Function TeleWorked(WaitTime: Integer): Boolean;

    var
      OriginalTile, NewTile: TTile;
      Timer: Integer;

    begin
      OriginalTile := R_GetMyPos;
      MarkTime(Timer);
      while (WaitTime >= TimeFromMark(Timer)) and (OriginalTile = R_GetMyPos) do
        Wait(50);
      Result := (OriginalTile <> NewTile);
    end;

    Just make sure your player isn't running or anything when you tele...

    Edit: Also, you'll need a wait after this because while you tele you're in random tiles so just add a wait to make sure the script doesn't keep on going while the screen is black...
    "Logic never changes, just the syntax" - Kyle Undefined?

    Remember, The Edit Button Is There For A Reason!!!

  9. #9
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    I got it.. I had to do:

    Simba Code:
    Repeat
        R_ClickItemBy(8013, true, '');
        if(ValidInterface(399)) then
        begin
          Writeln(GetInterfaceText(399, 1));       //Should be No Place Like Home;
        end;
      Until(false);

    Thats the only interface that disappears... All the others remain the same so If I checked for invent, it would still show up as an interface -___- which is odd because it's not on screen.. Chatbox still showed up as an interface even though it wasn't on screen either.. The only one that changed was interface 399 which shows up depending on how slow your computer is.. Had to use a computer that was 512mb ram to get it to stay on screen long enough... how bad :/
    I am Ggzz..
    Hackintosher

  10. #10
    Join Date
    Dec 2009
    Location
    R_GetPlayerLoc;
    Posts
    2,235
    Mentioned
    0 Post(s)
    Quoted
    14 Post(s)

    Default

    Quote Originally Posted by ggzz View Post
    I got it.. I had to do:

    Simba Code:
    Repeat
        R_ClickItemBy(8013, true, '');
        if(ValidInterface(399)) then
        begin
          Writeln(GetInterfaceText(399, 1));       //Should be No Place Like Home;
        end;
      Until(false);

    Thats the only interface that disappears... All the others remain the same so If I checked for invent, it would still show up as an interface -___- which is odd because it's not on screen.. Chatbox still showed up as an interface even though it wasn't on screen either.. The only one that changed was interface 399 which shows up depending on how slow your computer is.. Had to use a computer that was 512mb ram to get it to stay on screen long enough... how bad :/
    Lol at the RAM thingy...

    You could use Mines
    "Logic never changes, just the syntax" - Kyle Undefined?

    Remember, The Edit Button Is There For A Reason!!!

  11. #11
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Just check if the tile is different from before you click the portal! Easiest solution. Do that and check the black on the screen (just use four or five pts around the screen, use get colours and see if they're black).
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  12. #12
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    So you want to know when you're player is in the house? simple:
    get the tile of your player befor he teleports, then check if the character is still on that tile, if not then you're in da house!

    E: beaten by nava

  13. #13
    Join Date
    Mar 2006
    Location
    Behind you
    Posts
    3,193
    Mentioned
    61 Post(s)
    Quoted
    63 Post(s)

    Default

    Old antirandom was get Black in minimap. Can't beat the Classics.

    ~BraK

    "Sometimes User's don't need the Answer spelled out with Code. Sometimes all they need is guidance and explanation of the logic to get where they are going."

  14. #14
    Join Date
    Dec 2009
    Location
    R_GetPlayerLoc;
    Posts
    2,235
    Mentioned
    0 Post(s)
    Quoted
    14 Post(s)

    Default

    Or use mines which is what you guys posted...
    "Logic never changes, just the syntax" - Kyle Undefined?

    Remember, The Edit Button Is There For A Reason!!!

  15. #15
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by Yago View Post
    Or use mines which is what you guys posted...
    I eventually used a mix of them:

    Simba Code:
    Procedure TeleToHouse;
    var
    InvItem: TInvItem; MyPos: TTile;
    NewTile: TTile;
    Timer, PrevCount: Integer;

    begin
      if(R_ItemExists(HouseTab, InvItem)) then
      Repeat
        R_ClickItemBy(HouseTab, true, '');
        WaitForAnimation(5000);
      Until(CharacterAnimating);
      Repeat
        PrevCount:= R_CountItem(8013);
        MyPos := GetMyPos;
        R_ClickItemBy(8013, true, '');
        WaitForAnimation(7000);
      Until((GetInterfaceText(399,1) = 'There''s no place like home...') or (R_CountItem(8013) = PrevCount - 1) or CharacterAnimating);

      writeln('We Successfully teleported');

      Repeat
        wait(2000);
      Until(ValidInterface(399))

      Repeat
        wait(2000);
        NewTile := GetMyPos;
        writeln(tostr(GetMyPos));
      Until((MyPos <> NewTile) and (ValidInterface(399) = false));
        wait(1000);
    end;
    I am Ggzz..
    Hackintosher

  16. #16
    Join Date
    Feb 2009
    Location
    Irvine, CA
    Posts
    2,873
    Mentioned
    8 Post(s)
    Quoted
    138 Post(s)

    Default

    pseudocode:
    Simba Code:
    T := GetSystemTime + 6000;
    while (GetSystemTime < T) and not(result) do
      Result := not(FindColor(Black, MainScreen));

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •