Results 1 to 11 of 11

Thread: True waitWhileMoving - even when using objects that move you.

  1. #1
    Join Date
    Apr 2015
    Posts
    112
    Mentioned
    2 Post(s)
    Quoted
    45 Post(s)

    Default True waitWhileMoving - even when using objects that move you.

    I noticed that isMoving would return False when using agility obstacles, your destination would return as your current position and most of the walk on obstacles registered no animation.

    I wrote a procedure to wait- checking every 2 game ticks (1200 ms) if you have moved to a new tile, breaking if you have not.

    Simba Code:
    procedure waitWhileMoving;
    var
    tim : Timer;
    lastTile : TTile;
    finished : Boolean;
    Player: TReflectLocalPlayer;
    begin
      player.create; //Take this and the player declaration out if you've already created your player.
      tim.start;
      repeat
        if tim.timeElapsed > 20000 then
          break;
        lastTile := player.GetTile;
        wait(1200); // 600ms is 1 game tick, so this corresponds to two in game ticks.
        if (player.GetTile.X = lastTile.X) and (player.GetTile.Y = lastTile.Y) then
          finished := True;
      until(finished);
    end;

    I imagine an isMoving function would look something like this (Although the wait involved would make it unsuitable for a few tasks)

    Simba Code:
    function isMoving(ticks : Integer) : Boolean;
    var
    lastTile : TTile;
    Player: TReflectLocalPlayer;
    begin
      result := True;
      player.create; //Take this and the player declaration out if you've already created your player.
      lastTile := player.GetTile;
      wait(ticks * 600); // 600ms is 1 game tick.
      if (player.GetTile.X = lastTile.X) and (player.GetTile.Y = lastTile.Y) then
        result := False;
    end;
    Last edited by Davi; 05-16-2015 at 05:44 PM.

  2. #2
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Check walk queue length.

  3. #3
    Join Date
    Apr 2015
    Posts
    112
    Mentioned
    2 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by tls View Post
    Check walk queue length.
    Is empty when using agility obstacles.

  4. #4
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    For agility specifically, I would handle it like this:
    1. Click obstacle
    2. If click was successful(red cross), then go into wait loop
    3. In wait loop check for tile position equal to the destination tile and plane of the obstacle
    I would also include the timeout of tile position not changing for like 3 seconds(loading time between obstacles can vary).

  5. #5
    Join Date
    Apr 2015
    Posts
    112
    Mentioned
    2 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by tls View Post
    For agility specifically, I would handle it like this:
    1. Click obstacle
    2. If click was successful(red cross), then go into wait loop
    3. In wait loop check for tile position equal to the destination tile and plane of the obstacle
    I would also include the timeout of tile position not changing for like 3 seconds(loading time between obstacles can vary).
    That was my 5th or 6th attempted solution. It had two major problems in that it involved setting a destination tile for a huge number of obstacles, in my rooftop script I have 52? or around that number defined obstacles so far. The second problem is that certain obstacles would have variable destination tiles not just in the X-axis but the Y-axis as well (Gaps would drop you in a different X-plane depending on where you clicked, swings a different Y-plane) So then you have to define destination regions for each obstacle, iterate through the possible tiles in the region checking if it's equal to your current tile. I think for practicalities sake I did a simple > check for the lowest possible tile within the region.

    I settled on the above solution as it works for all obstacles with no extra data required.
    Last edited by Davi; 05-16-2015 at 09:19 PM.

  6. #6
    Join Date
    Sep 2012
    Location
    Netherlands
    Posts
    2,752
    Mentioned
    193 Post(s)
    Quoted
    1468 Post(s)

    Default

    @Davi; what i used in my color agility script is just checking in what area you are in.

    for example: after clicking on an object, you'll get a red cross. After that you are going to wait until you are on a new platform or a time out happened (missclick perhaps).

  7. #7
    Join Date
    Apr 2015
    Posts
    112
    Mentioned
    2 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by hoodz View Post
    @Davi; what i used in my color agility script is just checking in what area you are in.

    for example: after clicking on an object, you'll get a red cross. After that you are going to wait until you are on a new platform or a time out happened (missclick perhaps).
    Yeah, that's the basic principle I started with, but how do you check if you're in a new area? Take a snapshot of the area before you traverse the obstacle and compare it to MS until it's different? That would trigger during traversing the obstacle. If it involves knowing any data about the destination location it's simply not viable for a script of this size.

  8. #8
    Join Date
    Sep 2012
    Location
    Netherlands
    Posts
    2,752
    Mentioned
    193 Post(s)
    Quoted
    1468 Post(s)

    Default

    Quote Originally Posted by Davi View Post
    Yeah, that's the basic principle I started with, but how do you check if you're in a new area? Take a snapshot of the area before you traverse the obstacle and compare it to MS until it's different? That would trigger during traversing the obstacle. If it involves knowing any data about the destination location it's simply not viable for a script of this size.
    i got every location defined.
    here an example, every roof is a different location/area:

  9. #9
    Join Date
    Apr 2015
    Posts
    112
    Mentioned
    2 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by hoodz View Post
    i got every location defined.
    here an example, every roof is a different location/area:
    Is that done with an automated process that can be applied to all agility courses?

  10. #10
    Join Date
    Sep 2012
    Location
    Netherlands
    Posts
    2,752
    Mentioned
    193 Post(s)
    Quoted
    1468 Post(s)

    Default

    Quote Originally Posted by Davi View Post
    Is that done with an automated process that can be applied to all agility courses?
    yes, took a while before i finished it. But im proud in the result!

    here a progress report from the script:


    seers village rooftop, including breaks (hence the low xp/h)

  11. #11
    Join Date
    Apr 2015
    Posts
    112
    Mentioned
    2 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by hoodz View Post
    yes, took a while before i finished it. But im proud in the result!

    here a progress report from the script:


    seers village rooftop, including breaks (hence the low xp/h)
    Nice, I'm not sure how I would go about grabbing the areas automatically, I suppose looking for the borders on the minimap? I think I'll stick to my above method as it works perfectly on all the courses I've coded so far: (Gnome Village, Draynor, Varrock, Canafis, Falador)

    This is proggie:


    This was on varrock shortly after implementing the above, with a break or two in there.
    Last edited by Davi; 05-16-2015 at 10:32 PM.

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
  •