Results 1 to 16 of 16

Thread: Clicking on a spell using DTM

  1. #1
    Join Date
    Apr 2012
    Posts
    32
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default Clicking on a spell using DTM

    Just wondering what the correct way to click on a DTM is. Currently building my first script and have encountered some trouble. Read all of the beginner guides and examines a lot of scripts that perform similar functions and I know I am missing something obvious.

    Is this the right way to be going about things?

    Code:
    procedure ClickEnchant;
    begin
    if(finddtm(Spellpos, x, y, MIX1, MIY1, MIX2, MIY2))then
      begin
        MMouse(x, y, 5, 5,);
        ClickMouse2(Mouse_Left);
      end;
    end;

    I have Spellpos defined above

    Code:
    SpellPos :=  DTMFromString('m1gAAAHic42JgYDBlgWB7ILYEYm0g1gNiFyB2AGJ1ILYC4meMDAwfgfgpEN8B4vtA/AmI3wLxbSB+B8QfgDjGTRNoKhMRmDjASCRGAACU/QxT');
    Any help or hints to correct what I'm sure is terrible writing would be much appreciated!

  2. #2
    Join Date
    Mar 2012
    Location
    Color :D
    Posts
    938
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Just use mouse, mousebox or mousecircle. Can check the uptext also if you want. Make things easier than DTM.

  3. #3
    Join Date
    Apr 2012
    Posts
    32
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    I originally attempted that, but couldn't get that working either *helpless*

    That method would involve using tbox yes?

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

    Default

    Yes that is the correct way.

    As a failsafe, you could check for uptext before moving your mouse:
    Simba Code:
    procedure ClickEnchant;
    begin
      if(finddtm(Spellpos, x, y, MIX1, MIY1, MIX2, MIY2))then
      begin
        MMouse(x, y, 0, 0);
        if IsUptext('spellName') then
          Mouse(x, y, 5, 5, True);
      end;
    end;
    Last edited by Abu; 05-11-2012 at 04:40 PM.

  5. #5
    Join Date
    Apr 2012
    Posts
    32
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Thank you very much! I'll doubtlessly be back when the next problem arises.

    <3

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

    Default

    No problem - just read the function again as I made a mistake earlier which I just fixed

  7. #7
    Join Date
    Jan 2012
    Posts
    14
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks for asking this man. I was going to ask this later today as well, I have almost the exact same code as the OP, but it would not click the spell.

  8. #8
    Join Date
    Dec 2006
    Location
    Sweden
    Posts
    10,812
    Mentioned
    3 Post(s)
    Quoted
    16 Post(s)

    Default

    Simba Code:
    MMouse(x, y, 0, 0);
        if IsUptext('spellName') then
          Mouse(x, y, 5, 5, True);
      end;
    Nope, don't do that. Move first with your randomness, then if it has uptext getMousePos and click 0,0 randomness. Other than that yeah seems accurate. (correcting abu's, not yours)


    Send SMS messages using Simba
    Please do not send me a PM asking for help; I will not be able to help you! Post in a relevant thread or make your own! And always remember to search first!

  9. #9
    Join Date
    Oct 2011
    Location
    UK
    Posts
    1,322
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by abu_jwka View Post
    Yes that is the correct way.

    As a failsafe, you could check for uptext before moving your mouse:
    Simba Code:
    procedure ClickEnchant;
    begin
      if(finddtm(Spellpos, x, y, MIX1, MIY1, MIX2, MIY2))then
      begin
        MMouse(x, y, 0, 0);
        if IsUptext('spellName') then
          Mouse(x, y, 5, 5, True);
      end;
    end;
    Simba Code:
    procedure ClickEnchant;
    begin
      if(finddtm(Spellpos, x, y, MIX1, MIY1, MIX2, MIY2))then
      begin
        MMouse(x, y, 0, 0);
        if WaitUpText('spellName', 500+Random(500)) then  //Wait up text is a lot better incase RS / your computer lags...
          ClickMouse2(mouse_Left);   //You don't want more randomness after the mouse has stopped moving...
      end;
    end;

  10. #10
    Join Date
    Apr 2012
    Posts
    32
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Will add it, thanks for the input!

  11. #11
    Join Date
    Apr 2012
    Posts
    32
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Back again, I'm afraid the procedure is not working, it swaps to the magic tab but does not click the spell or move the mouse. Neither does it print DTM not found. Any pointers?

    Sorry if this is obvious to everyone else what the error is >.>

    Code:
     procedure ClickEnchant;
    begin
     if not (GetCurrentTab = tab_Magic) then
        if FindNormalRandoms then
          Exit
        else
           GameTab(tab_Magic);
      if(finddtm(Spellpos, x, y, MIX1, MIY1, MIX2, MIY2))then
      begin
        MMouse(x, y, 0, 0);
        if WaitUpText('Enchant Crossbow Bolt', 500 + Random(500)) then  //Wait up text is a lot better incase RS / your computer lags...
          ClickMouse2(mouse_Left)   //You don't want more randomness after the mouse has stopped moving...
          else
            writeln ('Could not find Enchant DTM');
      end;
    
    end;

  12. #12
    Join Date
    Jan 2008
    Location
    C:\
    Posts
    1,483
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

    Default

    I fixed your standards, you were missing a few semi-colons and I think the if then statements were funky. Could very well have been the problem:

    Simba Code:
    procedure ClickEnchant;
    begin
      if not (GetCurrentTab = tab_Magic) then
      begin
        if FindNormalRandoms then Exit;
        else GameTab(tab_Magic);
      end;
      if(FindDTM(Spellpos, x, y, MIX1, MIY1, MIX2, MIY2))then
      begin
        MMouse(x, y, 3, 3);
        if WaitUpText('Enchant Crossbow Bolt', 500 + Random(500)) then
          ClickMouse2(mouse_Left);
        else Writeln ('Could not find Enchant DTM');
      end;
    end;

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

    Default

    See if this works:
    Simba Code:
    procedure ClickEnchant;
    var
      spellpos, x, y: Integer;
    begin
      if FindNormalRandoms then Exit;

      if not (GetCurrentTab = tab_Magic) then
        GameTab(tab_Magic);

      if (finddtm(Spellpos, x, y, MIX1, MIY1, MIX2, MIY2)) then
      begin
        MMouse(x, y, 3, 3);
        if WaitUpTextMulti(['ncha', 'rossb'], 1000 + Random(500)) then
          ClickMouse2(mouse_Left)
        else
          Writeln ('Could not find Enchant DTM');
      end;
    end;

    EDIT: 'd by Runaway

  14. #14
    Join Date
    Apr 2012
    Posts
    32
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Tried both variants, and now the script swaps from spellbook to inventory. Any clues?


    Perhaps it would be easier if I posted the code in its entirety?

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

    Default

    Simba Code:
    procedure ClickEnchant;
    var
      spellpos, x, y: Integer;
    begin
      if FindNormalRandoms then Exit;
      if not (GetCurrentTab = tab_Magic) then
        GameTab(tab_Magic);
      if (finddtm(Spellpos, x, y, MIX1, MIY1, MIX2, MIY2)) then
      begin
        MMouse(x, y, 3, 3);
        if WaitUpTextMulti(['ncha', 'rossb'], 1000 + Random(500)) then
          ClickMouse2(mouse_Left)
      end else
      Writeln('Couldnt find DTM');
    end;

    Try that instead...it should now say it couldn't find DTM if it doesn't find it. You had the else in the wrong place.

  16. #16
    Join Date
    Apr 2012
    Posts
    32
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by TotalKillz View Post
    Simba Code:
    procedure ClickEnchant;
    var
      spellpos, x, y: Integer;
    begin
      if FindNormalRandoms then Exit;
      if not (GetCurrentTab = tab_Magic) then
        GameTab(tab_Magic);
      if (finddtm(Spellpos, x, y, MIX1, MIY1, MIX2, MIY2)) then
      begin
        MMouse(x, y, 3, 3);
        if WaitUpTextMulti(['ncha', 'rossb'], 1000 + Random(500)) then
          ClickMouse2(mouse_Left)
      end else
      Writeln('Couldnt find DTM');
    end;

    Try that instead...it should now say it couldn't find DTM if it doesn't find it. You had the else in the wrong place.
    Ahhh, there we go. It's a problem on my side with the DTM

    Cheers for the help everyone, I'll get back to it!

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
  •