Results 1 to 6 of 6

Thread: RSPS Auto Cutter First Script

  1. #1
    Join Date
    Oct 2016
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Lightbulb RSPS Auto Cutter First Script

    Hey guys this is going to be my first post. I've been reading up on some things and thought I might try them out.
    Auto Cutter Functions
    -Cuts Trees
    -Drops/Banks
    -Picksup Bird's Nest
    -anti-ban


    I currently have it set to cut magic trees. I couldn't think of any other way to detect if the tree is cut down. I know it doesn't work to its full potential but it cuts wood I was wondering how I could change the CheckTree procedure and add a ::bank command that adds my logs to bank when full. (bitmaps to deposit and exit bank?) other than that im not sure how I would do it. I know ACA is a way better color detection program I just don't fully understand it yet.
    Look forward to learning more and advancing my coding knowledge thanks! No Hate I know im a narb.

    Heres my code
    Code:
    program TreeCutter;
    {$i SRL-6/srl.simba}
    
    function rsps_getUpText:string; //trying to make my own UpText CMD
    var
      blueTPA: tpointarray;
      blueATPA: t2dpointarray;
      bmp: integer;
    
    begin
    FindColorsTolerance(blueTPA, 16776960, 10, 50, 130, 70, 15);
    if (length(blueTPA) > 1) then
    blueATPA :=splitTPAEx(blueTPA, 1, 10);
    SortATPAFromFirstPointX(blueATPA, point(0, 0));
    result:= getTextATPA(blueATPA, 5, 'UpChars07');
    end;
    
    procedure Inventory; //little test i did to open inv unknown use atm
    var
      x, y:Integer;
    begin
      if FindColorTolerance(x, y, 2249607, 650, 220, 665, 235, 10) then
        begin
        mouse(x, y, 0, 0);
        ClickMouse(x, y, 1);
        Wait(300 + Random(710));
        end;
    end;
    
    
    
    procedure ClickTree; //click tree procedure
    var
      X, Y:Integer;
    begin
      if FindColorTolerance(x, y, 6260864, 10, 50, 510, 375, 15) then
        //else if rsps_getUpText( 'agic') then//trying to figure out stuff
        begin
          mouse(x, y, 0, 0); //moves mouse
          wait(Random(250));  //wait about a 1/4 second
          ClickMouse(x, y, 1);  //left clicks at x y found
          writeln('Cutting Tree');
          wait(5000 +random(5000));
        end;
    end;
    
    procedure CheckTree; //procedure to check if tree is cut
    var
      x, y:integer;
    begin
      if FindColorTolerance(x, y, 12621, 130, 50, 390, 375, 1) then true;
        if true then ClickTree; //if tree is cut. Find new tree
          writeln('tree cut down');
        if false then writeln('tree not cut waiting');
          wait(1000 +random(4000)); //waits up to 1sec +random int 4
          repeat CheckTree until true; //repeat procedure until loops to Clicktree
    end;
    
    
    
    
    begin
    ClearDebug;
    //Inventory;
    ClickTree;
    CheckTree;
    end;
    Attached Files Attached Files

  2. #2
    Join Date
    Sep 2016
    Location
    the Simba forums
    Posts
    25
    Mentioned
    1 Post(s)
    Quoted
    1 Post(s)

    Default

    To see if tree is down try isplayeranimating() from srl6 lib.
    Good script.

  3. #3
    Join Date
    Oct 2016
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Hey I was wondering how I would include that into my script. I have SRL-6 Master. {$I SRL-6/lib/interfaces/mainscreen.samba} ? this will work for a rsps such as runique?
    Last edited by Learn; 10-09-2016 at 11:58 PM.

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

    Default

    Grab the coordinates of where your player is, they're probably static.
    From there on check pixelshift.

    Also not bad for a first script, but I noticed you have an infinite loop nested in itself (wtf).

    Simba Code:
    Procedure CheckTree();
    begin
      repeat
        CheckTree();
      until true;
    end;

    This is very dangerous if you store anything called inside that procedure in the memory, as that would cause some bad memory leakage. This is some weird way of doing recursive programming. For a main loop just do

    Simba Code:
    begin
      while true do
        checkTree();
    end. //this being the main loop begin end. at the bottom of your script

    Also one more thing, if something() then true; if true then doSomething();
    serves the same purpose as if Something() then doSomething();

    EDIT: Have you even ran the script?

    Simba Code:
    if FindColorTolerance(x, y, 12621, 130, 50, 390, 375, 1) then true;
        if true then ClickTree; //if tree is cut. Find new tree
          writeln('tree cut down');
        if false then writeln('tree not cut waiting');

    The "if false then" is completely pointless, it will not work. A proper way to do this would be to:

    Simba Code:
    if FindColorTolerance(x, y, 12621, 130, 50, 390, 375, 1) then
      ClickTree
    else
      writeln('tree not cut waiting');
       wait(1000 +random(4000)); //waits anywhere between 1 and 5 seconds, excluding 5.

    This True/False thing you are using isn't a global variable that you can set or get, it's simply a comparison value, you can not do true; You can on the other hand do if (someVariableOrFunction = True) then, or you can do aBooleanVariable := True;
    if aBooleanVariable then / if (aBooleanVariable = True) then
    doSomething();

    Store things in a variable only if they need to be used multiplie times and or later on in the script. Directly after accessing it, only needing to use it once (or twice with an else condition), you should compare it directly.
    Last edited by Joopi; 10-10-2016 at 01:00 PM.
    Feel free to ask me any questions, I will do my best to answer them!

    Previously known as YouPee.

  5. #5
    Join Date
    Mar 2014
    Posts
    195
    Mentioned
    4 Post(s)
    Quoted
    92 Post(s)

    Default

    what you can do to see if your invo is full is:
    check to see if if it finds the black out line of the item in the tbox around the last invo slot.

    to type send:
    You can use the sendkeys procedure link goes to srl documentation.

    to check to see if the bank is open:
    use a function to return a Boolean to check if it finds the orange text inside of a tbox [around the the bank of runique text]

    to deposit all/close bank
    if bank is open mouse the point of the deposit all items the wait a little then mouse the x on the bank screen.
    wait as long as it takes for the bank screen not to be open.

    You can check out the some of the code in my runique include if you want to. To look at some example code =p

  6. #6
    Join Date
    May 2012
    Posts
    59
    Mentioned
    0 Post(s)
    Quoted
    22 Post(s)

    Default

    im looking for an oldschool eco server that will help me learn how to pk again so i can wreck some people in oldschool rs

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •