Results 1 to 6 of 6

Thread: isMoving and waitUntilStopMoving

  1. #1
    Join Date
    Oct 2006
    Posts
    207
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default isMoving and waitUntilStopMoving

    Two new functions i made today:
    isMoving
    Returns true if your player is moving (based on points on the minimap)

    waitUntilStopMoving
    Waits until your player has stopped moving (similar to fFlag(0) but uses points on the minimap)

    SCAR Code:
    function isSpecCol(col: integer): boolean;
    begin
      case col of
        1310462: result := true;    //NPCs
        982782: result := true;
        195836: result := true;
        62965: result := true;
        56797: result := true;
        60909: result := true;
        52428: result := true;      //End of NPCs

        16711422: result := true;   //Players
        15527148: result := true;
        13816530: result := true;
        14869218: result := true;
        12961221: result := true;   //End of Players

        3553023: result := true;    //Drops
        789758: result := true;
        2105598: result := true;
        395004: result := true;
        233: result := true;
        241: result := true;
        206: result := true;
        217: result := true;
        188: result := true;        //End of Drops

        16777215: result := true;   //Your player

        65536: result := true;      //Bottom of drop dots
       
        255: result := true;        //Flag
        284358: result := true;
        1127261: result := true;    //End of flag
      end;
      //if(result) then
      //  writeln(intToStr(col));
    end;

    function isMoving: boolean;
    var
      NumOfPoints: integer;
      numDone: integer;
      Points: array of record
                x, y, color: integer;
              end;
      x, y: integer;
      color: integer;
      i: integer;
    begin
      NumOfPoints := 20;
      numDone := 0;
      setLength(points, NumOfPoints);
      repeat
        wait(1);
        x := random(MMX2 - MMX1) + MMX1;
        y := random(MMY2 - MMY1) + MMY1;
        if(not isOnMinimap(x, y)) then
          continue;
        color := getColor(x, y);
        if(isSpecCol(color)) then
          continue;
        points[numDone].x := x;
        points[numDone].y := y;
        points[numDone].color := color;
        numDone := numDone + 1;
        if(numDone = NumOfPoints) then
          break;
      until(false)
      wait(100 + random(50));
      for i := 0 to NumOfPoints - 1 do
      begin
        wait(1);
        color := getColor(points[i].x, points[i].y);
        if(color <> points[i].color) then
        begin
          if(not isSpecCol(color)) then
          begin
            //writeln('Yea ' + intToStr(color) + ', ' + intTOStr(points[i].color) + ' ' + intToStr(points[i].x) + ', ' + intToStr(points[i].y));
            result := true;
            exit;
          end;
        end;
      end;
    end;

    procedure waitUntilStopMoving;
    var
      t1, t2: integer;
    begin
      T1 := GetTickCount;
      repeat
        T2 := GetTickCount;
        Wait(100);
        if T2 - T1 > 30000 then
        begin
          Mouse(MMCX, MMCY, 0, 0, True);
          Break;
        end;
        if Random(20) = 1 then IdleTime(500, 1000, 0.01);
      until (not isMoving);
    end;

  2. #2
    Join Date
    Sep 2007
    Posts
    118
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    This could be really useful as a failsafe when walking, nice work!
    I'll try it out for sure.

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

    Default

    Nice job, though some tips:

    a) For the case, instead make an array of integer, load all the colors there and do Result := InIntArray(Array, Int).

    b) The function seems good, and I believe it works better than the following, but maybe comparing distance from MMC to flag would be simpler?

    And no, I am not saying anything about converting to that, simple and short = shit.

    SSS

  4. #4
    Join Date
    Mar 2007
    Posts
    3,681
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    what points on the MM does it use?

  5. #5
    Join Date
    Oct 2006
    Posts
    207
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    @n3ss3s

    Cool, thanks dont know what the use of it is though...

    #hugolord
    It picks random points on the minimap which arnt covered by things that can move, such as player/drop/NPC dots etc.

  6. #6
    Join Date
    Sep 2006
    Location
    New Jersey, USA
    Posts
    5,347
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Ahh, I like!

    Great for stuff that moves you but doesn't flag.
    Interested in C# and Electrical Engineering? This might interest you.

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
  •