Results 1 to 13 of 13

Thread: Enhancment Help.

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

    Default Enhancment Help.

    Well. I know, I know. I've tried too many times..
    But. I'm trying to get this down.
    I keep getting the uber idea of creating a willow chopper/banker for Draynor..I have all of the script except for the chopping..

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

    const
      TreeColor  = 0;

    procedure DeclarePlayers;
    begin
      CurrentPlayer  := 0;
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
     
      Players[0].Name := '';
      Players[0].Pass := '';
      Players[0].Nick := '';
      Players[0].Active := True;
    end;

    function canChop: boolean;
    begin
      if FindBlackChatMessage('You do not') then
        Result := False
    end;

    function findTrees: T2DPointArray;
    var tX, tY: integer;
        TreePointArray: TPointArray;
        ResBef: T2DPointArray;
    begin
      if not LoggedIn then Exit;
      tX := MSCX;
      tY := MSCY;
      FindColorsSpiralTolerance(tX, tY, TreePointArray, TreeColor, MSX1, MSY1, MSX2, MSY2, 0);
      if Length(TreePointArray)=0 then
        FindColorsSpiralTolerance(tX, tY, TreePointArray, TreeColor, MSX1, MSY1, MSX2, MSY2, 15);
      ResBef := SplitTPA(TreePointArray, 3);
      Result := ResBef;
    end;

    function findTree: boolean;
    var i, z: integer;
        TreeT2D: T2DPointArray;
        TreePoint: TPoint;
    begin
      if not LoggedIn then Exit;
      if z>=5 then
      begin
        WriteLn('Failed too many times..');
        TerminateScript;
      end;
      TreeT2D := findTrees;
      for i := 0 to High(TreeT2D) do
      begin
        TreePoint := MiddleTPA(TreeT2D[i]);
        Mouse(TreePoint.x, TreePoint.y, 1, 1, False);
        Wait(250 + Random(250));
        if ChooseOption('Chop') then
        begin
          if canChop then
          begin
            Result := True;
            Exit;
          end
          else
            WriteLn('No pickaxe..Logging out..');
            Logout;
            TerminateScript;
        end
        else
          Inc(z);
      end;
    end;

    procedure dropLogs;
    begin
      if not LoggedIn then Exit;
      ClickAllItems(srl_GetBitmap(bmp_Log_Willow), 'bmp', 'rop', 120, [0]);
    end;



    procedure mainLoop;
    var Timer: integer;
    begin
      DeclarePlayers;
      LoginPlayer;
      repeat
        dropLogs;
        repeat
          MarkTime(Timer);
          findTree;
        until((not findTree) or (TimeFromMark(Timer)>=120000));
        if not findTree then
          Logout;
      until((InvFull) or (not LoggedIn));
    end;

    begin
    SetupSRL;
    mainLoop;
    end.

    Can I do anything to make it better?

  2. #2
    Join Date
    Jun 2006
    Posts
    1,492
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Reflection?

    But seriously, instead of using a single tree color, try using a color from the leaves and the trunk. With those colors, what you could do is FindColorsSpiralTolerance for the green-ish tree color, and then loop through all those to see if you find a trunk color close by?

  3. #3
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    SCAR Code:
    function canChop: boolean;
    begin
      if FindBlackChatMessage('You do not') then
        Result := False
    end;
    That will always return false.
    Quote Originally Posted by Infintry001 View Post
    Reflection?
    He asked how to make it better.

    Quote Originally Posted by Infintry001 View Post
    But seriously, instead of using a single tree color, try using a color from the leaves and the trunk. With those colors, what you could do is FindColorsSpiralTolerance for the green-ish tree color, and then loop through all those to see if you find a trunk color close by?
    Not needed really. A single color can work fine.

  4. #4
    Join Date
    Jun 2006
    Posts
    1,492
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Heh, I always had problems with trees. That's just what I would do No need to take my opinion.

  5. #5
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Yes, tree finding is hell

    I spent about a week trying to make a perfect tree finder (finds the type of tree you want). I couldn't get it perfect...

  6. #6
    Join Date
    Jul 2008
    Posts
    907
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i think he made the thing always return false because if it found that bessage it means it couldn.t chop the tree


  7. #7
    Join Date
    Dec 2007
    Posts
    2,112
    Mentioned
    71 Post(s)
    Quoted
    580 Post(s)

    Default

    well if u wanna make ur tree finding ultimate the use auto color aid v2
    By Nielsie95 and sumilion

    Oh ye swich to CTS 2

  8. #8
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by sandos1234 View Post
    i think he made the thing always return false because if it found that bessage it means it couldn.t chop the tree
    But then there would be no point in the function in the first place.

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

    Default

    Quote Originally Posted by bullzeye95 View Post
    SCAR Code:
    function canChop: boolean;
    begin
      if FindBlackChatMessage('You do not') then
        Result := False
    end;
    That will always return false.
    That will only return false if it finds the black text.

  10. #10
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    Booleans are false by default (meaning that function will always return false).
    :-)

  11. #11
    Join Date
    Jun 2006
    Posts
    1,492
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    So, just stick result := true before the FindBlackChatText

  12. #12
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Or: Result:= not FindBlackChatMessage('You do not');

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

    Default

    Well, I found tree finding to be a lot easier with ColorSpeedTolerance(2);. I would use that. If you don't know how, I would take a look at this tut. It really helped me to learn [ACRONYM="Color Tolerance Speed"]CTS[/ACRONYM].

    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.

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
  •