Results 1 to 5 of 5

Thread: FindNewRoadColor fix'ish

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

    Default FindNewRoadColor fix'ish

    We need to remove ActivateClient; before it, as it was causing the client to de-activate. This harms people who use radial walk and people who use IE7. The activateclient stops the RS compass from turning unless you click on the client.

    Replace the current one with this:

    SCAR Code:
    {*******************************************************************************
    function GetNewRoadColor(xs, ys, xe, ye, tol: Integer): Boolean;
    By: Wizzup? / WT-Fakawi and modified by Ron,Activate Fix by NaumanAkhlaQ
    Description: Copies and compares a Bitmap of 20* 20 around Flag with known RoadColor.
    Results the new global RoadColor.
    *******************************************************************************}


    function GetNewRoadColor(xs, ys, xe, ye, tol: Integer): Boolean;
    var
      DebugCanvas, ClientCanvas, MMCanvas: TCanvas;
      fpx, fpy, bmp, w, h: Integer;
      TC: TColor;
      bmp1: Integer;
    begin
      if (DebugRadialRoad) then
      begin
        if (XS > XE) then
          WriteLn('Error with RadialRoadWalk XS : ' + IntToStr(XS) + '  XE : ' +
            IntToStr(XE));
        if (YS > YE) then
          WriteLn('Error with RadialRoadWalk YS : ' + IntToStr(YS) + '  YE : ' +
            IntToStr(YE));
      end;
      w := xe - xs;
      h := ye - ys;
      if (not (LoggedIn)) then Exit;
      if (DebugRadialRoad) then
      begin
        DisplayDebugImgWindow(w, h);
        DebugCanvas := GetDebugCanvas;
        ClientCanvas := GetClientCanvas;
        SafeCopyCanvas(ClientCanvas, DebugCanvas, xs, ys, xe, ye, 0, 0, w, h);
      end;
      bmp1 := BitmapFromString(w, h, '');
      Wait(1);
      MMCanvas := GetBitmapCanvas(bmp1);
      Wait(1);
      try
        bmp := BitmapFromString(w, h, '');
        Wait(1);
        SafeCopyCanvas(getclientcanvas, GetBitmapCanvas(bmp), xs, ys, xe, ye, 0, 0,
          w, h)
      except
        WriteLn('Error with RadialRoadWalk');
        WriteLn('Should be fixed though, so lets debug.');
        WriteLn('xs = ' + IntToStr(xs) + '  ys = ' + IntToStr(ys) + '  xe = ' +
          IntToStr(xe) + '  ye = ' + IntToStr(ye));
        GetClientDimensions(w, h);
        WriteLn('and client area is 0, 0, ' + IntToStr(w) + ', ' + IntToStr(h));
        SaveBitmap(bmp, 'RoadWalkBMP');
        SaveBitmap(bmp1, 'RoadWalkBMP1');
        repeat
          Wait(1000);
        until (not (LoggedIn));
        FreeBitmap(bmp);
        FreeBitmap(bmp1);
        Exit;
      end;
      Wait(1);
      for fpy := 1 to h do
        for fpx := 1 to w do
        begin
          TC := FastGetPixel(bmp, fpx, fpy);
          if SimilarColors(TC, RoadColor, tol) then
          begin
            RoadColor := TC;
            StoreToRoadColorArray;
            Result := True;
            Exit;
          end
        end;
      FreeBitmap(bmp1);
    end;

  2. #2
    Join Date
    Oct 2006
    Location
    United States
    Posts
    672
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Looks pretty good, if I ever need to use getnewroadcolor Ill be sure to use this one, Good Job!

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

    Default

    What?? Its not a function, its a fix. ActivateClient in that procedure, which was used in RRW which is used in RW so on.., Was causing the client (IE especially) to de-activate - Meaning that you couldn't turn the compass until you clicked on the client..

  4. #4
    Join Date
    Apr 2007
    Posts
    2,593
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    So, if we use firefox, we don't really need to change this?

  5. #5
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    No not really, but as 1/4 of people here use IE then its a big prob

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
  •