Results 1 to 13 of 13

Thread: repeating thingy for rsps

  1. #1
    Join Date
    Dec 2011
    Posts
    183
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default repeating thingy for rsps

    i am making a simple woodcut chopper for a rsps, so i have this to wood cut procedure here

    Procedure woodcutting;
    begin
    if FindColorSpiralTolerance(x, y, colour, x1,y1,x2,y2, tolerance) then //this is for finding the tree
    begin
    Mouse(x, y, 1, 1, True); // is there a better way to make it click just once?
    until
    (FindColorSpiralTolerance(x, y, colour2, x1,y1,x2,y2, tolerance) //this is the tree stump
    end;
    end;

    i want to repeat this procedure until
    (FindColorSpiralTolerance(x, y, colour3, x1,y1,x2,y2, tolerance)
    how would i go about doing this?
    Last edited by zluo; 04-16-2012 at 08:33 AM.

  2. #2
    Join Date
    Feb 2007
    Location
    Het ademt zwaar en moedeloos vannacht.
    Posts
    7,211
    Mentioned
    26 Post(s)
    Quoted
    72 Post(s)

    Default

    Simba Code:
    repeat
      writeln('Do SOmething');
    until (FindColorSpiralTolerance(x, y, colour2, x1,y1,x2,y2, tolerance));
    I made a new script, check it out!.

  3. #3
    Join Date
    Dec 2011
    Posts
    183
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    so would this procedure click on the tree, wait till the stump appears, and repeat itself until it detects the logs in the last spot in the inventory?
    Simba Code:
    Procedure Woodcutting;
    begin
    repeat //repeating till log appears in last spot in inv
      if FindColorSpiralTolerance(x, y, TreeColour, TreeCoordsX1, TreeCoordsY1, TreeCoordsX2, TreeCoordsY2, 2) then // detecting tree and clicking
      begin
       Mouse(x, y, 1, 1, True);
       until
       (FindColorSpiralTolerance(x, y, TreeStump, TreeCoordsX1, TreeCoordsY1, TreeCoordsX2, TreeCoordsY2, 2) //detecting tree stump
    until
    (FindColorSpiralTolerance (x, y, LogColour, 653, 438, 674, 456, 2) // detecting log in last inv spot
      end;
    end;
    Last edited by Markus; 04-16-2012 at 09:19 AM.

  4. #4
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    1. you dont need a begin if you are only going to perform 1 action, but if u want to, then u have to always end it after the action (and not after the untils!)
    2. every until is accompanied by repeat just like begin is accompanied by end.

    the code should look something like this (notice how i use spaces to make it easier to see what im doing?--search standards on scripting tutorials for info):
    Simba Code:
    Procedure Woodcutting;
    begin
      repeat //repeating till log appears in last spot in inv
        repeat
          if FindColorSpiralTolerance(x, y, TreeColour, TreeCoordsX1, TreeCoordsY1, TreeCoordsX2, TreeCoordsY2, 2) then // detecting tree and clicking
           Mouse(x, y, 1, 1, True);
        until(FindColorSpiralTolerance(x, y, TreeStump, TreeCoordsX1, TreeCoordsY1, TreeCoordsX2, TreeCoordsY2, 2) //detecting tree stump
      until (FindColorSpiralTolerance (x, y, LogColour, 653, 438, 674, 456, 2) // detecting log in last inv spot
    end;

    From what i see, the script will spam click the tree (like crazy) until it gets chop down, so u need to learn about methods such as averagepixelshift etc so that it only clicks once to chop a tree.

    Also ultilise the srl includes well, u can replace InvFull or ExistsItem(28) to replace ur findcolor for detecting log

    Edit: just realise u already have the function to detect tree finished chopping, try this instead:
    Simba Code:
    Procedure Woodcutting;
    begin
      repeat //repeating till log appears in last spot in inv
          if FindColorSpiralTolerance(x, y, TreeColour, TreeCoordsX1, TreeCoordsY1, TreeCoordsX2, TreeCoordsY2, 2) then // detecting tree and clicking
          begin
            Mouse(x, y, 1, 1, True);
            while not (FindColorSpiralTolerance(x, y, TreeStump, TreeCoordsX1, TreeCoordsY1, TreeCoordsX2, TreeCoordsY2, 2) do wait(100); //detecting tree stump
          end;
      until InvFull // detecting log in last inv spot
    end;
    It will find (or repeatedly tries to) the tree,click chop once, wait until stump appear, then repeat until ur InvFull. You did not create any failsafe though but that can be improved on later.

    EDIT 2: pertaining to ur qns, "Go Advanced" when u are replying, then click on simba tag and insert ur code in between.
    Also i believe most functions works on rsps (especially the InvFull, unless their inv coordinates are different)
    Last edited by riwu; 04-16-2012 at 09:25 AM.

  5. #5
    Join Date
    Dec 2011
    Posts
    183
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    riwu this is for a rsps so functions would be limited, but ty for fixing it up :P, and how do i put things into simba code in a forum post?
    Last edited by zluo; 04-16-2012 at 09:28 AM.

  6. #6
    Join Date
    Dec 2011
    Posts
    183
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    not sure why but this here

    while not (FindColorSpiralTolerance(x, y, TreeStump, TreeCoordsX1, TreeCoordsY1, TreeCoordsX2, TreeCoordsY2, 2) do wait(100);

    is not compiling correctly, is there something wrong?
    debug says
    [Error] (24:121): Closing parenthesis expected at line 23
    Compiling failed.

  7. #7
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Quote Originally Posted by zluo View Post
    not sure why but this here

    while not (FindColorSpiralTolerance(x, y, TreeStump, TreeCoordsX1, TreeCoordsY1, TreeCoordsX2, TreeCoordsY2, 2) do wait(100);

    is not compiling correctly, is there something wrong?
    debug says
    [Error] (24:121): Closing parenthesis expected at line 23
    Compiling failed.
    yeah do exactly as it says, add a closing parenthesis ")":
    while not (FindColorSpiralTolerance(x, y, TreeStump, TreeCoordsX1, TreeCoordsY1, TreeCoordsX2, TreeCoordsY2, 2)) do wait(100);

    sorry i just copy paste ur code, didnt check for syntax errors

  8. #8
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Simba Code:
    while not(FindColorSpiralTolerance(x, y, TreeStump, TreeCoordsX1, TreeCoordsY1, TreeCoordsX2, TreeCoordsY2, 2)) do
      wait(100);
    Working on: Tithe Farmer

  9. #9
    Join Date
    Dec 2011
    Posts
    183
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    thanks riwu for all the help
    so this is my complete script, however it does not compile correctly
    Simba Code:
    nvm
    what am i doing wrong?
    Last edited by zluo; 04-19-2012 at 09:37 PM.

  10. #10
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Simba Code:
    program WCandFM;

    {$i SRL/SRL.simba}

    var
      x,y:Integer;

    const
      TreeColour = 12392;
      TreeStump = 3105412;
      LogColour = 541282;
      TreeCoordsX1 = 128;
      TreeCoordsY1 = 150;
      TreeCoordsX2 = 232;
      TreeCoordsY2 = 236;

    Procedure Woodcutting;
    begin
      repeat
          if FindColorSpiralTolerance(x, y, TreeColour, TreeCoordsX1, TreeCoordsY1, TreeCoordsX2, TreeCoordsY2, 2) then
          begin
            Mouse(x, y, 1, 1, True);
            while not (FindColorSpiralTolerance(x, y, TreeStump, TreeCoordsX1, TreeCoordsY1, TreeCoordsX2, TreeCoordsY2, 2)) do
              wait(100);
          end;
      until (FindColorSpiralTolerance (x, y, LogColour, 653, 438, 674, 456, 2)); //added );
    end;

    Procedure Firemaking;
    begin
      repeat
        Mouse(694, 450, 1, 1, True);
        wait (1400);
        Mouse(676, 449, 1, 1, True);
        wait (1400);
      until(FindColorSpiralTolerance (x, y, 2963008, 653, 438, 674, 456, 2)); //added ;)
    end;

    procedure main;
    begin
      repeat
        Woodcutting;
        Firemaking;
      until(false);
    end;

    begin //added begin ... end.
      main;
    end.
    Working on: Tithe Farmer

  11. #11
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    ur mainloop went missing
    also add extra ) for whichever u missed.
    Simba Code:
    program WCandFM;

    {$i SRL/srl.simba}

    var
    x,y:Integer;

    const
    TreeColour = 12392;
    TreeStump = 3105412;
    LogColour = 541282;
    TreeCoordsX1 = 128;
    TreeCoordsY1 = 150;
    TreeCoordsX2 = 232;
    TreeCoordsY2 = 236;

    Procedure Woodcutting;
    begin
      repeat
          if FindColorSpiralTolerance(x, y, TreeColour, TreeCoordsX1, TreeCoordsY1, TreeCoordsX2, TreeCoordsY2, 2) then
          begin
            Mouse(x, y, 1, 1, True);
            while not (FindColorSpiralTolerance(x, y, TreeStump, TreeCoordsX1, TreeCoordsY1, TreeCoordsX2, TreeCoordsY2, 2)) do wait(100);
          end;
      until (FindColorSpiralTolerance (x, y, LogColour, 653, 438, 674, 456, 2))
    end;

    Procedure Firemaking;
    begin
    repeat
    Mouse(694, 450, 1, 1, True); //clicking tinderbox
    wait (1400)
    Mouse(676, 449, 1, 1, True); //clicking log
    wait (1400)
    until
    (FindColorSpiralTolerance (x, y, 2963008, 653, 438, 674, 456, 2)) //detects empty inv
    end;

    procedure main;
    begin
    repeat
      Woodcutting;
      Firemaking;
    until(false)
    end;

    begin
      SetupSRL;
      main;
    end.

    edit: get ()
    Last edited by riwu; 04-16-2012 at 10:24 AM.

  12. #12
    Join Date
    Dec 2011
    Posts
    183
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ive gotten myself into a mess havent i? script is working BUT i have one small problem. as you see, the woodcutting procedure will cut, wait for stump and repeat until not(FindColorSpiralTolerance (x, y, 3029313, 653, 438, 669, 449, 20));. however, it is not recognzing that colour and continuing the script because it has not yet seen the tree stump.
    Simba Code:
    program WCandFM;
    {$i SRL/SRL.simba}

    var
      x,y:Integer;

    const
     TreeColour = 10328;
     TreeColourTolerance = 3;
     StumpColour = 26784;
     StumpColourTolerance = 3;
     TreeX1 = 0;
     TreeY1 = 0;
     TreeX2 = 515;
     TreeY2 = 337;


    procedure AntiBan;
    begin
     Case Random (20) of
        1: Begin SleepAndMoveMouse(5000 + Random(750)); End;
        2: Begin RandomRClick; End;
        3: Begin PickUpMouse; End;
        4: Begin MissMouse(100,100); End;
        5: Begin RandomRClick; End;
        6: Begin PickUpMouse; End;
        7: Begin RandomMovement; End;
        8: Begin BoredHuman; End;
        9: Begin RandomRClick; End;
        End;
     end;

     procedure ChopTree;
     begin
     repeat
           if FindColorSpiralTolerance(x, y, TreeColour, TreeX1, TreeY1, TreeX2, TreeY2,  TreeColourTolerance) then
           begin
           writeln('Found tree and chopping it down.');
           Mouse (x ,y ,0 , 0, True);
           end;
           repeat
           Wait(RandomRange(1000, 2000));
           AntiBan;
           writeln('Doing AntiBan.');
           Until (FindColorSpiralTolerance(x, y, StumpColour, TreeX1, TreeY1, TreeX2, TreeY2, StumpColourTolerance)
           or (FindColorSpiralTolerance (x, y, 3029313, 653, 438, 669, 449, 20)) = False)
           writeln('Found tree stump,  waiting for tree to appear');
           wait(3000);
           until not(FindColorSpiralTolerance(x, y, 3029313, 653, 438, 669, 449, 20));
           Writeln('Full inventory, starting to firemake.');
           end;

    Procedure Firemake;
    begin
    repeat
    Mouse(706, 444, 10, 10, True);
    wait (200+Random(100));
    Mouse(663, 444, 10, 10, True);
    wait (1600+Random(100));
    until (FindColorSpiralTolerance (x, y, 3029313, 653, 438, 669, 449, 20));
    Writeln('Finished lighting all the logs, finding tree.');
    end;

    procedure main;
    begin
      repeat
        ChopTree;
        Firemake;
      until(false);
    end;

    begin
      ClearDebug;
      SetUpSrl;
      ActivateClient;
      Repeat
      main;
      Until(false);
    end.
    how can i get myself around this?
    and also, how do i use smooth mouse moving and pixel offsets? sorry bit of a noob and never really watched tuts
    Last edited by zluo; 04-19-2012 at 11:49 PM.

  13. #13
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    if its not recognising the colour then try change the colour? or increase ur color tolerance.
    Pixel offsets are done using srl in-built functions such as MMouse instead of MoveMouse, Clickmouse2 instead of clickmouse. Refer to srl core for more functions.

    Also if u "never really watched tuts" then i suggest u read some before going into scripting as that would make ur life easier

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
  •