Results 1 to 9 of 9

Thread: need help with clicking ground items

  1. #1
    Join Date
    May 2012
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default need help with clicking ground items

    Ok so I'm trying to create a Swamp Toad collector script. So far all I have managed to do is have the script search for the colors and its supposed to click on them to pick up the toad. But after it picks up the first toad it will continue to search for the other ones (which it finds them all accurately) but never pick them up. I can paste the procedure I'm working on if that helps figure things out.

  2. #2
    Join Date
    Apr 2007
    Location
    Los Angeles
    Posts
    622
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Use repeat until (invfull)

  3. #3
    Join Date
    May 2012
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I'm thinking it might just be something wrong with my color selection so I'll mess with that and see if anything changes.

  4. #4
    Join Date
    May 2012
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Okay I used ACA to find colors and create a autocolorfunction, but now its searching randomly on the ground when it cant find a toad even though on ACA there is no red on the ground and I have 10+ colors selected. Any suggestions or other ways of finding the toads?

  5. #5
    Join Date
    Mar 2012
    Posts
    426
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Quote Originally Posted by dw171 View Post
    Okay I used ACA to find colors and create a autocolorfunction, but now its searching randomly on the ground when it cant find a toad even though on ACA there is no red on the ground and I have 10+ colors selected. Any suggestions or other ways of finding the toads?
    How similar are the color of the toads to the ground and surrounding environment? If they aren't too similar then ACA should work just fine. Can you post your code? If you want to keep it private you can pm it to me and I can take a look if you would like.
    - My Scripts (Beginning to Update to SRL 6) -

  6. #6
    Join Date
    Dec 2011
    Location
    The Netherlands
    Posts
    1,631
    Mentioned
    47 Post(s)
    Quoted
    254 Post(s)

    Default

    If the toads are the only red dots popping up on ACA you actually have the right colors. If you can post your script here we can look at it and see what's wrong.

    Another way of finding it is the MMtoMS function.
    This is interesting to read: http://villavu.com/forum/showthread.php?t=73768

    Script source code available here: Github

  7. #7
    Join Date
    Mar 2012
    Posts
    426
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Quote Originally Posted by J J View Post
    If the toads are the only red dots popping up on ACA you actually have the right colors. If you can post your script here we can look at it and see what's wrong.

    Another way of finding it is the MMtoMS function.
    This is interesting to read: http://villavu.com/forum/showthread.php?t=73768
    J J is right on with the MMtoMS but it can be a bit tricky to learn. That link he gave is helpful but took me a little time to read/learn it from there. Here is an example of how you could possibly use it in your script:

    Simba Code:
    Function FindHidden(x, y: Integer): Boolean;
    Var
    I: Integer;
    TPA: TPointArray;
    ATPA: Array of TPointArray;
    InvPoint: TPoint;

    Begin
      TPA  := GetMMDotsOnMS('npc') /// If the toads show as yellow dot on minimap leave it as NPC, if they show as red then put it as 'item'.
      ATPA := TPAToATPAEx(TPA, 15, 15);
      MiddleTPAEx(ATPA[i], x, y);
      InvPoint := MMToMSEx(0, -20, Point(x,y)); /// You could take this line out since the toads are on the ground. This changes the height of the point. More for NPCs up off the ground.
      Begin
        MMouse(InvPoint.x, InvPoint.y, 0, 0);
        If(WaitUpTextMulti(['Clan','Vex','illum'],700)) Then Result:= True; /// Obviously put in the correct uptext!
      End;
    End;

    That could be rewritten in a much more proper manner I am sure, but gives you a general idea I hope.
    - My Scripts (Beginning to Update to SRL 6) -

  8. #8
    Join Date
    May 2012
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Trying to work on walking right now, and with ACA its not detecting that the toads are similar to the ground, but when I run the script it searches the ground more than the toads. There's the script if it helps any,


    Code:
    program SwampToadCollector;
    
    //{$DEFINE SMART}
    {$i srl/srl.simba}
    {$i sps/sps.simba}
    //==============================================================================
    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
    
      with Players[0] do
      begin
        Name       := ''; // Player username
        Pass       := ''; // Player password
        BoxRewards := ['XP', 'ostume', 'mote', 'oins', 'une', 'ssence'];
        LampSkill  := Skill_MINING;
        Active     := True;
      end;
    end;
    //==============================================================================
    function ToadColor: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.21, 1.24);
    
      if not (FindColorsTolerance(arP, 1466934, MSX1, MSY1, MSX2, MSY2, 10)) then
      begin
        //Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;
    
      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);
    
      for i := 0 to arL do
      begin
        Result := arC[i];
        //Writeln('AutoColor = ' + IntToStr(arC[i]));
        Break;
      end;
    
      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);
    
      if (i = arL + 1) then
        //Writeln('AutoColor failed in finding the color.');
    end;
    //==============================================================================
    procedure PickUpToads;
    Var
      x, y, PlusOne: Integer;
    begin
      Repeat
      PlusOne:= InvCount +1;
      If FindObjCustom(x, y, ['Swamp', 'p toa', 'wam', 'oad'], [ToadColor], 0)Then
      Mouse(x, y, 1, 1, True);
      Flag;
      Until (InvFull)
    end;
    //==============================================================================
    
    begin
    
      SetupSRL;
      DeclarePLayers;
      //Repeat
        PickUpToads;
      //Until(false);
    
    end.

  9. #9
    Join Date
    May 2012
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Are there any updated RS surface maps for Gnome Stronghold because the one included in SPS will not work.

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
  •