Results 1 to 10 of 10

Thread: [Help] Doing something wrong I assume.

  1. #1
    Join Date
    Nov 2010
    Posts
    305
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default [Help] Doing something wrong I assume.

    Hello there, I'm going to Script (atleast trying) with SCAR and to train, I do it on Private Servers. Though I have a problem, and I don't know how to solve.

    Code:
    program New;
    
    var x,y:Integer;
    
    
    const
    TreeColor = 4819072;
    TreeColor1 = 2848872;
    TreeColor2 = 2719856;
    LogColor = 2051414;
    LoginScreen = 1810659;
    BrokenTree = 3759718;
    
    
    
    
    function Login : boolean; //Boolean because it results true or false;
    begin
    result := false;
    If FindColor(x, y, LoginScreen, 677, 464, 677, 464)
    then result := true
    end;
    
    
    function WoodCutter : boolean;
    begin
    result := false;
    If FindColorTolerance(x, y, TreeColor, 200, 74, 251, 124, 2) or
       FindColorTolerance(x, y, TreeColor1, 200, 74, 251, 124, 2) or
       FindColorTolerance(x, y, TreeColor2, 200, 74, 251, 124, 2)
       then result := true
    end;
    
    function TreeStump : boolean;
    begin
    result := false;
    If FindColorTolerance(x, y, BrokenTree, 257, 140, 257, 140, 1)
    then result := true
    end;
    
    
    Begin
    Repeat
    //Login Check
    If (Login = True) then
    begin
    SendKeys(Chr(13));
    Wait(10000);
    end;
    
    
    //Getting logs
    If (WoodCutter = True) then
    Begin
    Repeat
    MoveMouse(x, y);
    Wait(100);
    ClickMouse(x, y, True);
    Wait(20000);
    Until FindColorTolerance(x, y, LogColor, 706, 405, 706, 405, 5)
    end;
    
    If (TreeStump = True) then
    Begin
    Wait(10000);
    end;
    
    //Dropping
    If FindColor(x, y, 2051414, 562, 241, 733, 420) then
    begin
    Repeat
    MoveMouse(x, y);
    Wait(20);
    ClickMouse(x, y, False);
    Wait(20);
    MoveMouse(x, y+40);
    Wait(20);
    ClickMouse(x, y+40, True);
    Until FindColor(x, y, 3226435, 706, 405, 706, 405)
    end;
    
    
    
    Until False;
    end.
    The inventory is full with logs, and it should drop but it doesn't, anyone knows what's wrong?

  2. #2
    Join Date
    Apr 2007
    Location
    Lithuania
    Posts
    384
    Mentioned
    0 Post(s)
    Quoted
    15 Post(s)

    Default

    Did you make it to click "drop" option when menu pops up? I don't see it.

  3. #3
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Simba Code:
    If FindColor(x, y, 2051414, 562, 241, 733, 420) then
    begin
    Repeat
    MoveMouse(x, y);

    At that part, change it to

    Simba Code:
    If FindColor(x, y, 2051414, 562, 241, 733, 420) then
    begin
    Writeln('Found Logs')
    Repeat
    MoveMouse(x, y);

    Assuming that findcolor finds logs, so that way we know if the script is at least finding the logs at all.

  4. #4
    Join Date
    Nov 2010
    Posts
    305
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Quote Originally Posted by YoHoJo View Post
    Simba Code:
    If FindColor(x, y, 2051414, 562, 241, 733, 420) then
    begin
    Repeat
    MoveMouse(x, y);

    At that part, change it to

    Simba Code:
    If FindColor(x, y, 2051414, 562, 241, 733, 420) then
    begin
    Writeln('Found Logs')
    Repeat
    MoveMouse(x, y);

    Assuming that findcolor finds logs, so that way we know if the script is at least finding the logs at all.
    Tried that, it doesn't give me that message somehow it's skipping that part, and I have no clue why... Anyone knows?

  5. #5
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    The reason is obvious! It's not finding the color!
    So either the color is wrong/needs tolerance (not sure if colors on that private server change or not), or the search box is wrong.

  6. #6
    Join Date
    Nov 2010
    Posts
    305
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Quote Originally Posted by YoHoJo View Post
    The reason is obvious! It's not finding the color!
    So either the color is wrong/needs tolerance (not sure if colors on that private server change or not), or the search box is wrong.
    Not obvious, they're correct it seems

    Code:
    //Getting logs
    If (WoodCutter = True) then
    Begin
    Repeat
    MoveMouse(x, y);
    Wait(100);
    ClickMouse(x, y, True);
    Wait(20000);
    Until FindColor(x, y, LogColor, 695, 391, 729, 422) or
          FindColor(x, y, LogColor1, 695, 391, 729, 422)
    end;
    Keeps repeating itself, even though there is a log there?
    Oke... I did something, now it detects the logs, but it only drops the first one and keeps repeating at the same spot.


    Quote Originally Posted by bevardis View Post
    Did you make it to click "drop" option when menu pops up? I don't see it.
    Would that be possible on a Private Server Client?
    Last edited by Failure; 11-21-2011 at 06:20 AM.

  7. #7
    Join Date
    Mar 2007
    Location
    USA
    Posts
    1,433
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Failure View Post
    Not obvious, they're correct it seems

    Code:
    //Getting logs
    If (WoodCutter = True) then
    Begin
    Repeat
    MoveMouse(x, y);
    Wait(100);
    ClickMouse(x, y, True);
    Wait(20000);
    Until FindColor(x, y, LogColor, 695, 391, 729, 422) or
          FindColor(x, y, LogColor1, 695, 391, 729, 422)
    end;
    Keeps repeating itself, even though there is a log there?
    Oke... I did something, now it detects the logs, but it only drops the first one and keeps repeating at the same spot.




    Would that be possible on a Private Server Client?
    The way your loop is written, it would keep repeating it until it found it. So it would make sense that it kept repeating. As for why it only drops one, your loop probably doesn't update the x,y cords, meaning it doesn't look for the color again and is just repeating the function at that spot.
    I'm Silent SPY
    Secret project: 0%
    Need help? Send me a PM

  8. #8
    Join Date
    Nov 2010
    Posts
    305
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Quote Originally Posted by Silent SPY View Post
    The way your loop is written, it would keep repeating it until it found it. So it would make sense that it kept repeating. As for why it only drops one, your loop probably doesn't update the x,y cords, meaning it doesn't look for the color again and is just repeating the function at that spot.
    Code:
    //Getting logs
    If (WoodCutter = True) then
    Begin
    Repeat
    MoveMouse(x, y);
    Wait(100);
    ClickMouse(x, y, True);
    Wait(20000);
    Until FindColor(x, y, LogColor, 695, 391, 729, 422) or
          FindColor(x, y, LogColor1, 695, 391, 729, 422)
    end;
    It wouldn't make sense, since I told it to stop at the 20th spot with cutting logs after that, it should drops them

    Code:
    function FullInventory : boolean; //Boolean because it results true or false;
    begin
    result := false;
    If FindColor(x, y, LogColor, 557, 243, 729, 422) or
       FindColor(x, y, LogColor1, 557, 243, 729, 422)
    then result := true
    end;
    
    
    
    
    //Dropping
    If (FullInventory = True)
    then
    begin
    Writeln('Found Logs')
    Repeat
    MoveMouse(x, y);
    Wait(20);
    ClickMouse(x, y, False);
    Wait(20);
    MoveMouse(x, y+40);
    Wait(20);
    ClickMouse(x, y+40, True);
    Until FindColor(x, y, 3423816, 713, 405, 713, 405)
    end;
    From the first to the 20th spot it should find the LogColor(s), and drop them until it finds the Inventory color (If no log is on that spot for now, the 20th spot) but it keeps dropping the first one, even though it's dropped.

  9. #9
    Join Date
    Jun 2007
    Location
    La Mirada, CA
    Posts
    2,484
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    It usually isn't good to have a repeat loops condition be a findcolor, it could potentially get stuck in an infinite loop pretty easily. A usually practice is to have an if statement and then have it repeat checking an 'x' amount of times and then stop after that amount of checks....so like...

    Code:
    Repeat
    If FindColor(...) then
    ...
    A=A+1;
    Until (A > 10);
    or something to that effect.

    "Failure is the opportunity to begin again more intelligently" (Henry Ford)


  10. #10
    Join Date
    Nov 2010
    Posts
    305
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Somehow I managed to get it to work!

    Code:
    //Dropping
    If (FullInventory = True)
    then
    begin
    Writeln('Found Logs')
    Repeat
    If FindColorTolerance(x, y, LogColor, 564, 242, 735, 422, 1) or
    FindColorTolerance(x, y, LogColor1, 564, 242, 735, 422, 1) then
    MoveMouse(x, y);
    Wait(20);
    ClickMouse(x, y, False);
    Wait(20);
    MoveMouse(x, y+40);
    Wait(20);
    ClickMouse(x, y+40, True);
    Until FindColor(x, y, Inventory, 707, 405, 715, 411) or
          FindColor(x, y, Inventory1, 707, 405, 715, 411)
    end;
    I changed the Log colors to something more specific and it worked.
    (Willow Logs)

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
  •