Results 1 to 6 of 6

Thread: Range of color?

  1. #1
    Join Date
    Jun 2009
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Range of color?

    I currently have:

    Code:
    program New;
    
    const
      desiredtimes = 100;
    
    procedure buttoncolors(xx, yy : Integer);
    var
      colorvar, x, y : integer;
    begin
      colorvar := GetColor(xx, yy);
      case colorvar of
        1233 : SendKeys('49');   //can use f keys with a different function.
      end;
      Writeln('color :' + IntToStr(colorvar) + 'Co-ords :' + IntToStr(xx) + ', ' + IntToStr(yy));
    end;
    
    var
      xyarray : TPointArray;
      i, b : integer;
    
    begin
      wait(5000);
      xyarray := [Point(591, 475), Point(632, 475), Point(671, 475)];
      repeat
        for i := 0 to high(xyarray) do
          buttoncolors(xyarray[i].x, xyarray[i].y);
        inc(b);
        wait(100);
      until (b = desiredtimes);
    end.
    As you can see with the case(es) it looks for a specific color. But I want to use a range, so it can be around that color.

    Would it be possible to take a number like 1234567 and cut it down to 12345? I know in PHP/JavaScript it would be simple using substr().. just don't know SCAR.

    Edit: OR instead can I make it say if NOT some color? Would I then need to remove the case and change it to if/elseif? If so can someone show me an example? I know 0 SCAR syntax.
    Last edited by Al3x8730; 06-17-2009 at 12:14 PM.

  2. #2
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    SCAR Code:
    if SimilarColors(colorvar, 1233, 15) then
    ...
    15 is tolerance

  3. #3
    Join Date
    Sep 2006
    Location
    Canada
    Posts
    1,124
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    if (GetColor(x, y) <> 1234) then

    Is that something your looking for? <> is not equal signs. I don't really know what your trying to do :\.

  4. #4
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Would it be possible to take a number like 1234567 and cut it down to 12345? I know in PHP/JavaScript it would be simple using substr().. just don't know SCAR.
    Yes it is possible, take a look at a list of SCAR functions, under string. I do not have SCAR right now so I do not know exactly but as far as I recall there is a substring function, also copy can be used.



    ~NS

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

    Default

    Yes, it is possible to shorten colors by using Hex.

  6. #6
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Quote Originally Posted by Nadeem View Post
    Yes it is possible, take a look at a list of SCAR functions, under string. I do not have SCAR right now so I do not know exactly but as far as I recall there is a substring function, also copy can be used.



    ~NS
    An even easier way would be to use the div operator. As long as you're working with integers, SCAR truncates instead of rounds, so this is what would happen:
    1234567 div 100 = 12345
    1233321 div 10 = 123332
    1231219 div 10000 = 123

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
  •