Results 1 to 3 of 3

Thread: Ffs why is this not returning

  1. #1
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default Ffs why is this not returning

    Ok, so I am trying to make a function to check to see if colors changed:

    Simba Code:
    {$i srl/srl.simba}
    Var
      s_Points:TPointArray;
    function pointsChanged(pnts:TPointArray): Integer;
    Var
      c, i, t, matched:Integer;
    begin
      MarkTime(t);
      repeat
          for i:=0 to high(pnts) do
          begin
            c := GetColor(pnts[i].x,pnts[i].y);
            if (c = (GetColor(pnts[i].x,pnts[i].y))) then matched:=matched+1;
          end;
          try
            result := Round((matched)/(high(pnts)*100));
            exit;
            except
              writeln('Error calculating');
              exit;
          end;
      until (TimeFromMark(t)>500)
    end;

    begin
      s_Points := [Point(0,0),Point(1,1)];
      repeat
        wait(100)
      until(pointsChanged(s_Points)>10)
    end.


    But it does not work for some reason, I tested it on paint what the hell am I doing wrong?

  2. #2
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    If I'm understanding you right you're wanting to calculate how many points, from the given point array, change after X milliseconds? If so use this I made for an anti-random:
    Simba Code:
    function getPixelShiftTPA(T: Integer; TPA: TPointArray): Integer;
    Var
      BMP,BMP2: Integer;
    begin
      BMP := BitmapFromClient(MSx1,MSy1,MSx2,MSy2);
      Wait(T);
      BMP2 := BitmapFromClient(MSx1,MSy1,MSx2,MSy2);

      Result := CalculatePixelShiftTPA(BMP, BMP2, TPA);
      FreeBitmap(BMP);
      FreeBitmap(BMP2);
    end;

    The parameters speak for themselves, T = time between checking the TPA, and TPA is the TPA (only the TPA) that will be checked for pixelshift.

    An example would be
    Simba Code:
    if (getPixelShiftTPA(500, FishingSpotTPA) > 50) then
        Writeln('This TPA shifted 50 pixels in 500ms, it must be a spot!');

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  3. #3
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    If I'm understanding you right you're wanting to calculate how many points, from the given point array, change after X milliseconds? If so use this I made for an anti-random:
    Simba Code:
    function getPixelShiftTPA(T: Integer; TPA: TPointArray): Integer;
    Var
      BMP,BMP2: Integer;
    begin
      BMP := BitmapFromClient(MSx1,MSy1,MSx2,MSy2);
      Wait(T);
      BMP2 := BitmapFromClient(MSx1,MSy1,MSx2,MSy2);

      Result := CalculatePixelShiftTPA(BMP, BMP2, TPA);
      FreeBitmap(BMP);
      FreeBitmap(BMP2);
    end;

    The parameters speak for themselves, T = time between checking the TPA, and TPA is the TPA (only the TPA) that will be checked for pixelshift.

    An example would be
    Simba Code:
    if (getPixelShiftTPA(500, FishingSpotTPA) > 50) then
        Writeln('This TPA shifted 50 pixels in 500ms, it must be a spot!');
    O thanks thanks!

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
  •