Results 1 to 6 of 6

Thread: countColorTolerance

  1. #1
    Join Date
    Jan 2012
    Posts
    85
    Mentioned
    0 Post(s)
    Quoted
    40 Post(s)

    Default countColorTolerance

    Can anyone one explain why this procedure never ends because of the countColorTolerance condition?

    Code:
    begin
    repeat
            wellTimer.reset;
            wait(random(100,400));
            actionBar.clickSlot(1);
            wait(random(600,1200));
            conversationBox.selectOption(1);
            wait(random(600,1200));
            wellTimer.start;
            wait(random(1000,2000));
            until
            (countColorTolerance(wellColor, TabBackpack.GetSlotBox(1), wellColorTol) <> wellColor) or (giveUp.getTime > 20000) 
    end
    The idea is that if an item in slot 1 is used, there is no way that the colors in the empty slot can be equal the initial color.

  2. #2
    Join Date
    Dec 2014
    Posts
    383
    Mentioned
    2 Post(s)
    Quoted
    206 Post(s)

    Default

    not sure if thats the actual format you're using, but its missing some semi-colons etc.

    also, the area in slot 1 does have a color, its the blue-ish gray


    Quote Originally Posted by hackingislol133 View Post
    Can anyone one explain why this procedure never ends because of the countColorTolerance condition?
    ...
    The idea is that if an item in slot 1 is used, there is no way that the colors in the empty slot can be equal to anything but 0.

  3. #3
    Join Date
    Jan 2012
    Posts
    85
    Mentioned
    0 Post(s)
    Quoted
    40 Post(s)

    Default

    Quote Originally Posted by theholyone View Post
    not sure if thats the actual format you're using, but its missing some semi-colons etc.

    also, the area in slot 1 does have a color, its the blue-ish gray
    Where are the semi colons that are missing? It compiles just fine. I've used countColorTolerance in another script before and it worked fine.

    The documentation of countColorTolerance searches for color with a level of tolerance in an area. In my case, wellColor is red and an empty inventory slot is blueish. After slot 1 is consumed, the slot will be empty and therefore blueish. countColorTolerance should recognize that there is no count of wellColor in slot 1 and should satisfy the until condition.

  4. #4
    Join Date
    Dec 2014
    Posts
    383
    Mentioned
    2 Post(s)
    Quoted
    206 Post(s)

    Default

    Quote Originally Posted by hackingislol133 View Post
    Where are the semi colons that are missing? It compiles just fine. I've used countColorTolerance in another script before and it worked fine.

    The documentation of countColorTolerance searches for color with a level of tolerance in an area. In my case, wellColor is red and an empty inventory slot is blueish. After slot 1 is consumed, the slot will be empty and therefore blueish. countColorTolerance should recognize that there is no count of wellColor in slot 1 and should satisfy the until condition.
    Ah my bad I thought you were using findcolortolerence, using a similar process with that where if the color doesn't match it returns negative and does something else

    Shouldn't there be semi colons after the until function and end? If I'm ever missing one semicolon my script never runs

  5. #5
    Join Date
    Dec 2013
    Location
    Pitcairn Island
    Posts
    288
    Mentioned
    20 Post(s)
    Quoted
    166 Post(s)

    Default

    countColorTol returns the number of pixels (TPoints) that match your color. Your you are comparing the result (the count) to wellColor, which is some random integer (your colour).

    Anyway, why not just go something like

    repeat
    ...
    until (not tabBackpack.isItemInSlot(1));

  6. #6
    Join Date
    Sep 2014
    Location
    C:\Simba\
    Posts
    565
    Mentioned
    9 Post(s)
    Quoted
    71 Post(s)

    Default

    OP, so what your basically doing is; it waits until the pixel amount of whatever color number you are giving it, lets say that is green. So lets say green's color number is 5432054 (its probably not).

    So what you are now doing is you wait until you find: Five million, 432 thousand and 54 green pixels on your screen. Protip: you won't.
    So instead do something like repeat until CountColorTolerance(green, ....) > 10;

    That will wait until it finds over 10 pixels of green. not over 5 million.

    Or you can ofcourse do what The Simba Pro said
    Last edited by Joopi; 10-24-2015 at 12:10 PM.

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
  •