Results 1 to 9 of 9

Thread: FindColor x, y that doesn't = 0

  1. #1
    Join Date
    Oct 2009
    Posts
    15
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default FindColor x, y that doesn't = 0

    is there a way to find a Changing color on a Single Colored block BG (in my case black or white) thats already built into scar? in my mind it would seem a useful function but i can't find any in the built-in functions list

    i've made my own but i was just curious.

    Code:
    function FindNotColor(var x, y: Integer; Color, xs, ys, xe, ye: Integer): Boolean;
    var
      xx, yy: Integer;
    begin
      for xx := xs to xe do
        for yy := ys to ye do
          if GetColor(xx, yy) <> Color then
          begin
            x := xx;
            y := yy;
            Result := True;
            //If you want it to work faster then you need to
            //put Exit; here or something :p
          end;
    end;

  2. #2
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Just do
    SCAR Code:
    if FindColor(x, y, Color, blah, blah, blah, blah) <> TheNum then
    ...(it is not the color)
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

  3. #3
    Join Date
    Apr 2007
    Location
    Perth, Australia
    Posts
    3,926
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Maybe:

    SCAR Code:
    if (not(FindColor(X, Y, Color, x1, y1, x2, y2))) then
    begin
      //What happens when it doesn't find the colour
    end;

  4. #4
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    ^ yeah, that is what I meant. Sorry haven't scripted for a cool minute ;D.
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

  5. #5
    Join Date
    Oct 2009
    Posts
    15
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Simply, no, if i run that it'll always find false and have the x, y co-ord xe, ye

    I want to be able to CLICK the color i'm "not" finding

  6. #6
    Join Date
    Apr 2007
    Location
    Perth, Australia
    Posts
    3,926
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    I see, well in that case there is no in-built function to do that.

  7. #7
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    SCAR Code:
    if (GetColor(X, Y) <> Colour) then
    ?
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  8. #8
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    Quote Originally Posted by FrostFyr View Post
    Simply, no, if i run that it'll always find false and have the x, y co-ord xe, ye

    I want to be able to CLICK the color i'm "not" finding
    I don't understand what you want to do. You don't want to find a colour, yet click on it?
    E: So you want to loop over all possible pixels, and the first that does NOT match the colour passed, should be clicked?



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

  9. #9
    Join Date
    Oct 2009
    Posts
    15
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It should do pretty much what the code i provided does:
    search a range for any color that doesn't equal the Color variable

    and since there's no inbuilt function my question has been answered
    Thank you guys

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
  •