Page 2 of 4 FirstFirst 1234 LastLast
Results 16 to 30 of 46
  1. #16
    why06jz's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Posts
    295
    Reputation
    14
    Thanks
    54
    Just a guess, but it's probably because your compare r_pixel_one to itself =/
    Quote Originally Posted by exert from ur code
    r_pixel_one > r_pixel_one -20

  2. #17
    258456's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    ghjghj
    Posts
    1,222
    Reputation
    18
    Thanks
    300
    My Mood
    Relaxed
    Oh ok, well how can i fix it then.

  3. #18
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty
    Quote Originally Posted by 258456 View Post
    Oh ok, well how can i fix it then.
    Compare it to the pixel you want to test. So your comparing the pixel your testing to tree or background. You don understand if you compare a r_pixel_one to itself it will always be greater then itself -20.

    That's like saying 10 > 10 -20. It will be always true and accomplishes nothing. What you want is something like this:
    (|x - y| <= 20)

    see now if x is 20 and y is 40, 20 - 40 = -20, then we take the abs value and its 20, which is <= 20.

    if both x & y are unsigned chars you don't even have to worry about abs value assuming you always subtract the smaller from the larger, otherwise you'll loop back around.

    And might I ask what exactly your trying to do, because there's got to be an easier way...

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  4. The Following User Says Thank You to why06 For This Useful Post:

    258456 (02-14-2011)

  5. #19
    258456's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    ghjghj
    Posts
    1,222
    Reputation
    18
    Thanks
    300
    My Mood
    Relaxed
    OMG, thanks so much why06, your post helped so much that i started cracking up at how stupid my logic was. It's so obvious now that you explained it. If i could thank you multiple times i would. Thanks.

    I am working on a runescape bot and this new feature will detect if i am cutting wood from the yew tree or if i got pulled into some random event in which both colors will change dramatically. Once my bot detects that it is in a random event, it will text me and then it will close itself. I wish there was an easier and more reliable way than using colors because it's really unreliable but it will work in my situation i guess.


    Can i also do it like this:

    Code:
     int r = r_pixel_one-20;
    // then do the if statement...
    RGB(r_pixel_one >= r .......and so on
    would that work or am i just doing the same thing?
    Last edited by 258456; 02-14-2011 at 09:47 PM.

  6. #20
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty
    Quote Originally Posted by 258456 View Post
    OMG, thanks so much why06, your post helped so much that i started cracking up at how stupid my logic was. It's so obvious now that you explained it. If i could thank you multiple times i would. Thanks.
    np. happens to everyone, and myself plenty of times. It's often easier for others to see obvious things you might have missed, and then ur feel like a dumbass >_>, but life goes on...



    Can i also do it like this:

    Code:
     int r = r_pixel_one;
    // then do the if statement...
    RGB(r_pixel_one >= r - 20.......and so on
    would that work or am i just doing the same thing?
    Nope.

    Once they are equal
    Code:
     int r = r_pixel_one;
    The same problem comes up...

    Code:
    RGB(r_pixel_one >= r - 20

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  7. #21
    258456's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    ghjghj
    Posts
    1,222
    Reputation
    18
    Thanks
    300
    My Mood
    Relaxed
    Oh ya huh, lol there's the stupidity again. How can I fix it, I m puzzled cuz I can't really put any number values because they are always different
    Last edited by 258456; 02-14-2011 at 10:04 PM.

  8. #22
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty
    Quote Originally Posted by 258456 View Post
    So u r saying it's ok or it's just the same problem with different code?
    same problem with different code. you've gotta stop making the two things equal before you test it.

    x = 10
    10 > x - 20
    is the same problem as...

    10 > 10 - 20 see?

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  9. The Following User Says Thank You to why06 For This Useful Post:

    258456 (02-15-2011)

  10. #23
    258456's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    ghjghj
    Posts
    1,222
    Reputation
    18
    Thanks
    300
    My Mood
    Relaxed
    Ya I see what u r saying idk y I just posted that, lol it's really late at night where I m as u can tell, lol. Do u have any suggestions on how to solve this problem. Btw thanks for being such a great help.


    The only idea coming to my mind right now is this:

    Code:
     tree= RGB(r_pixel_one || r_pixel_one +1 || r_pixel_one+2 ... and so on)
    Sorry that I can't really test anything since I m on the itouch lol. Thanks so much for your help I know I say it a lot but your help really means a lot to me.
    Last edited by 258456; 02-14-2011 at 10:18 PM.

  11. #24
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    No, doesn't work like that o_O
    Ah we-a blaze the fyah, make it bun dem!

  12. The Following User Says Thank You to Hell_Demon For This Useful Post:

    258456 (02-15-2011)

  13. #25
    258456's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    ghjghj
    Posts
    1,222
    Reputation
    18
    Thanks
    300
    My Mood
    Relaxed
    Ya I kinda figured it wouldn't be that easy. Any suggestions?

  14. #26
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty
    Quote Originally Posted by 258456 View Post
    Ya I kinda figured it wouldn't be that easy. Any suggestions?
    Post the r_pixel for the tree and the r_pixel you detected off the screen and the r pixel for the background and I can give you an answer.

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  15. The Following User Says Thank You to why06 For This Useful Post:

    258456 (02-15-2011)

  16. #27
    258456's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    ghjghj
    Posts
    1,222
    Reputation
    18
    Thanks
    300
    My Mood
    Relaxed
    Well, the problem isn't that i don't know what to do with the number (value of r_pixel), the problem is that if i want to do something else i will press the numpad 1 and then it will detect the pixel which will be another number. The r pixel is usually about 5-6.




    EDIT: WHOAAAAAA!!!!! i think i just made a breakthrough, can i do this:

    Code:
     r_pixel_one = GetRValue(pixel2);
             int r = GetRValue(pixel2);
     COLORREF tree = RGB(r_pixel_one >= r -20...........and so on.);

    Wouldn't this work?
    Last edited by 258456; 02-15-2011 at 08:24 AM.

  17. #28
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    Quote Originally Posted by 258456 View Post
    Code:
    COLORREF tree = RGB(r_pixel_one >= r -20...........and so on.);

    Wouldn't this work?
    No =3
    Ah we-a blaze the fyah, make it bun dem!

  18. #29
    258456's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    ghjghj
    Posts
    1,222
    Reputation
    18
    Thanks
    300
    My Mood
    Relaxed
    HOW DO I DO THIS HD. My brain is going to explode. I am pretty sure you knew the answer from the beginning.

  19. #30
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    If you want to check if COLORREF pixel2 is between for example RGB(200, 150, 100) and RGB(225, 125, 200) you'd use the following code:
    Code:
    char r = ((char*)pixel2)[0]; //or GetRValue(pixel2)
    char g = ((char*)pixel2)[1]; //GetGValue(pixel2)
    char b = ((char*)pixel2)[2]; //GetBValue(pixel2)
    
    if( (r >= 200 && r <= 225) &&//Red is ok
        (g <= 150 && g >= 125) &&//Green is ok
        (b >= 100 && b <= 200) )//B is also ok
    {
        //all are ok
        ...more code here...
    }
    if it's not that what you're trying to do please rephrase it =3
    Ah we-a blaze the fyah, make it bun dem!

  20. The Following User Says Thank You to Hell_Demon For This Useful Post:

    258456 (02-15-2011)

Page 2 of 4 FirstFirst 1234 LastLast