Results 1 to 7 of 7

Thread: Urg. Once Again.

  1. #1
    Join Date
    Apr 2007
    Posts
    2,593
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Urg. Once Again.

    Would this be good to find a tree?

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

    const
      TreeName = 'Tree';
      Color    = 0;
      Color2   = 0;

    function getTrees: TPoint;
    var
      treeATPA: T2DPointArray; //Largest
      treePoints: TPointArray; //Medium
      treePoint: TPoint;       //Smallest
      i: Integer;
    begin
      FindColorsTolerance(treePoints, Color, MSX1, MSY1, MSX2, MSY2, 0);
      if Length(treePoints)=0 then
        FindColorsTolerance(treePoints, Color2, MSX1, MSY1, MSX2, MSY2, 5);
      treeATPA := TPAtoATPAEx(treePoints, 5, 5);
      for i := 0 to High(treeATPA) do
        begin
          treePoint := MiddleTPA(treeATPA[i]);
          MMouse(treePoint.x, treePoint.y, 0, 0);
          Wait(350 + Random(350));
          if IsUpText(TreeName) then
            begin
              case Random(2) of
                0: begin
                    Mouse(treePoint.x, treePoint.y, 0, 0, True);
                    Result := Point(treePoint.x, treePoint.y);
                    Exit;
                   end;
                1: begin
                    Mouse(treePoint.x, treePoint.y, 0, 0, False);
                    Wait(250 + Random(350));
                    if ChooseOption('Chop') then
                      begin
                        Result := Point(treePoint.x, treePoint.y);
                        Exit;
                      end;
                   end;
              end;
            end;
        end;
    end;

    begin
      SetupSRL;
      WriteLn(IntToStr(getTrees.x) + ' ' + IntToStr(getTrees.y));
    end.

  2. #2
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Yes, but you could make it better. Have three colors to search for maybe?

    Also, your standards are off.

    SCAR Code:
    for I := 0 to 10 do
    begin
      blah;
    end;

    if blah > 10 then
    begin
      blaggg;
    end;

    Hmm.. also, make the random click bigger so like:

    SCAR Code:
    case random(4) of
      0..2: begin
              Mouse blah.
            end;
      3: blahhhhhh;
    end;

    Other then that, it looks good.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  3. #3
    Join Date
    Jun 2007
    Location
    La Mirada, CA
    Posts
    2,484
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    may I ask, if your clicking the tree why have it result to a point?

    I could see doing

    trees: TPoint;

    trees := getTrees;

    then somewhere have it Mouse to that point...

    j/w if you use it somewhere else ?

    "Failure is the opportunity to begin again more intelligently" (Henry Ford)


  4. #4
    Join Date
    Apr 2007
    Posts
    2,593
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    WriteLn('Tree Found and Clicked At: ' + IntToStr(getTrees.x) + ':' + IntToStr(getTrees.y));

    is what I was planning to do.

  5. #5
    Join Date
    Mar 2008
    Location
    ::1
    Posts
    915
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    That is really good. Have you looked into this though?

    SCAR Code:
    ColorToleranceSpeed(2);

    Records and Types Save Code (and make you look better)
    Quote Originally Posted by Wizzup? View Post
    Is it possible to make Runescape a 2D game with this?... That would greatly simplify... Just about anything.

  6. #6
    Join Date
    Apr 2007
    Posts
    2,593
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I don't need it.

    It's fine how it is.

  7. #7
    Join Date
    Jun 2007
    Location
    La Mirada, CA
    Posts
    2,484
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    oh your simply just using it for a writeln/status, ok

    "Failure is the opportunity to begin again more intelligently" (Henry Ford)


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
  •