Results 1 to 8 of 8

Thread: Help with script

  1. #1
    Join Date
    Sep 2014
    Posts
    55
    Mentioned
    0 Post(s)
    Quoted
    23 Post(s)

    Default Help with script

    Hi, I'm having trouble making a basic woodcutting script for an rsps my script compiles sucessfully however it does not click on the tree even with the color selected

    heres what i have so far

    program YewCutter;
    {$I SRL-6/SRL.simba}

    Procedure ChopYew;
    var
    X,Y:Integer;
    Begin
    if mainscreen.findObject(x, y, 1717802, 21, ['Yew'], MOUSE_MOVE) Then
    wait(250);
    ClickMouse(X, Y, mouse_left)
    end;
    begin
    MouseSpeed := 15;
    End.

  2. #2
    Join Date
    Jun 2014
    Location
    Lithuania
    Posts
    475
    Mentioned
    27 Post(s)
    Quoted
    200 Post(s)

    Default

    Quote Originally Posted by henryuscola View Post
    Hi, I'm having trouble making a basic woodcutting script for an rsps my script compiles sucessfully however it does not click on the tree even with the color selected

    heres what i have so far

    program YewCutter;
    {$I SRL-6/SRL.simba}

    Procedure ChopYew;
    var
    X,Y:Integer;
    Begin
    if mainscreen.findObject(x, y, 1717802, 21, ['Yew'], MOUSE_MOVE) Then
    wait(250);
    ClickMouse(X, Y, mouse_left)
    end;
    begin
    MouseSpeed := 15;
    End.
    You not calling ChopYew procedure. Try this:

    Simba Code:
    program YewCutter;
    {$I SRL-6/SRL.simba}

    Procedure ChopYew;
    var
      X,Y:Integer;
    Begin
      if mainscreen.findObject(x, y, 1717802, 21, ['Yew'], MOUSE_MOVE) Then
      begin
        wait(250);
        ClickMouse(X, Y, mouse_left);
      end
      else writeln('tree not found'); // <- failsafe to prevent mouse clicking -1,-1 if  tree not found.
    end;
    begin
    MouseSpeed := 15;
    ChopYew(); // <- basicly missed this line
    end.

  3. #3
    Join Date
    Sep 2014
    Posts
    55
    Mentioned
    0 Post(s)
    Quoted
    23 Post(s)

    Default

    Hello, so far the script compiles successfully but it cant seem to find the color and the script ends.
    this is what it says in the debug;

    -- TRSMainscreen.findObject()
    ---- No colors found
    -- TRSMainscreen.findObject(): False
    tree not found
    Successfully executed.

  4. #4
    Join Date
    Jun 2014
    Location
    Lithuania
    Posts
    475
    Mentioned
    27 Post(s)
    Quoted
    200 Post(s)

    Default

    Quote Originally Posted by henryuscola View Post
    Hello, so far the script compiles successfully but it cant seem to find the color and the script ends.
    this is what it says in the debug;

    -- TRSMainscreen.findObject()
    ---- No colors found
    -- TRSMainscreen.findObject(): False
    tree not found
    Successfully executed.
    Aparently either you didnt dragged simba cursor called select screen to your game window or/and colors bad especially when debug says no colors found

  5. #5
    Join Date
    Sep 2014
    Posts
    55
    Mentioned
    0 Post(s)
    Quoted
    23 Post(s)

    Default

    Thank you for your help is there a way i could make it search for the tree colors without the script stopping? like have it on a repeat loop until i manually stop the script

  6. #6
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Unsure about SRL6 but here's a way to do a loop X amount of times, or until the desired task was completed successfully:
    Simba Code:
    program YewCutter;
    {$I SRL-6/SRL.simba}

    Function ChopYew(): Boolean;
    var
      X,Y:Integer;
    Begin
      if mainscreen.findObject(x, y, 1717802, 21, ['Yew'], MOUSE_MOVE) Then
      begin
        writeln('Found the Yew tree');
        wait(250);
        ClickMouse(X, Y, mouse_left);
        rexult := true;
      end else
        writeln('Tree not found'); // <- failsafe to prevent mouse clicking -1,-1 if  tree not found.
    end;

    var
      i : Integer;

    begin
      MouseSpeed := 15;

      for i:=0 to 4 do     // Loop 5 times [0,1,2,3,4]
        if ChopYew() then
          break;           // Successfully chopped a Yew tree so break the loop
    end.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  7. #7
    Join Date
    Jun 2014
    Location
    Lithuania
    Posts
    475
    Mentioned
    27 Post(s)
    Quoted
    200 Post(s)

    Default

    Quote Originally Posted by henryuscola View Post
    Thank you for your help is there a way i could make it search for the tree colors without the script stopping? like have it on a repeat loop until i manually stop the script
    Yes.

    Simba Code:
    program YewCutter;
    {$I SRL-6/SRL.simba}

    Procedure ChopYew;
    var
      X,Y:Integer;
    Begin
      if mainscreen.findObject(x, y, 1717802, 21, ['Yew'], MOUSE_MOVE) Then
      begin
        wait(250);
        ClickMouse(X, Y, mouse_left);
      end
      else writeln('tree not found'); // <- failsafe to prevent mouse clicking -1,-1 if  tree not found.
    end;
    begin
    MouseSpeed := 15;
    repeat  
      ChopYew();
    until false;
    end.

    This repeats searching tree untill you stop script.

    or you might do it repeat untill it clicks tree:

    Simba Code:
    program YewCutter;
    {$I SRL-6/SRL.simba}

    function ChopYew(): boolean;
    var
      X,Y:Integer;
    Begin
      result:=false;
      if mainscreen.findObject(x, y, 1717802, 21, ['Yew'], MOUSE_MOVE) Then
      begin
        wait(250);
        ClickMouse(X, Y, mouse_left);
        result:=true;  // returns true if found and clicked on tree so loop can stop itself.
      end
      else writeln('tree not found'); // <- failsafe to prevent mouse clicking -1,-1 if  tree not found.
    end;
    begin
    MouseSpeed := 15;
    repeat
       wait(100); // waits few ms before trying again
    until   ChopYew();
    end.

  8. #8
    Join Date
    Sep 2014
    Posts
    55
    Mentioned
    0 Post(s)
    Quoted
    23 Post(s)

    Default

    Thank you all for the help I have so far made the script run on a loop searching for the yew trees.

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
  •