Results 1 to 19 of 19

Thread: help with my first script (woodcutting)

  1. #1
    Join Date
    Jul 2008
    Location
    Lithuania/Norway
    Posts
    90
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default help with my first script (woodcutting)

    i just started my first script and i don't know what's wrong.

  2. #2
    Join Date
    Oct 2009
    Location
    Melb, Australia
    Posts
    179
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    PHP Code:
      if FindObjCustom(xy, ['hop''dow'], [willowcolor1willowcolor2], 7then
      repeat
          
    case (Random(2)) of
          1
    begin
               Mouse
    (xy44,false);
               
    ChooseOption('hop');
             
    end;
          
    2Mouse(xy44True);
        
    end;
      
    until (InvFull
    And in turn:
    PHP Code:
    if FindObjCustom(xy, ['hop''dow'], [willowcolor1willowcolor2], 7then
      repeat
        
    case (Random(2)) of
          1
    begin
               Mouse
    (xy44,false);
               
    ChooseOption('dow');
             
    end;
          
    2Mouse(xy44True);
        
    end;
      
    until (InvFull
    And also, I'm pretty sure Random() can start at 0, so your cases should start at 0? Or just make it:
    case (1+Random(1)) of
    Last edited by code841; 10-27-2009 at 01:09 PM.

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

    Default

    You made a mistake with the case(random(2)) thing.
    Code:
    case (Random(2)) of
      1: 
        begin
           Mouse(x, y, 4, 4,false);
           ChooseOption('hop');
         end;
       2: Mouse(x, y, 4, 4, True);
    end;
    and

    Code:
    case (Random(2)) of
      1: 
        begin
           Mouse(x, y, 4, 4,false);
           ChooseOption('dow');
         end;
       2: Mouse(x, y, 4, 4, True);
    end;
    The problem is that after : the scripts expects only one command, like Mouse(x, y, 4, 4, True);. You entered 2 command: Mouse(); and ChooseOption();. So you have to put it between begin and end tags.

    E: code was just a few seconds faster
    And I can't find the DropTo(2,28); function but maybe my SRL is outdated...
    Last edited by masterBB; 10-27-2009 at 01:14 PM.

  4. #4
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    On your case in cutwillow procedure you should change the numbers to 0 and 1 because random(2) outputs a random number between 0 and 1 (hence the 2 which is the the number of possible values).

    And, as pointed out already, you must put a begin and end nest in the first case statement because of there being more than one procedure/function performed.
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

  5. #5
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    SCAR Code:
    if FindObjCustom(x, y, ['hop', 'dow'], [willowcolor1, willowcolor2], 7) then
      repeat
        case (Random(2)) of
          1: begin
               Mouse(x, y, 4, 4,false);
               ChooseOption('dow');
             end;
          2: Mouse(x, y, 4, 4, True);
        end;
      until (InvFull)
    To
    SCAR Code:
    if(FindObjCustom(x, y, ['hop', 'dow'], [willowcolor1, willowcolor2], 7))then
      repeat
        case (Random(2)) of
          0 :
            begin
               Mouse(x, y, 4, 4, False);
               Wait(100 + Random(200));
               ChooseOption('dow');
             end;
          1 : Mouse(x, y, 4, 4, True);
        end;
      until(InvFull);

    The other people were right, but you also needed a Wait after right clicking. Not bad for a first script tho, keep it up

    ~Camo
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  6. #6
    Join Date
    Jul 2008
    Location
    Lithuania/Norway
    Posts
    90
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    thank you guys you are best. now my cutter cuts and drops but he chops only one tree. only one. what's wrong? it's something with mouse?

  7. #7
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    What does he do after he drops the logs? Does he just stand there? What is the mouse doing?

    ~Camo
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  8. #8
    Join Date
    Jul 2008
    Location
    Lithuania/Norway
    Posts
    90
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    he cutt tree but only one. only one. not finding other trees. just waiting till same tree up again it's bad with colors?

    you can try

    const
    willowcolor1= 4683362;
    willowcolor2= 2444868;
    logcolor1= 1325891;
    logcolor2= 1391941;


    var
    x, y, i, Tries: integer;

    procedure cuttwillow;
    begin
    if(FindObjCustom(x, y, ['hop', 'dow'], [willowcolor1, willowcolor2], 7))then
    repeat
    case (Random(1)) of
    0 :
    begin
    Wait(8000 + Random(200));
    Mouse(x, y, 4, 4, False);
    ChooseOption('dow');
    end;
    1 : Mouse(x, y, 4, 4, True);
    end;
    until(InvFull);
    end;

    Procedure Droplogs;
    begin
    if FindObjCustom(x, y, ['log'], [logcolor1, logcolor2], 7) then
    for i := 2 to 28 do
    dropItem(i);
    end;

    begin
    SetupSRL;
    repeat
    cuttwillow;
    Droplogs;
    until (False)
    end.

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

    Default

    Code:
    begin
      SetupSRL;
      repeat
        cuttwillow;
        Droplogs;
        AntiBan;
      until (False)
    end.
    should be:

    Code:
    begin
      SetupSRL;
      repeat
        repeat
          cuttwillow;
        until(InvFull)
        Droplogs;
        AntiBan;
      until (False)
    end.
    And this repeat is wrong:
    Code:
    repeat
          case (Random(2)) of
          0: begin Mouse(x, y, 4, 4,false);
             ChooseOption('hop');
             end;
          1: Mouse(x, y, 4, 4, True);
        end;
      until (InvFull)
    you should remove that repeat ... until (InvFull) part
    Last edited by masterBB; 10-27-2009 at 02:39 PM.

  10. #10
    Join Date
    Jul 2008
    Location
    Lithuania/Norway
    Posts
    90
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by masterBB View Post
    Code:
    begin
      SetupSRL;
      repeat
        cuttwillow;
        Droplogs;
        AntiBan;
      until (False)
    end.
    should be:

    Code:
    begin
      SetupSRL;
      repeat
        repeat
          cuttwillow;
        until(InvFull)
        Droplogs;
        AntiBan;
      until (False)
    end.
    he drop logs. about drop is good,but he cutting only one tree. if tree gone he didin't find an other. waiting till same tree up

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

    Default

    That's what I try to say... you should repeat the cutWillow function, so it search again after chopping, not just the clicking part.

    And where in your script you wait for the tree to be down?
    Last edited by masterBB; 10-27-2009 at 02:43 PM.

  12. #12
    Join Date
    Jul 2008
    Location
    Lithuania/Norway
    Posts
    90
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by masterBB View Post
    That's what I try to say... you should repeat the cutWillow function, so it search again after chopping, not just the clicking part.

    And where in your script you wait for the tree to be down?
    trying ur method

  13. #13
    Join Date
    Oct 2009
    Location
    Melb, Australia
    Posts
    179
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    No he needs to change his CutWillow function, it's repeating the mouse actions until inventory is full.
    Edit: Opps you editted it in your post :/

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

    Default

    Quote Originally Posted by code841 View Post
    No he needs to change his CutWillow function, it's repeating the mouse actions until inventory is full.
    I also said that in my post.. after my first edit

  15. #15
    Join Date
    Jul 2008
    Location
    Lithuania/Norway
    Posts
    90
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    om i'm deleted until (fullinv) and it says

    Line 26: [Error] (20606:1): Identifier expected in script

  16. #16
    Join Date
    Jan 2007
    Location
    Kansas
    Posts
    3,760
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    You still need an until statement if you have a repeat statement.


  17. #17
    Join Date
    Jul 2008
    Location
    Lithuania/Norway
    Posts
    90
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ok so my script looks like that

    {.include SRL/SRL.scar}

    const
    willowcolor1= 4683362;
    willowcolor2= 2444868;
    logcolor1= 1325891;
    logcolor2= 1391941;


    var
    x, y, i, Tries: integer;

    procedure cuttwillow;
    begin
    if(FindObjCustom(x, y, ['hop', 'dow'], [willowcolor1, willowcolor2], 7))then
    repeat
    case (Random(1)) of
    0: begin Mouse(x, y, 4, 4,false);
    ChooseOption('hop');
    wait(5000+random(800));
    1: Mouse(x, y, 4, 4, True);
    end.
    until
    end;



    Procedure Droplogs;
    begin
    if FindObjCustom(x, y, ['log'], [logcolor1, logcolor2], 7) then
    for i := 2 to 28 do
    dropItem(i);
    end;

    begin
    SetupSRL;
    repeat
    repeat
    cuttwillow;
    until(InvFull)
    Droplogs;
    until (False)
    end.



    can someone fix it or help how to fix?

  18. #18
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    Your case in CutWillows need to be Random(2) or more.

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

    Default

    Correct code:

    SCAR Code:
    procedure cuttwillow;
    begin
      if(FindObjCustom(x, y, ['hop', 'dow'], [willowcolor1, willowcolor2], 7))then
      begin
      //repeat - remove this line
      case (Random(2)) of
        0: begin
          Mouse(x, y, 4, 4,false);
          wait(300+random(200));  //- it can take some time for rs to show the option menu
          ChooseOption('hop');
          wait(5000+random(800));
        end;  //- every begin needs an end!
        1: begin
          Mouse(x, y, 4, 4, True);
          wait(5000+random(800));
        end;
      end;
    end;

    SCAR Code:
    begin
      SetupSRL;
      repeat
        repeat
          cuttwillow;
        until(InvFull)
        Droplogs;
      until (False)
    end.


    To explain why I use an extra repeat in the last piece of code:
    • You want to cutt willow trees till your inventory is full.
    • When your inv is full you want to drop them.
    • So it only needs to execute the drop command if you inventory is full.
    • So you will have to "repeat" "cutting willows" "until your inv is full.
    Last edited by masterBB; 10-27-2009 at 07:26 PM. Reason: found an other bug

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
  •