Results 1 to 10 of 10

Thread: Basic help.

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

    Default Basic help.

    I've never really learned much SCAR.. I learned a decent amount of it a few months ago.. But since I don't have to use it often I don't remember anything.. I know several other programming languages (C++, Php, AS3/2) So I should be able to catch on quickly. I just need something that will push a certain button when a color gets to an certain point (x, y). I need to be able set more than one conditional though. Eg. If (x1 and y1) == somecolor press this button. If (x2 and y2) == somecolor press another button (5 of those).

    Any help is greatly appreciated.

    Edit, it would also be really good if instead of specific colors if it could be a certain color range. Maybe an alpha value? Because it would normally be like a dark color, then it might change into a shade of red.
    Last edited by Al3x8730; 06-17-2009 at 10:29 AM.

  2. #2
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    procedure buttonifcolor;
    var a : integer;
    begin
    a := getcolor(x,y);
    case a of
    color1 : sendkeys(idon'tknowstuff...);
    color2 : sendkeys(see above);
    end;
    end;(don't know if this one is needed...)

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

    Default

    Where can I find the numbers for the keys :P

    Also, it would be different. Because There will be 5 different x and y values. And there will be a certain color that each one will be, and a certain button that will be pressed when that one turns its color.

  4. #4
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    i do believe is it ascii?(for the numbers)
    SCAR Code:
    program New;

    procedure buttoncolors(xx, yy : Integer);
    var
      colorvar : integer;
    begin
      colorvar := GetColor(xx, yy);
      case colorvar of
        1233 : SendKeys('letters here');   //can use f keys with a different function.
        1234 : SendKeys('letters here');
        1235 : SendKeys('letters here');
        1236 : SendKeys('letters here');
        1237 : SendKeys('letters here');
      end;
      Writeln('color :' + IntToStr(colorvar) + 'Co-ords :' + IntToStr(xx) + ', ' + IntToStr(yy));
    end;

    begin
      buttoncolors(230, 430); // put x and y values here.
      //maybe use a repeat for multiple things...
    end.

    whipped this up real quick...

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

    Default

    I appreciate all the help so far. But it seems to only run it once. I know it's probably really simple..But how do I setup an inf loop on the buttoncolor functions?

  6. #6
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    umm... just a sec, i will put in an array.

    SCAR Code:
    program New;

    const
      desiredtimes = 100;

    procedure buttoncolors(xx, yy : Integer);
    var
      colorvar : integer;
    begin
      colorvar := GetColor(xx, yy);
      case colorvar of
        1233 : SendKeys('letters here');   //can use f keys with a different function.
        1234 : SendKeys('letters here');
        1235 : SendKeys('letters here');
        1236 : SendKeys('letters here');
        1237 : SendKeys('letters here');
      end;
      Writeln('color :' + IntToStr(colorvar) + 'Co-ords :' + IntToStr(xx) + ', ' + IntToStr(yy));
    end;

    var
      xyarray : TPointArray;
      i, b : integer;

    begin
      xyarray := [Point(x1, y1), Point(x2, y2), Point(x3, y3), Point(x4, y4), Point(x5, y5)];
      repeat
        for i := 0 to high(xyarray) do
          buttoncolors(xyarray[i].x, xyarray[i].y);
        inc(b);
        wait(1000 + random(1000));
      until (b = desiredtimes);
    end.

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

    Default

    I just put a repeat until 1=2;

    I got like one final question. It works, but the objects move kinda fast so it only gets it like 1/5 of the time, or even less. The colors are very similar, they range from: 16741606 - 16751341 Is there any way to set a range between those values so it'll press the button if the color is between those 2 numbers?

  8. #8
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    do you want it to press the same button for the range of colors?

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

    Default

    Yes. There will be 5 ranges. With range 1 = press button 1, etc.. Just like it is now, just with ranges.

  10. #10
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    ok... maybe use findcolortolerance... i can't help anymore atm, i gotta go eat dinner. join the irc and ask for help
    http://hy71194.mgatesphoto.com/srlchat/

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
  •