Problem with the color picker...

Discussion in 'Code Snippets and Tutorials' started by gaelle, Nov 26, 2007.

  1. gaelle

    gaelle Level IV

    Joined:
    Dec 24, 2006
    Messages:
    796
    Likes Received:
    5
    Location:
    France
    Hi, I'd like to use the color picker, so my script is :
    program MoveandClick;

    var x,y:integer;

    procedure blah;
    begin
    if (findcolor(x,y,39168,0,0,0,0)) then
    KeyDown(32);
    end;

    begin
    repeat
    blah;
    until(false)
    end.
    But when i start it with splash a sloth, the spacebar is hold down even if the color isn't find !!
    And what are the four 0 after 39168 too ?
    Thanks for help =)
     
  2. tharoux

    tharoux Level IV

    Joined:
    Dec 30, 2006
    Messages:
    2,733
    Likes Received:
    126
    Location:
    In front of my PC, Montreal
    first, with a keydown, there must be a key up. right now, your holding the space bar until you stop the program.
    i.e.:
    KeyDown(32);
    Wait(250);
    KeyUp(32);

    second: the find color funtion work this way:
    FindColor(x,y,color,TL,TR,BL,BR);
    x,y = integer used to store the cord if the color is found
    color = using an integer for the color
    TL=top left, TR=top right,BL=bottom left,BR=bottom left, all using integer.
    You need to specify the area you want to search... right now, you're searching an aera of 0 X 0 pixel... :arf:
    In fact, you put 39168 as the color to find but where did you get this value?

    Anyway, let me know if you need more help
     
  3. gaelle

    gaelle Level IV

    Joined:
    Dec 24, 2006
    Messages:
    796
    Likes Received:
    5
    Location:
    France
    Thanks a lot for everything man, just how can i find the number for TL=top left, TR=top right,BL=bottom left,BR=bottom left please ?
     
  4. tharoux

    tharoux Level IV

    Joined:
    Dec 30, 2006
    Messages:
    2,733
    Likes Received:
    126
    Location:
    In front of my PC, Montreal
    You have to figure it out. Usually, when you're running a script, you need to place the crosshair onto the windows in witch the flash game is playing... then you'll see in the scar windows, at the bottom left, a set of cord. (top left of the active windows is suppose to be 0,0 and the the bottom right will depends on the size of the windows... Then, you'll need to define where you want the findcolor function to look...

    /=============================\
    |****************************************|
    |***/+++\*******************************|
    |***\+++/*******************************|
    \=============================/

    Let's say this is your windows, top left being 0,0 and bottom right being 400,150
    you want to search between the little window, then the cord will look something like 50,75 (top left) and 100,125 (bottom right)
    so the function will go like this: findcolor(x,y,color,50,75,100,125);

    That's the best I can do to explain without making a shitload of screenie.... hope this help a bit !
     
  5. gaelle

    gaelle Level IV

    Joined:
    Dec 24, 2006
    Messages:
    796
    Likes Received:
    5
    Location:
    France
    Thanks a loooot, that's working now =DDDD thank you so much =DD
     
  6. tharoux

    tharoux Level IV

    Joined:
    Dec 30, 2006
    Messages:
    2,733
    Likes Received:
    126
    Location:
    In front of my PC, Montreal
    I'm glad to hear this !