Results 1 to 8 of 8

Thread: Tracking Moving Objects (Trees)

  1. #1
    Join Date
    Apr 2007
    Location
    Laguna Beach, California
    Posts
    231
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Tracking Moving Objects (Trees)

    Hello, I want to make a procedure or function that will track a tree and figure out if the tree is above below left or right of the player. I want to do this because if I can get a procedure that does this I think I can successfully find ents and avoid them. Let me expain this procedure.

    For example if you click a tree in the runescape screen that is not directly next to your player the tree moves on the screen relative to your player. So if I can track the tree I can move the mouse to the correct tree and check for the yellow text. The reason I cant just move the mouse to the tree color is because when there are more than one trees in the screen sometimes the mouse moves to the wrong tree and then it cant find the yellow text obviously.

    So if the script finds the tree color and the tree moves I want the function to track the object to its final location so I can check for the yellow text on the correct tree. Also I think I can make this notice when the tree dissappears so it click on a different tree at more human like pace.

    So does anyone have a suggestion on how i would go about doing this?

  2. #2
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    You need to get a temporary color when you click the tree. This way you can update the color while you're moving. While the flag is up, you need to search for the color. If you don't lose the color and the flag is gone, you have your position of the tree
    Hup Holland Hup!

  3. #3
    Join Date
    Apr 2007
    Location
    Laguna Beach, California
    Posts
    231
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks nielsie, that makes sense. Just one question.

    What if while the flag is up and my player is moving another tree pops up. How do I make sure the script stays with the right tree?

    Edit: I think I answered my question. So would this work:

    SCAR Code:
    function LongFlag:boolean;  // just because the flag disappears sometimes before
    begin                       // you stop moving
      Flag;
      Wait(500+random(100));
      result := true;
    end;

    function UpdateXY:boolean;
    begin
      while (LongFlag) do
        begin
          if (FindColorSpiralTolerance(x, y, MapleMS1, x - 15, y - 15, x + 15, y + 15, 3))
          or (FindColorSpiralTolerance(x, y, MapleMS2, x - 15, y - 15, x + 15, y + 15, 3))
          or (FindColorSpiralTolerance(x, y, MapleMS3, x - 15, y - 15, x + 15, y + 15, 3)) then
            Wait(50+random(50)) else
            result := false;
        end;
      if (FindColorSpiralTolerance(x, y, MapleMS1, x - 10, y - 10, x + 10, y + 10, 3))
      or (FindColorSpiralTolerance(x, y, MapleMS2, x - 10, y - 10, x + 10, y + 10, 3))
      or (FindColorSpiralTolerance(x, y, MapleMS3, x - 10, y - 10, x + 10, y + 10, 3)) then
        result := true;
    end;

    So for instance this would be put in after the global x and y are set in the script and then it just updates the x and y.

  4. #4
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    While doesn't work that way..
    You can change LongFlag to FlagPresent and add a little wait between each search (50 will do).
    Hup Holland Hup!

  5. #5
    Join Date
    Apr 2007
    Location
    Laguna Beach, California
    Posts
    231
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    K thanks, that makes sense. Does the code after the while naturally repeat while the boolean is true?

  6. #6
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    Yup

    SCAR Code:
    while i < 100 do
    begin
      i := i + 1;
    end;

    is the same as

    SCAR Code:
    repeat
      i := i +1;
    until i >= 100;
    Hup Holland Hup!

  7. #7
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    When I saw this topic I almost had a heart attack since nielsie was the last one posted, and the topic was "tracking a moving object" I was like omfg nielsie made the thing checking uptext and moving mouse same time

  8. #8
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    I did that.. But it was in another thread, lol
    Hup Holland Hup!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. regarding ID of trees with DTM's
    By someone in forum OSR Help
    Replies: 2
    Last Post: 06-24-2007, 05:33 PM

Posting Permissions

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