Results 1 to 20 of 20

Thread: RSPS FullInv+Drop Procedure Help

  1. #1
    Join Date
    Jan 2013
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default RSPS FullInv+Drop Procedure Help

    Hey guys, I'm struggling to create a procedure which will stop woodcutting when my inventory is full, then drop all the logs and continue to Woodcut again.

    At the minute I've created a script which clicks the willow tree, waits 15 seconds and clicks the same, or another tree. (I did this so if the tree has been cut down, it'll click another when 15 seconds has passed, but it will click the same tree again if it hasn't been cut down. If anyone knows a better system to see if a tree has been cut, please share).

    You can also see from the script that I attempted to create a procedure that when a log is placed in the last slot of my inventory, it will move the mouse to it. Unfortunately this isn't working. I tried with both DTM and a Bitmap of the Willow Log, but it doesn't work.

    So if anyone has any suggestions of how I can create a procedure to stop when my Inventory is full, and then drop the logs, it would be appreciated.

    Note - This script is for a private server.





    Code:
    program AutoColor;
    {$i SRL\SRL.simba}
    
    var
    x, y, ChopDown, WillowLog, WillowBit:Integer;
    
    
    
    function TreeColor: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.09, 0.15);
    
      if not (FindColorsTolerance(arP, 4023404, MSX1, MSY1, MSX2, MSY2, 6)) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;
    
      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);
    
      for i := 0 to arL do
      begin
        Result := arC[i];
        Writeln('AutoColor = ' + IntToStr(arC[i]));
        Break;
      end;
    
      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);
    
      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;
    
    
    procedure WillowColor;
    begin
      WriteLn('Test.');
      If FindColorTolerance(x, y, TreeColor, MSX1, MSY1, MSX2, MSY2, 5) then
      begin
        Case random (2) Of
        0: begin
            MMouse(x, y, 3, 3);
            ClickMouse(x, y, 1);
            Wait(15000+random(2000));
           end;
        1: begin
            Mouse(x, y, 3, 3, false);
            If FindBitmapToleranceIn(ChopDown, x, y, MSX1, MSY1, MSX2, MSY2, 5) then
              begin
              Wait(500+random(200));
              Mouse(x, y, 3, 4, true)
              end;
           end;
        end;
      end;
    end;
    
    
    Procedure LastWillow;
    begin
      WriteLn('Test2');
      If FindBitmapToleranceIn(WillowBit, x, y, 696, 434, 729, 460, 15) then
      //If FindDTM(WillowLog, x, y, 695, 433, 736, 460) then
      begin
        Mouse(x, y, 5, 5, False);
        WriteLn('Cut the last Willow.');
      end;
    end;
    
    
    
    begin
    ChopDown := BitmapFromString(115, 6, 'meJzNk1EKwCAIhr1dF9hr9z/GBg' +
            'oif2pGBRMf1G3+9tna09vTXzYiapyqR/VTfrs/SxArkFuROKrvD5a' +
            'DVYseVepJZ9V1v03SZLwRozIEaEQOTHhHUrsFWMqYFsHyYHgiGalS' +
            'j+Ss7rTnmEbjJWBtULyxGtvtRPCBYQ7WHhYgFOMjPYVbvgtPbg52M' +
            '3Z/hCLYzXi/J9iK3F2w4NF5bfA3sHotl+RcAmKnwOqyLNgPQNL5Cg==');
    WillowLog := DTMFromString('mAAEAAHic42FgYPBiYmAIAuJwKA3CIDFHILYFYksgtgJiZyD2BuJnQD1vgPg5ED8E4ltAfBuI7wDxAyB+CpX/CMTvgNjTSQpIMpKASQOkmIxuOgA6PQ78');
    WillowBit := BitmapFromString(14, 8, 'meJyT9w2TR0aB0fJoImAk4xkEkoI' +
            'jbGqwqMStDIjE7VyR1YiYWItbOoKQnSsESTl5gpCrHxBBpXArANoL' +
            'QVBBZARWgKwG5EiwUwkiiNvs0grgTsWjDIgAMq9QJw==');
    
    SetupSRL;
    ClearDebug;
    
    
    repeat
      WillowColor;
      LastWillow;
    until(false);
    FreeBitmap(ChopDown);
    FreeDTM(WillowLog);
    FreeBitmap(WillowBit);
    end.

  2. #2
    Join Date
    Nov 2012
    Posts
    2,351
    Mentioned
    55 Post(s)
    Quoted
    603 Post(s)

    Default

    Have it search your bottom right inventory spot for log colors, then if it is found, find all colors of logs within the main inv and rightclick move mouse down to drop option and click, until (not find log color in inventory),

    Thats the cheapest fatest way to do it

    Obviously you could make your own InvFull function for the rsps, and use DTM's for the logs and stuff if you know how, but thats completely upto you to decide
    Last edited by DannyRS; 01-21-2013 at 04:25 PM.


    Programming is like trying keep a wall of shifting sand up, you fix one thing but somewhere else starts crumbling

  3. #3
    Join Date
    Jan 2013
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Quote Originally Posted by DannyRS View Post
    Have it search your bottom right inventory spot for log colors, then if it is found, find all colors of logs within the main inv and rightclick move mouse down to drop option and click, until (not find log color in inventory),

    Thats the cheapest fatest way to do it

    Obviously you could make your own InvFull function for the rsps, and use DTM's for the logs and stuff if you know how, but thats completely upto you to decide

    I tried to find the last log with a DTM and a Bitmap, but they both went weird.

    I just created a procedure, to find the log color in the last slot, however it doesn't move the mouse to the color.

    Code:
    program new;
    {$i SRL/SRL.Simba}
    var
      x,y:integer;
    
    
    procedure LastInventoryItem;
    begin
      If FindColorTolerance(x, y, 1985621, 699, 438, 724, 454, 10) then
      MoveMouse(x, y);
    end;
    
    
    
    begin
    SetupSRL;
    LastInventoryItem;
    end.

  4. #4
    Join Date
    Nov 2012
    Posts
    2,351
    Mentioned
    55 Post(s)
    Quoted
    603 Post(s)

    Default

    The color must be bad? Is it defo detecting the color? Add a Writeln('Saw The Color'); inside the If statement


    Programming is like trying keep a wall of shifting sand up, you fix one thing but somewhere else starts crumbling

  5. #5
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    Use the DTM editor to check if your colors are good, type in your color and tolerance, then click "show matching colors"

  6. #6
    Join Date
    Jan 2013
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    The colors are good, just checked in the DTM Editor. I added the WriteLn's in, like you suggested. It runs the procedure, but then stops on the 'If Find' statements.

    Code:
    program new;
    {$i SRL/SRL.Simba}
    var
      x,y, WillowLog, DTMWillow:integer;
    
    
    procedure Last;
    begin
      WriteLn('Checking for Color');
      If FindColorTolerance(x, y, 2183257, 693, 435, 731, 461, 10) or
         FindColorTolerance(x, y, 4286835, 693, 435, 731, 461, 10) or
         FindColorTolerance(x, y, 1653828, 693, 435, 731, 461, 10) then
         WriteLn('test');
         Begin
            MoveMouse(x, y);
         end;
    end;
    
    procedure LastWillowBit;
    begin
      WriteLn('Checking Bitmap Willow Log');
      If FindBitmapToleranceIn(WillowLog, x, y, 693, 435, 731, 461, 10) then
      begin
        WriteLn('We Found the willow');
      end;
    end;
    
    
    
    procedure LastDTMWillow;
    begin
      WriteLn('Searching for DTM Willow');
      If FindDTM(DtmWillow, x, y, 693, 435, 731, 461) then
      begin
        WriteLn('We have found the DTM Willow Image');
        Mouse(x, y, 3, 3, False);
      end;
    end;
    
    
    
    begin
    WillowLog:= BitmapFromString(11, 7, 'meJyTdPRwySlzzCwGIvv0AsWQOAQ' +
            'KiAQiGVcfIIKrQZYCIjFzW9uUHBmPQCCCyErauKAgRw+gsRAFBv6h' +
            'VnFpEAOREVAjXAHQIqCBcj6hyAiiQM87EO4MqEvAbgAqgFiBrADqF' +
            '5gCAEjOQWA=');
    DtmWillow:= DTMFromString('mggAAAHicY2NgYJjHxMCwHIgXAvFUIJ4IxLOBmIuRgYEPiFmAmA2IeYFYAIh9XGUY4kIUGSIDFBlyUmwZijMdwWxcgBEHhgAAJ50JQw==');
    
    SetupSRL;
    LastDTMWillow;
    //Last;
    //LastWillowBit
    FreeBitmap(WillowLog);
    FreeDTM(DtmWillow);
    end.

    You can see I've just tried with DTM/Bitmap/Colors. I also changed the DTM's last Inventory Co-ordinates to MSX1, MSY1, MSX2, MSY2, and it still didn't run it.

  7. #7
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    Maybe try using MMouse. I wouldn't make a difference, but maybe MoveMouse is having issues

  8. #8
    Join Date
    Nov 2012
    Posts
    2,351
    Mentioned
    55 Post(s)
    Quoted
    603 Post(s)

    Default

    what does this output

    Simba Code:
    Procedure Last;
    Begin
      WriteLn('Checking for Color');
      If FindColorTolerance(x, y, 2183257, 693, 435, 731, 461, 10) Or
         FindColorTolerance(x, y, 4286835, 693, 435, 731, 461, 10) Or
         FindColorTolerance(x, y, 1653828, 693, 435, 731, 461, 10) Then
         Begin
            WriteLn('Saw Log Color');
         End;
    End;
    Last edited by DannyRS; 01-21-2013 at 06:20 PM.


    Programming is like trying keep a wall of shifting sand up, you fix one thing but somewhere else starts crumbling

  9. #9
    Join Date
    Jan 2013
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Quote Originally Posted by DannyRS View Post
    what does this output

    Simba Code:
    Procedure Last;
    Begin
      WriteLn('Checking for Color');
      If FindColorTolerance(x, y, 2183257, 693, 435, 731, 461, 10) Or
         FindColorTolerance(x, y, 4286835, 693, 435, 731, 461, 10) Or
         FindColorTolerance(x, y, 1653828, 693, 435, 731, 461, 10) Then
         Begin
            WriteLn('Saw Log Color');
         End;
    End;
    As in what comes up in the Debug? If so Only "Checking for Color" appears. The script pretty much doesnt read anything past an 'If' statement.

  10. #10
    Join Date
    Nov 2012
    Posts
    2,351
    Mentioned
    55 Post(s)
    Quoted
    603 Post(s)

    Default

    Quote Originally Posted by Dynam0 View Post
    As in what comes up in the Debug? If so Only "Checking for Color" appears. The script pretty much doesnt read anything past an 'If' statement.
    The colors or co-ordinates are wrong then

    FindColorTolerance(x, y, 1653828, 693, 435, 731, 461, 10)

    Last edited by DannyRS; 01-22-2013 at 12:37 AM.


    Programming is like trying keep a wall of shifting sand up, you fix one thing but somewhere else starts crumbling

  11. #11
    Join Date
    Jan 2013
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Quote Originally Posted by DannyRS View Post
    The colors or co-ordinates are wrong then

    FindColorTolerance(x, y, 1653828, 693, 435, 731, 461, 10)

    I've redone the Co ordinates several times, I've also made sure the color was correct. I changed the Co ordinates to "MIX1, MIY1, MIX2, MIY2", which as you know are the co ordinates for the whole Inventory, which appears to work. It's a bit weird, but I guess i'll have to use MIX1, MIY1, MIX2, MIY2 from now on.



    Update;

    I scripted the procedure from scratch, this time it has worked.

    The code below will search for the willow log's color in the last inventory spot. If it is there it will drop all the logs in the inventory. Now my only problem is getting it to stop, if it doesn't find the last willow log in the last inventory spot. What it will do at the minute is continue to search for the last willow log, and spam my debug with "Searching for Last Willow Log". Do you know if it's possible to create an 'If Not FindColorTolerance', so that if it doesn't find the last willow log, it won't do anything? Thanks.







    Code:
    program new;
    {$i SRL/SRL.Simba}
    var
      x, y, DropWillowLog:Integer;
    
    procedure FindLastWillowLog;
    begin
      WriteLn('Searching For Color');
      If FindColorTolerance(x, y, 4155249, 689, 431, 733, 462, 15) or
         FindColorTolerance(x, y, 1919571, 689, 431, 733, 462, 15) or
         FindColorTolerance(x, y, 2051671, 689, 431, 733, 462, 15) then
      begin
        If FindColorTolerance(x, y, 4155249, MIX1, MIY1, MIX2, MIY2, 15) or
           FindColorTolerance(x, y, 1919571, MIX1, MIY1, MIX2, MIY2, 15) or
           FindColorTolerance(x, y, 2051671, MIX1, MIY1, MIX2, MIY2, 15) then
            begin
              Mouse(x, y, 5, 5, false);
              If FindBitmapToleranceIn(DropWillowLog, x, y, MIX1, MIY1, MIX2, MIY2, 10) then
                begin
                  Mouse(x, y, 3, 3, true);
                  Wait(500+Random(200));
                  WriteLn('We found the color');
                end;
            end;
      end;
    end;
    begin
    DropWillowLog := BitmapFromString(70, 8, 'meJzdVEkOgCAM9Gne+gGu/MkfA6F' +
            'JU7sJkRi1mcMo02WAACmXHlsP5JCywH6UhibQhFaF0uOUq/X6Uw9w' +
            'WQqYI8FnHd3kOMyUI5O/xJHAA47M1njuqxzRLq1yREFzxqa4bKRdn' +
            'M43xxxgvBScX4bADsKT8T8ej9NN7rUISsU37aP4jSO8hBVccmtn');
    ClearDebug;
    SetupSRL;
    repeat
    FindLastWillowLog;
    until(false);
    FreeBitmap(DropWillowLog);
    Last edited by Dynam0; 01-22-2013 at 09:45 AM.

  12. #12
    Join Date
    Nov 2012
    Posts
    2,351
    Mentioned
    55 Post(s)
    Quoted
    603 Post(s)

    Default

    Yes you can do If (Not FindColorTolerance(0,0,0,0,0,0)) Then


    Programming is like trying keep a wall of shifting sand up, you fix one thing but somewhere else starts crumbling

  13. #13
    Join Date
    Jan 2013
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Quote Originally Posted by DannyRS View Post
    Yes you can do If (Not FindColorTolerance(0,0,0,0,0,0)) Then
    Thanks. It is pretty much done, the only problem I'm having now, is making it work like this; Starting cutting Willow logs, If the inventory gets full, empty it all, once empty, start over. Do you know if it is possible to do** At the minute It clicks a tree, drops a log, and repeats. If I want it to keep woodcutting, I have to add wait timers. Hope you understand. Thanks.





    Code:
    program AutoColor;
    {$i SRL\SRL.simba}
    
    var
    x, y, ChopDown, DropWillowLog:Integer;
    
    
    
    function TreeColor: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.09, 0.15);
    
      if not (FindColorsTolerance(arP, 4023404, MSX1, MSY1, MSX2, MSY2, 6)) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;
    
      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);
    
      for i := 0 to arL do
      begin
        Result := arC[i];
        Writeln('AutoColor = ' + IntToStr(arC[i]));
        Break;
      end;
    
      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);
    
      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;
    
    
    procedure WillowColor;
    begin
      WriteLn('Seaching for the willow');
      If FindColorTolerance(x, y, TreeColor, MSX1, MSY1, MSX2, MSY2, 5) then
      begin
        Case random (2) Of
        0: begin
            MMouse(x, y, 3, 3);
            ClickMouse(x, y, 1);
            Wait(5000+random(1000));
           end;
        1: begin
            Mouse(x, y, 3, 3, false);
            If FindBitmapToleranceIn(ChopDown, x, y, MSX1, MSY1, MSX2, MSY2, 5) then
              begin
              Wait(500+random(200));
              Mouse(x, y, 3, 4, true)
              end;
           end;
        end;
      end;
    end;
    
    
    procedure FindLastWillowLog;
    begin
      WriteLn('Searching For Color');
      If FindColorTolerance(x, y, 4155249, 689, 431, 733, 462, 15) or
         FindColorTolerance(x, y, 1919571, 689, 431, 733, 462, 15) or
         FindColorTolerance(x, y, 2051671, 689, 431, 733, 462, 15) then
      begin
        If FindColorTolerance(x, y, 4155249, MIX1, MIY1, MIX2, MIY2, 15) or
           FindColorTolerance(x, y, 1919571, MIX1, MIY1, MIX2, MIY2, 15) or
           FindColorTolerance(x, y, 2051671, MIX1, MIY1, MIX2, MIY2, 15) then
            begin
              Mouse(x, y, 5, 5, false);
              If FindBitmapToleranceIn(DropWillowLog, x, y, MIX1, MIY1, MIX2, MIY2, 10) then
                begin
                  Mouse(x, y, 3, 3, true);
                  Wait(500+Random(200));
                  WriteLn('We found the color');
                end;
            end;
      end;
    end;
    
    
    procedure NoWillowLogInLastSpot;
    begin
        If (Not FindColorTolerance(x, y, 4155249, 689, 431, 733, 462, 15)) or
           (Not FindColorTolerance(x, y, 1919571, 689, 431, 733, 462, 15)) or
           (Not FindColorTolerance(x, y, 2051671, 689, 431, 733, 462, 15)) then
            begin
              WriteLn('There is no log in the last inventory slot, we will keep cutting');
            end;
    end;
    
    
    
    
    begin
    DropWillowLog := BitmapFromString(70, 8, 'meJzdVEkOgCAM9Gne+gGu/MkfA6F' +
            'JU7sJkRi1mcMo02WAACmXHlsP5JCywH6UhibQhFaF0uOUq/X6Uw9w' +
            'WQqYI8FnHd3kOMyUI5O/xJHAA47M1njuqxzRLq1yREFzxqa4bKRdn' +
            'M43xxxgvBScX4bADsKT8T8ej9NN7rUISsU37aP4jSO8hBVccmtn');
    ChopDown := BitmapFromString(115, 6, 'meJzNk1EKwCAIhr1dF9hr9z/GBg' +
            'oif2pGBRMf1G3+9tna09vTXzYiapyqR/VTfrs/SxArkFuROKrvD5a' +
            'DVYseVepJZ9V1v03SZLwRozIEaEQOTHhHUrsFWMqYFsHyYHgiGalS' +
            'j+Ss7rTnmEbjJWBtULyxGtvtRPCBYQ7WHhYgFOMjPYVbvgtPbg52M' +
            '3Z/hCLYzXi/J9iK3F2w4NF5bfA3sHotl+RcAmKnwOqyLNgPQNL5Cg==');
    
    
    
    SetupSRL;
    ClearDebug;
    repeat
    WillowColor;
    FindLastWillowLog;
    NoWillowLogInLastSpot
    until(false);
    FreeBitmap(ChopDown);
    FreeBitmap(DropWillowLog);
    end.

  14. #14
    Join Date
    Sep 2008
    Posts
    20
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    my idea has been to search for the period at the end of the line telling you that the tree ran out of logs. if you have chat on hide, this message is the longest recieved while woodcutting.
    You could set it to continue cutting until it notices the black color of the period in a box where the 'tree out of logs' message appears. Then make it search for a new tree.


    after clicking your tree you could simply add a function like this 'wait(5000+RandomRange(1,10000)); ' to let you cut the tree for a while, while still being random.
    if you are in an area of clustered trees the wait time can be short, as long as you dont move much if you click another tree early and waste time walking

  15. #15
    Join Date
    Dec 2012
    Posts
    86
    Mentioned
    0 Post(s)
    Quoted
    18 Post(s)

    Default

    Quote Originally Posted by Dynam0 View Post
    Thanks. It is pretty much done, the only problem I'm having now, is making it work like this; Starting cutting Willow logs, If the inventory gets full, empty it all, once empty, start over. Do you know if it is possible to do** At the minute It clicks a tree, drops a log, and repeats. If I want it to keep woodcutting, I have to add wait timers. Hope you understand. Thanks.





    Code:
    program AutoColor;
    {$i SRL\SRL.simba}
    
    var
    x, y, ChopDown, DropWillowLog:Integer;
    
    
    
    function TreeColor: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.09, 0.15);
    
      if not (FindColorsTolerance(arP, 4023404, MSX1, MSY1, MSX2, MSY2, 6)) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;
    
      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);
    
      for i := 0 to arL do
      begin
        Result := arC[i];
        Writeln('AutoColor = ' + IntToStr(arC[i]));
        Break;
      end;
    
      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);
    
      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;
    
    
    procedure WillowColor;
    begin
      WriteLn('Seaching for the willow');
      If FindColorTolerance(x, y, TreeColor, MSX1, MSY1, MSX2, MSY2, 5) then
      begin
        Case random (2) Of
        0: begin
            MMouse(x, y, 3, 3);
            ClickMouse(x, y, 1);
            Wait(5000+random(1000));
           end;
        1: begin
            Mouse(x, y, 3, 3, false);
            If FindBitmapToleranceIn(ChopDown, x, y, MSX1, MSY1, MSX2, MSY2, 5) then
              begin
              Wait(500+random(200));
              Mouse(x, y, 3, 4, true)
              end;
           end;
        end;
      end;
    end;
    
    
    procedure FindLastWillowLog;
    begin
      WriteLn('Searching For Color');
      If FindColorTolerance(x, y, 4155249, 689, 431, 733, 462, 15) or
         FindColorTolerance(x, y, 1919571, 689, 431, 733, 462, 15) or
         FindColorTolerance(x, y, 2051671, 689, 431, 733, 462, 15) then
      begin
        If FindColorTolerance(x, y, 4155249, MIX1, MIY1, MIX2, MIY2, 15) or
           FindColorTolerance(x, y, 1919571, MIX1, MIY1, MIX2, MIY2, 15) or
           FindColorTolerance(x, y, 2051671, MIX1, MIY1, MIX2, MIY2, 15) then
            begin
              Mouse(x, y, 5, 5, false);
              If FindBitmapToleranceIn(DropWillowLog, x, y, MIX1, MIY1, MIX2, MIY2, 10) then
                begin
                  Mouse(x, y, 3, 3, true);
                  Wait(500+Random(200));
                  WriteLn('We found the color');
                end;
            end;
      end;
    end;
    
    
    procedure NoWillowLogInLastSpot;
    begin
        If (Not FindColorTolerance(x, y, 4155249, 689, 431, 733, 462, 15)) or
           (Not FindColorTolerance(x, y, 1919571, 689, 431, 733, 462, 15)) or
           (Not FindColorTolerance(x, y, 2051671, 689, 431, 733, 462, 15)) then
            begin
              WriteLn('There is no log in the last inventory slot, we will keep cutting');
            end;
    end;
    
    
    
    
    begin
    DropWillowLog := BitmapFromString(70, 8, 'meJzdVEkOgCAM9Gne+gGu/MkfA6F' +
            'JU7sJkRi1mcMo02WAACmXHlsP5JCywH6UhibQhFaF0uOUq/X6Uw9w' +
            'WQqYI8FnHd3kOMyUI5O/xJHAA47M1njuqxzRLq1yREFzxqa4bKRdn' +
            'M43xxxgvBScX4bADsKT8T8ej9NN7rUISsU37aP4jSO8hBVccmtn');
    ChopDown := BitmapFromString(115, 6, 'meJzNk1EKwCAIhr1dF9hr9z/GBg' +
            'oif2pGBRMf1G3+9tna09vTXzYiapyqR/VTfrs/SxArkFuROKrvD5a' +
            'DVYseVepJZ9V1v03SZLwRozIEaEQOTHhHUrsFWMqYFsHyYHgiGalS' +
            'j+Ss7rTnmEbjJWBtULyxGtvtRPCBYQ7WHhYgFOMjPYVbvgtPbg52M' +
            '3Z/hCLYzXi/J9iK3F2w4NF5bfA3sHotl+RcAmKnwOqyLNgPQNL5Cg==');
    
    
    
    SetupSRL;
    ClearDebug;
    repeat
    WillowColor;
    FindLastWillowLog;
    NoWillowLogInLastSpot
    until(false);
    FreeBitmap(ChopDown);
    FreeBitmap(DropWillowLog);
    end.
    make a DropAllInventory procedure. make sure it begins with if FindDTM() so DropAllInventory will keep repeating until it doesn't find a log in the inventory.

  16. #16
    Join Date
    Jan 2013
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Quote Originally Posted by johnlukey View Post
    my idea has been to search for the period at the end of the line telling you that the tree ran out of logs. if you have chat on hide, this message is the longest recieved while woodcutting.
    You could set it to continue cutting until it notices the black color of the period in a box where the 'tree out of logs' message appears. Then make it search for a new tree.
    I tried to do something like this, however it didn't work. I'll try and rescript it as a last resort, thanks for the help .


    Quote Originally Posted by johnlukey View Post
    after clicking your tree you could simply add a function like this 'wait(5000+RandomRange(1,10000)); ' to let you cut the tree for a while, while still being random.
    if you are in an area of clustered trees the wait time can be short, as long as you dont move much if you click another tree early and waste time walking
    That's what I'm currently doing, I'm adding wait timers so it allows time for my player to cut the trees.


    Quote Originally Posted by doxin View Post
    make a DropAllInventory procedure. make sure it begins with if FindDTM() so DropAllInventory will keep repeating until it doesn't find a log in the inventory.
    I created this quickly, it searches for the logs in the inventory through DTMs

    Code:
    program new;
    {$i SRL/SRL.Simba}
    var
      x, y, WillowLog, DropWillow:integer;
    
    
    procedure FindWillowLog;
    begin
      If FindDTM(WillowLog, x, y, MIX1, MIY1, MIX2, MIY2) then
      begin
        Mouse(x, y, 3, 3, false);
        If FindBitmapToleranceIn(DropWillow, x, y, MIX1, MIY1, MIX2, MIY2, 10) then
        begin
          Mouse(x, y, 3, 3, true);
        end;
      end;
    end;
    
    
    
    
    begin
    SetupSRL;
    DropWillow := BitmapFromString(70, 8, 'meJzdVEkOgCAM9Gne+gGu/MkfA6F' +
            'JU7sJkRi1mcMo02WAACmXHlsP5JCywH6UhibQhFaF0uOUq/X6Uw9w' +
            'WQqYI8FnHd3kOMyUI5O/xJHAA47M1njuqxzRLq1yREFzxqa4bKRdn' +
            'M43xxxgvBScX4bADsKT8T8ej9NN7rUISsU37aP4jSO8hBVccmtn');
    WillowLog := DTMFromString('m6wAAAHic42ZgYOADYmkgFgViLgYIYAFidiAWBmJJqLwcEHMAsRBUXByIBYGYFYiZoPqYgZgTamZkgCKQZCQSEw+INRHNVABmGAIZ');
    FindWillowLog;
    FreeDTM(WillowLog);
    end.

    I'm trying to set something up so it's like;

    begin
    repeat
    FindWillowTree;
    until(LastWillowInInventory);
    repeat
    DropWillowLogs
    until(InventoryEmpty);
    end.

    and get that to loop. But the only thing I can do if I want to repeat my loop is repeat until(false);.

  17. #17
    Join Date
    Dec 2012
    Posts
    86
    Mentioned
    0 Post(s)
    Quoted
    18 Post(s)

    Default

    So you want to do this?
    Simba Code:
    begin
    repeat
       begin
       repeat
          FindWillowTree;
       until(LastWillowInInventory);
       repeat
          DropWillowLogs
       until(InventoryEmpty);
    until (false)
    end.

    and why don't you want it to loop until(false)? i would think you would like the script to keep repeating until you stopped it.

  18. #18
    Join Date
    Jan 2013
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Quote Originally Posted by doxin View Post
    So you want to do this?
    Simba Code:
    begin
    repeat
       begin
       repeat
          FindWillowTree;
       until(LastWillowInInventory);
       repeat
          DropWillowLogs
       until(InventoryEmpty);
    until (false)
    end.

    and why don't you want it to loop until(false)? i would think you would like the script to keep repeating until you stopped it.

    Is that possible? I didn't think it was so i never tried it. Also I forgot to add in until(false);.

  19. #19
    Join Date
    Jul 2012
    Posts
    279
    Mentioned
    5 Post(s)
    Quoted
    46 Post(s)

    Default

    Quote Originally Posted by Dynam0 View Post
    Is that possible? I didn't think it was so i never tried it. Also I forgot to add in until(false);.
    It is. It's horribly formatted with too many begin, but that'd be a way around your problem. That being said, personally I'd put the loop to drop all logs in the DropWillowLogs function itself for better understandability. I also strongly suggest to add a condition when to end the script. Simply "until false" could end up looking extremely botlike if anything goes wrong. See the end of the loop as a failsafe (on top of the failsafes you get to put in the core of the script).

  20. #20
    Join Date
    Dec 2012
    Posts
    86
    Mentioned
    0 Post(s)
    Quoted
    18 Post(s)

    Default

    Quote Originally Posted by Wardancer View Post
    It is. It's horribly formatted with too many begin, but that'd be a way around your problem. That being said, personally I'd put the loop to drop all logs in the DropWillowLogs function itself for better understandability. I also strongly suggest to add a condition when to end the script. Simply "until false" could end up looking extremely botlike if anything goes wrong. See the end of the loop as a failsafe (on top of the failsafes you get to put in the core of the script).
    all he needs is a couple of failsafes and some antirandoms

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
  •