Results 1 to 13 of 13

Thread: Can't find colours..

  1. #1
    Join Date
    Oct 2007
    Location
    Florida
    Posts
    35
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Can't find colours..

    I seem to be having a problem getting my script to find colours, it simply can't/won't find them.. Maybe i'm doing something wrong, if so please clarify. Oh and this is just a test script, I don't plan on using some of the functions like MoveMouse or ClickMouse in an RS script as I have heard those are detectable.

    SCAR Code:
    program Test;

    var
    x, y, i, mx, my, mmx, mmy: Integer;

    {.}

    procedure ColourTest;
       begin
        ClearDebug;
        Writeln('Testing..');
        Wait(1000);
        ActivateClient;
        Wait(2000);
       If FindColor(x, y, 6717440, mx, my, mmx, mmy) then
        begin
         Writeln('Colour found! Lets try clicking it..');
         Wait(1000);
         MoveMouse(x, y);
         ClickMouse(x, y, true);
         Writeln('We clicked it!');
         Wait(1000);
       end else
         Writeln('Failed to find the colour... :( ');
         Wait(2000);
       end;

    begin
    ColourTest;
    end.

    I've tried lots of different colours, different windows/clients you name it.. It just doesn't want to work .

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

    Default

    mx, my, mmx, mmy < --- those need to be set to a const
    if you are doing rs then do msx1, msy1, msx2,msy2 for the mainscreen
    if not then just find out what the largest co-ords are and put
    0, 0, largestx, largesty

  3. #3
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Quote Originally Posted by mormonman View Post
    mx, my, mmx, mmy < --- those need to be set to a const
    if you are doing rs then do msx1, msy1, msx2,msy2 for the mainscreen
    if not then just find out what the largest co-ords are and put
    0, 0, largestx, largesty
    They do not have to be set at constants, but instead of doing mx, my, mmx and mmy you could simply enter the numbers of where you want the script to search (Mute)

  4. #4
    Join Date
    Oct 2007
    Location
    Florida
    Posts
    35
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Oh, thanks.


    I thought it might have figured out the size of the window like it did the coords, guess I was wrong. ^^'

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

    Default

    Quote Originally Posted by Zyt3x View Post
    They do not have to be set at constants, but instead of doing mx, my, mmx and mmy you could simply enter the numbers of where you want the script to search (Mute)
    those are constant -.- lol

  6. #6
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Quote Originally Posted by mormonman View Post
    those are constant -.- lol
    SCAR Code:
    var
      mx, my, mmx, mmy: Integer;
    begin
      mx := 0;
      My := 0;
      mmx := 3256362546546;
      mmy := 32625878i585858;
      FindColor(...);
    end;
    They dont have to be...
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

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

    Default

    Quote Originally Posted by noidea View Post
    SCAR Code:
    var
      mx, my, mmx, mmy: Integer;
    begin
      mx := 0;
      My := 0;
      mmx := 3256362546546;
      mmy := 32625878i585858;
      FindColor(...);
    end;
    They dont have to be...
    touche

  8. #8
    Join Date
    Oct 2007
    Location
    Florida
    Posts
    35
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Is there any way to find out the exact size of the window you have targeted using a SCAR command, or something like that?

    I can easily figure the approx coordinates but it'd be nice to have an exact number..

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

    Default

    use the eyedropper. and click on the edge of the applet/window
    it should put it in debug as (x, y) with the color at that spot

  10. #10
    Join Date
    Oct 2007
    Location
    Florida
    Posts
    35
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I know this, that's how I have been doing it previously, but I wasn't sure if there was some silly function/command that made things easier like FindWindowSize; or something. :P

  11. #11
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    GetClientDimensions(width, height)

  12. #12
    Join Date
    Oct 2007
    Location
    Florida
    Posts
    35
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by bullzeye95 View Post
    GetClientDimensions(width, height)
    I LOVE YOU!

    I tried it out in a script it and it worked perfectly

    SCAR Code:
    program TestColours;

    var
    x, y, mx, my: Integer;

    procedure Colours;
     begin
      GetClientDimensions(mx,my);
       ClearDebug;
       Writeln('Our client is '+ IntToStr(mx) +' by '+ IntToStr(my) +'');
        Wait(1000);
      If FindColor(x,y,6126318,0,0,mx,my) then
        begin
         Writeln('');
         Writeln('Colour found!');
         Wait(1000);
         MoveMouse(x,y);
        end else
         Writeln('Colour not found.. :(');
    end;

    begin
     Colours;
    end.

    Thanks a bunch ^^;

  13. #13
    Join Date
    Apr 2009
    Location
    California!
    Posts
    280
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    msx1, msy1, msx2, msy2, (Looks in the Main Screen)
    mix1, miy1, mix2, miy2, (Looks in the Inventory)
    mmx1, mmy1, mmx2, mmy2, (Looks on the MiniMap)
    mccx, mccy, (Looks in the Chat Window)

    If you need more explaining then just post.
    Hope this helps.
    Also you could use a DTM/DDTM instead of looking for the color. (Just a thought, if you just started scripting, keep going with color).

    Edit: You should try using FindColorTolerance(x, y, YourColor, msx1, msy1, msx2, msy2, 10);
    Cause colors change in rs everytime you log. Tolerance allows it to find the color within a range of pixles. (The 10.)

    This tut helped me out A LOT! Here Check it out.

    Edit: Also instead of using MoveMouse. You should use Mouse.
    Ex.
    SCAR Code:
    FindColorTolerance(x, y, YourColor, msx1, msy1, msx2, msy2, 10);
    Mouse(x, y, 2, 2, True);
    True = Left Click
    False = Right Click

    Edit:
    SCAR Code:
    program TestColors;
    {.include srl/srl.scar}

    var
    x, y, mx, my: Integer;

    procedure Colours;
     begin
      GetClientDimensions(mx,my);
       ClearDebug;
       Writeln('Our client is '+ IntToStr(mx) +' by '+ IntToStr(my) +'');
        Wait(1000);
      If FindColorTolerance(x, y, 6126318, msx1, msy1, msx2, msy2, 10) then
        begin
         Writeln('');
         Writeln('Colour found!');
         Wait(1000);
         Mouse(x, y, 2, 2, True);
        end else
         Writeln('Colour not found.. :(');
    end;

    begin
      SetupSrl;
      Colours;
    end.
    Tell me if that works
    Last edited by Mystic; 05-16-2009 at 04:15 PM.
    ~Penguin
    Semi-active
    http://i44.tinypic.com/33vk9aq.jpg
    SELL AUTOED GOODS AT MID-MAX! DON'T LET PRICES FALL AND GIVE US LESS PROFIT. (Put this in your sig)

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
  •