Results 1 to 3 of 3

Thread: Selecting colors

  1. #1
    Join Date
    Jul 2007
    Posts
    81
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Selecting colors

    If you need to enter place, just as a boat or a cave etc. and u need your script to find the color of the entrance, but there are other exact/similar colors in the area how would you get it to only select the door/cave/entrance?

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

    Default

    Use FindObjCustom.

    For the theory, you would need to create a loop, then loop through the points of the color.

  3. #3
    Join Date
    Jul 2007
    Posts
    81
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Code:
    Function FindBoatColor: integer;
    var
      i,tc,tc2: integer;
      bpts: Tpointarray;
    begin 
    colortolerancespeed(1);
      findcolorstolerance(bpts,1325637,mmx1,mmy1,mmx2,mmy2,50);
      for i := 0 to high(bpts) do
      begin
        tc := Getcolor(bpts[i].x,bpts[i].y);
        if similarcolors(tc,1325637,45) then
    begin
          tc2 := Getcolor(bpts[i].x + 1,bpts[i].y);
          //if (abs(tc2 - tc) = 396557) or (abs(tc2 - tc) = 3341) or (abs(tc2 - tc) = 331021) or (abs(tc2 - tc) = 461324) then
          if (abs(tc2 - tc) = 396557) or (abs(tc2 - tc) = 3341) or (abs(tc2 - tc) = 331021) or
            (abs(tc2 - tc) = 461324) or (abs(tc2 - tc) = 2572) then
          begin
            Result := tc;
            if Debug then Writeln('BoatColor := ' + inttostr(result));
            exit;
          end;
        end;
      end;
    end;
    Im trying to figure out how to fix it to click a bridge to enter a boat but the dock is the same color as the bridge and it cant find the bridge so it just gets lost

    EDIT: this is just finding the color of the plank
    Last edited by kylerperson; 09-14-2009 at 11:44 AM.

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
  •