Results 1 to 21 of 21

Thread: Extra DTM Functions

  1. #1
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default Extra DTM Functions

    Well the other function got moved to snippets so here's some of the others I was thinking of


    MouseDTM
    Simba Code:
    { MouseDTM
    ~~~~~~~~~~~

    .. code-block:: pascal

    function MouseDTM(DTM: Integer; Text: TIntegerArray; var x, y: Integer; xs, ys, xe, ye: Integer): Boolean;

    Searches for the DTM within the area xs, ys, xe, ye.
    If found, checks the uptext and performs the clicktype

    .. note::

      by abu_jwka

    Example:

    .. if MouseDTM(LogsDTM, ['orm', ogs'], x, y, MIX1, MIY1, MIX2, MIY2, True) then
         ClickFire;
    }


    function MouseDTM(DTM: Integer; Text: TStringArray; var x, y: Integer; xs, ys, xe, ye: Integer; WhichClick: Variant): Boolean;
    begin
      if FindDTM(DTM, x, y, xs, ys, xe, ye) then
      begin
      GetMousePos(x, y);
        if (Length(Text) > 0) then // if searching for uptext
        begin
          MMouse(x, y, 0, 0);
            if WaitUptextMulti(Text, 2000) then
            begin
              ClickMouse2(WhichClick);
              Wait(20 + Random(60));
              Result := True;
              Exit;
            end;
        end;
      end;
    end;


    FindDTMMulti
    Simba Code:
    { FindDTMMulti
    ~~~~~~~~~~~

    .. code-block:: pascal

    function FindDTMMulti: TIntegerArray; var x, y: Integer; xs, ys, xe, ye: Integer): Boolean;

    Searches for Multiple DTMs within the area xs, ys, xe, ye.
    Results true if found, returns the x and y co-ordinates of the first found DTM

    .. note::

      by abu_jwka

    Example:

    .. if FindDTMMulti([OakDTM, WillowDTM], x, y, MIX1, MIY1, MIX2, MIY2) then
       begin
         Writeln('Logs not burned yet! Clicking Tinderbox');
         MouseTBox(InvBox(1),1);
       end;
    }


    function FindDTMMulti(DTMs: TIntegerArray; var x, y: Integer; xs, ys, xe, ye: Integer): Boolean;
    var
      b: Integer;
    begin
      for b := 0 to High(DTMs) do
      begin
        if (FindDTM(DTMs[b], x, y, xs, ys, xe, ye)) then
        begin
          GetMousePos(x, y);
          Result := True;
          Exit;
        end;
      end;
    end;


    WaitFindDTMMulti
    Simba Code:
    { WaitFindDTMMulti
    ~~~~~~~~~~~

    .. code-block:: pascal

    function WaitFindDTMMulti: TIntegerArray; var x, y: Integer; xs, ys, xe, ye, WaitPerLoop, Maxtime: Integer): Boolean;

    Searches for Multiple DTMs within the area xs, ys, xe, ye every WaitPerLoop seconds
    for a maximum time defined by MaxTime
    Results true if found and returns the x and y co-ordinates of the first found DTM

    .. note::

      by abu_jwka

    Example:

    .. if WaitFindDTMMulti([Oak, Willow], x, y, MIX1, MIY1, MIX2, MIY2, 5000) then
       begin
         Writeln('Logs not burned yet! Clicking Tinderbox');
         MouseTBox(InvBox(1),1);
       end;
    }


    function WaitFindDTMMulti(DTMs: TIntegerArray; var x, y: Integer; xs, ys, xe, ye, WaitPerLoop, Maxtime: Integer): Boolean;
    var
      t: Integer;
    begin
      t := GetSystemTime + Maxtime;
      while (GetSystemTime < t) do
      begin
        if FindMultiDTM(DTMs, x, y, xs, ys, xe, ye) then
        begin
          GetMousePos(x, y);
          Result := True;
          Exit;
        end;
        Wait(WaitPerLoop);
      end;
    end;

    FindDTMsRotated
    Simba Code:
    (*
    FindDTMsRotated
    ~~~~~~~~~~~

    .. code-block:: pascal

        function FindDTMsRotated(DTMs: TIntegerArray; var x, y: Integer;xs, ys, xe, ye: Integer;
                                    sAngle, eAngle, aStep: Extended;
                                    var aFound: Extended): Boolean;

    Finds Multiple DTMs within the area xs, ys, xe, ye
    Starts searching from the angle 'sAngle'
    Stops searching once it reaches the angle 'eAngle'
    It will rotate every 'aStep' angle from sAngle to eAngle
    Results True if found and returns the x and y co-ordinates


    .. note::

        Author: abu_jwka

    Example:

    .. code-block:: pascal

      if FindDTMsRotated([BankerDTM,CounterDTM], x, y, MSX1, MSX2, MSY1, MSY2, -Pi/4, Pi/4, Pi/60, aFound) then
      begin
        Mouse(x, y, 0, 0, False);
        WaitOption('ank', 200);
      end;
    *)

    function FindDTMMultiRotated(DTMs: TIntegerArray; var x, y: Integer;xs, ys, xe, ye: Integer;
                             sAngle, eAngle, aStep: Extended;
                             var aFound: Extended): Boolean;
    var
      i: Integer;
    begin
      for i := 0 to High(DTMs) do
        if FindDTMRotated(DTMs[i], x, y, xs, ys, xe, ye, sAngle, eAngle, aStep, aFound) then
        begin
          GetMousePos(x, y);
          Result := True;
        end;
    end;
    Last edited by Abu; 04-14-2012 at 06:42 PM.

  2. #2
    Join Date
    Nov 2011
    Posts
    1,589
    Mentioned
    9 Post(s)
    Quoted
    17 Post(s)

    Default

    I could Use WaitFindDTMMulti Thanks<3



    ^^

  3. #3
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by Mat View Post
    I could Use WaitFindDTMMulti Thanks<3
    It's actually WaitFindMultiDTM, just saying...

  4. #4
    Join Date
    Feb 2012
    Location
    DON'T PM ME ASKING FOR STUFF
    Posts
    2,170
    Mentioned
    38 Post(s)
    Quoted
    423 Post(s)

    Default

    Think it's possible to compare DTM's? For example, Compare a DTM of the health of your char to a green one which is you poisoned and if poisoned find item in inv?


    Simba Code:
    Procedure Poisoncheck;
    var
      x, y, i: Integer;

    begin
        Writeln('Checking for poison');
        for i:=8 downto 1 do
        if (Pos('You have been', GetChatBoxText(i, 255)) <> 0)  then
        begin
         if FindObjEx(x, y, ['Anti', 'pois'], [1951850, 1749598, 1279303, 1211971, 2018925, 1885801], 5, 50, MIX1, MIY1, MIX2, MIY2) then
        begin
          Writeln('Clicking AntiPoison potion');
          Mouse(x, y, 0, 0, True);
          Wait(1500+Random(500))
          Exit;
          end;
        end;
    end;

    This won't work... So I'm wondering if your expertise in DTM's could work :P

  5. #5
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by xtrapsp View Post
    Think it's possible to compare DTM's? For example, Compare a DTM of the health of your char to a green one which is you poisoned and if poisoned find item in inv?

    BLA BLA BLA

    This won't work... So I'm wondering if your expertise in DTM's could work :P
    Lol I'm no expert, I'm just good at playing around with functions


    I don't think it's impossible but in the case that you mentioned, I'm sure you don't need to compare anything. You could just say
    Simba Code:
    while IAmFighting do // while fighting
      if FindDTM(PoisonHealth, x, y, MSX1, MSY1, MSX2, MSY2) then //if it finds you've been poisoned
        MouseDTM(AntiPoisonDTM, ['nti', 'oison'], x, y, MIX1, MIY1, MIX2, MIY2); // clicks the anti poison
    Last edited by Abu; 04-13-2012 at 09:01 PM.

  6. #6
    Join Date
    Feb 2012
    Location
    DON'T PM ME ASKING FOR STUFF
    Posts
    2,170
    Mentioned
    38 Post(s)
    Quoted
    423 Post(s)

    Default

    Quote Originally Posted by abu_jwka View Post
    Lol I'm no expert, I'm just good at playing around with functions


    I don't think it's impossible but in the case that you mentioned, I'm sure you don't need to compare anything. You could just say
    Simba Code:
    while IAmFighting do // while fighting
      if FindDTM(PoisonHealth, x, y, MSX1, MSY1, MSX2, MSY2) then //if it finds you've been poisoned
        MouseDTM(AntiPoisonDTM, ['nti', 'oison'], x, y, MIX1, MIY1, MIX2, MIY2); // clicks the anti poison
    Ended up making my own one similar :P Thanks anyway.

    just thought if you made a DTM compare you could have it added to Simba :P

  7. #7
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by xtrapsp View Post
    just thought if you made a DTM compare you could have it added to Simba :P
    Now that I think of it, no two DTMs are ever exactly the same - unless they've been copied and and pasted so there would no point.

  8. #8
    Join Date
    Apr 2012
    Location
    Cell beside Joe
    Posts
    102
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    This stuff is crazy! You are great with DTMs, but how does FindMultiDTM work? Can't it only look for 1 DTM at a time?

  9. #9
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by Oxygen View Post
    This stuff is crazy! You are great with DTMs, but how does FindMultiDTM work? Can't it only look for 1 DTM at a time?
    Looks for the first DTM, if it can't find it looks for the second DTM, if it can't find that then it looks for the third DTM etc... it will return the x and y co-ordinates of the first one it finds.

    Saves you having to write numerous lines of code

  10. #10
    Join Date
    Feb 2012
    Location
    SRL Jail
    Posts
    1,319
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by abu_jwka View Post
    Looks for the first DTM, if it can't find it looks for the second DTM, if it can't find that then it looks for the third DTM etc... it will return the x and y co-ordinates of the first one it finds.

    Saves you having to write numerous lines of code
    Numerous lines make you look sofisticated

  11. #11
    Join Date
    Jan 2012
    Posts
    296
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Sound good
    Sorry for my bad english, i'm french

  12. #12
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by JOEbot View Post
    Numerous lines make you look sofisticated
    No it doesn't, not when when you are repeating the same lines over and over again - that looks fugly

  13. #13
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Is this for MMLCore or for srl?

    edit:
    Also FindMultiDTM sounds odd.

    FindDTMs (like in FindColor and FindColors)
    FindDTMMulti

    maybe also add FindDTMsRotated.
    Working on: Tithe Farmer

  14. #14
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by masterBB View Post
    Is this for MMLCore or for srl?

    edit:
    Also FindMultiDTM sounds odd.

    FindDTMs (like in FindColor and FindColors)
    FindDTMMulti

    maybe also add FindDTMsRotated.
    Well I don't know what MMLCore is...

    Also, FindDTMs already exists, but it returns TPA's. So I guess I'll change it to FindDTMMulti?

    And I'll add that other one in a bit

  15. #15
    Join Date
    Jan 2012
    Location
    Calgary, AB, Canada
    Posts
    1,819
    Mentioned
    5 Post(s)
    Quoted
    120 Post(s)

    Default

    Nice work Abu, could definitely use these functions
    Current Project: Retired

  16. #16
    Join Date
    Feb 2012
    Location
    SRL Jail
    Posts
    1,319
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by abu_jwka View Post
    No it doesn't, not when when you are repeating the same lines over and over again - that looks fugly
    Oh, repetition- yeah thats ugly. But I mean in depth procedures as opposed to short to the point ones.

  17. #17
    Join Date
    Feb 2012
    Location
    SRL Jail
    Posts
    1,319
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by abu_jwka View Post
    No it doesn't, not when when you are repeating the same lines over and over again - that looks fugly
    Oh, repetition- yeah thats ugly. But I mean in depth procedures as opposed to short to the point ones.

    EDIT: Why did it post 2x?

  18. #18
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by JOEbot View Post

    EDIT: Why did it post 2x?
    Because you double-clicked Submit Reply

  19. #19
    Join Date
    Feb 2012
    Location
    SRL Jail
    Posts
    1,319
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by abu_jwka View Post
    Because you double-clicked Submit Reply
    maybe its a sign from simba that I have been chosen

  20. #20
    Join Date
    Mar 2012
    Location
    Over there
    Posts
    840
    Mentioned
    4 Post(s)
    Quoted
    42 Post(s)

    Default

    I'm liking these functions. Could use these to update my agility script.

  21. #21
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by TotalKillz View Post
    I'm liking these functions. Could use these to update my agility script.
    Thanks

    Also, added FindDTMsRotated, works the same as FindDTMRotated except for it searches for multiple DTMs

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
  •