Results 1 to 14 of 14

Thread: Moving and Clicking the mouse

  1. #1
    Join Date
    Aug 2008
    Location
    Auckland
    Posts
    132
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Moving and Clicking the mouse

    Hey guys as you can tell I'm a noob to scripting. So i'm making a copper/tin auto mining script. It compiles log's in but fails to move the mouse and click on the colour. Heres the section i stare for minutes at and wonder whats wrong.

    SCAR Code:
    Procedure MineTin;
    begin
      repeat
        If (FindColorSpiralTolerance(x, y, TinColour, MSX1, MSY1,MSX2, MSY2, 3)) or
        (FindColorSpiralTolerance(x, y, TinColour1, MSX1, MSY1,MSX2, MSY2, 3)) Then
        begin
          mmouse(x,y,5,5);
          if isuptext('ine')then
          begin
            wait(300);
            Mouse(x,y,0,0,true);
            writeln('Found Rock');
            Randoms;
          end;
        end;
      until(invfull)
    end;

    Ok say with my mining section. Were this bit is mmouse(x,y,5,5); what do the 5,5 stand for. Is it the place on the runscape client or what?
    Any help would be great, I just need it to click on the ROCK!
    ~Tom~

  2. #2
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    The 5,5 is the accuracy in which it will click. If I remember correctly, that means it will click within 5 pixels on the x axis, and 5 pixels on the y axis.

    The problem you're most likely having is the color might be incorrect. Try picking new colors for the tin rocks.

  3. #3
    Join Date
    Aug 2008
    Location
    Auckland
    Posts
    132
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yeah, but even if this is so shouldn't it search for the colour, using the spiral technique? The mouse, wont even move its at a complete stand still.
    Thanks for the input though.
    ~Tom~

  4. #4
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    I'm pretty sure the mouse won't move until it finds the color. It'll search in the spiral, but the mouse isn't gonna move during that.

  5. #5
    Join Date
    Aug 2008
    Location
    Auckland
    Posts
    132
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Oh ok so the mouse doesn't physically move itslef. Thanks. Also what do you think of my basic procedure. Bad or Good?
    ~Tom~

  6. #6
    Join Date
    Jul 2007
    Location
    's-Gravenpolder, Holland
    Posts
    204
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It looks good to me, if it finds something with the color of tin, but you can't mine it, it just tries again.

    Looks pretty solid to me

    For further upgrades i would try using FindObjCustom, this way you can let the mouse search for a object based on multiple colors and uptexts. Works like a charm

  7. #7
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Need higher tolerance, as colors change I recommend making the tolerance 15'ish.

  8. #8
    Join Date
    Aug 2008
    Location
    Auckland
    Posts
    132
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ay, I got it working Wopeee. Naumen with the tolerance, which number is it?
    Is it the Mouse(x,y,0,0,true); do i change the 0's to 15? But i got it working but it looks real bot, and shaakky as :P Ill add a pick finder though
    ~Tom~

  9. #9
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Nah, the tolerance is the 3 at the end of the FindColorSpiralTolerance thing. Change that to 15.

    Oh, and you might want to add in a failsafe to stop looking after a while if it repeatedly fails to find the rock.

  10. #10
    Join Date
    Aug 2008
    Location
    Auckland
    Posts
    132
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Oh okey thanks. The pick head finder is harrrd, have no clue how to do it. As i could use find colour tolerance, because theres to many pick heads to do.....
    Any help here.
    ~Tom~

  11. #11
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    Program HiThere;
    {.include srl/srl.scar}

    Procedure FindPickHeads(Colors : Array Of Integer);
    Var
     I, X, Y : Integer;
    Begin
    For I:=0 to GetArrayLength(Colors) Do
    If FindColorSpiralTolerance(x, y, Colors[I], MSX1, MSY1, MSX2, MSY2, 15) Then
    //Code you want executed here
    End;


    Begin
    FindPickHeads([23423, 2343, 2342, 23423])
    End.

    You'd probably have to tweak it, just a quick example. Arrays are awesome if you have a bunch of colors to find ^.^.

  12. #12
    Join Date
    Aug 2008
    Location
    Auckland
    Posts
    132
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yeah or dtm's, quick question are arrays only used when you need to find multiple colours, will it find the colour for all the pick heads out. Hmm im gana go do some reading.
    ~Tom~

  13. #13
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    Procedure MineTin;
    begin
      repeat
        If (FindColorSpiralTolerance(x, y, TinColour, MSX1, MSY1,MSX2, MSY2, 3))//the 3 is the tolerance parameter make it 15 or something
    or
        (FindColorSpiralTolerance(x, y, TinColour1, MSX1, MSY1,MSX2, MSY2, 3))//the 3 is the tolerance parameter
    Then
        begin
          mmouse(x,y,5,5);// the 5,5 are the randx and the randy variable randx = 5 and randy = 5 means the x and y you fill in + 5 randomness on both variables
          if isuptext('ine')then
          begin
            wait(300);//way to long make it like 1 milisec?
            Mouse(x,y,0,0,true);
            writeln('Found Rock');
            Randoms;
          end;
        end;
      until(invfull)
    end;

    some explaination to the code some guy posted:
    SCAR Code:
    Program HiThere;
    {.include srl/srl.scar}
     
    Procedure FindPickHeads(Colors : Array Of Integer);
    Var
     I, X, Y : Integer;
    Begin
    For I:=0 to GetArrayLength(Colors) Do
    If FindColorSpiralTolerance(x, y, Colors[i], MSX1, MSY1, MSX2, MSY2, 15) Then
    //Code you want executed here
    End;
     
     
    Begin
    FindPickHeads([23423, 2343, 2342, 23423])//a array of an integer is contains indexes like:
    //Let's pretend LOL is an array of integers(whole numbers)
    //we could do this LOL := [342342,4234432,432234]
    //an array always starts at 0(the index)
    //Writeln(inttostr( LOL[0]); // index 0 is 342342
    //What the code above this code does is loop through all your colors and //then if one of them is found it will do the code u put below it like check for //uptext and then click it
    End.
    ~Hermen

  14. #14
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks for explaining it Hermpie. I was rushed and just threw it together. Anyways, arrays can be of Integers (like I used in my main loop), Strings (['AWEBR', 'AWEBR']), Extendeds (same as integer, just decimals as well, I believe), and Booleans. Not sure how Array of Booleans work though.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. help with moving mouse?
    By joshdabest01 in forum OSR Help
    Replies: 2
    Last Post: 11-01-2008, 09:52 AM
  2. Moving/Clicking the mouse in Java
    By Jason2gs in forum Java Help and Tutorials
    Replies: 9
    Last Post: 10-29-2007, 11:38 PM
  3. Moving the mouse...
    By Jason2gs in forum Delphi/FPC Help and Tutorials
    Replies: 8
    Last Post: 08-10-2007, 05:48 PM
  4. Proper Clicking Of A Moving Target
    By Azzon in forum OSR Help
    Replies: 8
    Last Post: 03-04-2007, 09:12 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
  •