Results 1 to 16 of 16

Thread: findobj?

  1. #1
    Join Date
    Feb 2007
    Location
    USA
    Posts
    667
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default findobj?

    I'm trying to get SCAR to search the screen with circles increasing in size until the cursor lands on a tree and it says "Chop" in the upper left corner. I remember doing this in the summer, and I thought that I used the SRL function findobj. For some reason, I can't get it to work now though... It doesn't make the circles, and just sits there.
    Can anyone explain what i'm supposed to do, or post an example procedure?

    Thanks

  2. #2
    Join Date
    May 2006
    Location
    West Coast
    Posts
    820
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    The guy I helped last time with FindObj said my tutorial was really helpful. Hopefully you will find it helpful as well. Check it out here: http://www.villavu.com/forum/showthr...hlight=FindObj

  3. #3
    Join Date
    Feb 2007
    Location
    USA
    Posts
    667
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks, yea that was helpful.
    My only remaining questions are:
    Is the color argument supposed to be the text color or the color of the actual rock?

    And on a different note,
    when you used the mouse(x,y,0,0,true), what do the two zeros mean? I've seen somebody use ones instead of zeros somewhere else.

  4. #4
    Join Date
    Sep 2006
    Posts
    916
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    1) yes it is the color of rock i believe.

    2) those 0's are just randomness for your click. I suggest using somewhere between 3 and 5.

  5. #5
    Join Date
    May 2006
    Location
    West Coast
    Posts
    820
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    PS: When finding a rock, make sure you find the ore vein color(Gold for gold rocks ) because it will work 100000 times better on the detection. Good luck !

  6. #6
    Join Date
    Feb 2007
    Location
    USA
    Posts
    667
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I'm actually going to be cutting trees, but thanks for the tip



    edit: I just tried it and it doesn't seem to work. It is supposed to move the mouse to the color on the screen right? The mouse just sits there where I left it when I pressed play. It says that it successfully compiled though...

    SCAR Code:
    User specified a new RS window
    Successfully compiled
    Line 174: [Hint] (182:43): Variable 'NEWLINE' never used in script C:\Program Files\SCAR 2.03\includes\srl\srl\core\Globals.scar
    Successfully executed

  7. #7
    Join Date
    Feb 2007
    Location
    USA
    Posts
    667
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    This is the procedure I was using. It's basically the same as the ex. in your tut. Just the text and color are different.

    SCAR Code:
    procedure findandchop;
    begin
    if(findobj(x,y,'Tree',3043432,10)) then
    mouse(x,y,3,3,true);
    end;

  8. #8
    Join Date
    Dec 2006
    Location
    Ky
    Posts
    390
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by omgh4x0rz View Post

    SCAR Code:
    procedure findandchop;
    begin
    if(findobj(x,y,'Tree',3043432,10)) then
    mouse(x,y,3,3,true);
    end;
    Make sure you have procedure to loop this repeatedly..
    SCAR Code:
    procedure findandchop;
    begin
    if(findobj(x,y,'Tree',3043432,10)) then
    mouse(x,y,3,3,true);
    end;

    Procedure ElLoopo;
    begin
    repeat
    Findandchop;
    until(invfull) {Or whatever you want, too lazy to go into detail :p}
    end;
    [/QUOTE]
    SUMMER BREAK be back when I want to

  9. #9
    Join Date
    May 2006
    Location
    West Coast
    Posts
    820
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You dont have to loop like he said, there are many a way to do loops. What does your main loop llook like??? show please

  10. #10
    Join Date
    Dec 2006
    Location
    Ky
    Posts
    390
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by AVAPHI (db_cheater) View Post
    You dont have to loop like he said, there are many a way to do loops. What does your main loop llook like??? show please
    Yea thats true, I was just giving an example. Seemed as if he did not have any loop at all..
    SUMMER BREAK be back when I want to

  11. #11
    Join Date
    Feb 2007
    Location
    USA
    Posts
    667
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I think I can get it to repeat when I want it to, the problem is that it won't even work right the first time. Like I said before, the mouse just sits at the play button, even though it says it successfully compiled. So right now my main loop is just trying to test this procedure once.

    Any ideas why it isn't working?

  12. #12
    Join Date
    Dec 2006
    Location
    Ky
    Posts
    390
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Were trying to find out if you even have a main loop or not. Just post the whole script.
    SUMMER BREAK be back when I want to

  13. #13
    Join Date
    May 2006
    Location
    West Coast
    Posts
    820
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Post your main loop asap if you want help.

  14. #14
    Join Date
    Feb 2007
    Location
    USA
    Posts
    667
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I haven't added the repeats yet because I want to see if it will even work once, which it doesn't seem to be doing.


    SCAR Code:
    program New;
    {.include SRL/SRL.scar}
    {.include SRL\SRL\skill\Woodcutting.scar}

    procedure findandchop;
    begin
    if(findobj(x,y,'Tree',3043432,10)) then
    mouse(x,y,3,3,true);
    end;

    begin
    findandchop;
    end.

  15. #15
    Join Date
    Jul 2006
    Location
    NY
    Posts
    371
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Here, this is basic. Do you think this script is going to help?
    SCAR Code:
    program New;
    {.include SRL/SRL.scar}
    {.include SRL\SRL\skill\Woodcutting.scar}

    const
      TreeWait = 5000; //ms's before clicking next tree.


    procedure findandchop;
    var
     Treew: integer;
    begin
      if (InvFull) then
        Exit
      else
      MarkTime(Treew);
      repeat
        FindObj(x, y, 'Tree', 3043432, 10); //might want to set the color as a const also
      until (FindObj(x, y, 'Tree', 3043432, 10)) or
      (TimeFromMark(Treew) = 10000) and not (FindObj(x,y,'Tree',3043432,10))
      if (FindObj(x,y,'Tree',3043432,10)) then
      begin
        Mouse(x, y, 3, 3, True);
        Wait(TreeWait + Random(700));
      end else
        WriteLn('Cannot find tree, terminating...');
        TerminateScript;
    end;


    begin
      SetUpSRL; //ALWAYS NEED THIS!!!
      repeat
        if (InvFull) then break;
        findandchop;
      until(InvFull)
    end.

  16. #16
    Join Date
    Feb 2007
    Location
    USA
    Posts
    667
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok, that might be the problem that forgot to include setupSRL

    What does 'exit' do?

    Is it the same as 'break'?

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. findobj problem
    By qcrist in forum OSR Help
    Replies: 14
    Last Post: 10-30-2007, 08:31 PM
  2. FindObj help
    By daddyproboot in forum OSR Help
    Replies: 6
    Last Post: 08-17-2007, 03:48 PM
  3. FindObj help
    By Xirx in forum OSR Help
    Replies: 7
    Last Post: 06-12-2007, 09:38 PM

Posting Permissions

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