Results 1 to 7 of 7

Thread: Curse Script Help

  1. #1
    Join Date
    Jul 2017
    Posts
    21
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default Curse Script Help

    Hey guys,

    I'm tackling a lot here for only scripting a few days or so, but I think I've done pretty well considering. The following script is something I have been working on for a few hours or so, and I'm just not really sure how to make a DTM target a spell. I figured out how to make it work for items pretty easily but spells are something I don't know how to tackle. I looked at flights AeroMagic pro to try to get help but the code is simply to complicated for me to understand, any help would be appreciated!

    Simba Code:
    program CurseSpell;
    //{$DEFINE SMART}
    {$DEFINE WALKER}
    {$i AeroLib/AeroLib.Simba}

    Const

      P_USERNAME  ='';
      P_PASSWORD  ='';
      P_NICKNAME  ='';
      P_PIN       ='';
      P_MEMBER    = False;
    type

    Scriptstate = (Curses, Monks);

    var

    MonkOfZamorak: TMSObject;
    pnt: Tpoint;
    MAGICM: Integer;
    CurrentTask: Scriptstate;

    procedure declarePlayer();
    begin
      Me.Name      := P_USERNAME;
      Me.Pass      := P_PASSWORD;
      Me.Pin       := P_PIN;
      Me.Nick      := P_NICKNAME;
      Me.Member    := P_MEMBER;
      Me.Active    := True;
    end;


    procedure Antiban

    begin
      case random(250) of
        0..2: begin
                WriteLn('Antiban: Hovering Random Skill');
                hoverSkill(SKILL_MAGIC, false);
              end;
        6..8: begin
                WriteLn('Antiban: Examining random item');
                examineInv();
              end;
        9..11: begin
                WriteLn('Antiban: Random Mouse Movement');
                humanRandomMouse();
               end;
       12..21: begin
                WriteLn('Antiabn: Waiting Random Time');
                wait(randomrange(4000,21000));
               end;

      end;
    end;


    procedure Magics

    begin
      Antiban();
      GameTab(TAB_MAGIC);
      MagicM := DTMFromString('mFQEAAHic42VgYOAAYkEg5gViLiBmZ0AAJiBmA2IBIBYCYm4gZgViTiDmh4oJQzFMjgmqlxlqNh9U7Uq2t0CSkURMOiDVBgxbAP/lAr4=');
      FreeDTM(MAGICM);
      CurrentTask := Curses;
      if MagicM.interact(MOUSE_LEFT) then
        writeln('Curse you');
    end;

    Procedure Target

    begin

      MonkOfZamorak.create('Monk of Zamorak', ['Monk', 'Zamorak'], [createcol(388365,0.10,20,0.96)], 50,0,0,0);
      CurrentTask := Monks;
      if MonkOfZamorak.find(pnt) then
        FastClick(Mouse_Left);
      Antiban();

    end;

    Procedure MainLoop;
    begin
      if not isLoggedin Then
        TerminateScript;
      case CurrentTask of
        Curses: Magics();
        Monks: Target();
      end;
    end;

    begin

      initAL;
      Magics;
      Target;
      repeat
        MainLoop();
      Until(False);

    end.

  2. #2
    Join Date
    Oct 2011
    Location
    England
    Posts
    401
    Mentioned
    10 Post(s)
    Quoted
    176 Post(s)

    Default

    @jokerface25

    An easier way to do it (albeit alternative) would be to use a TBox, perhaps the function gaussMouseBox?

    Simba Code:
    GaussMouseBox(x1, y1, x2, y2, Mouse_Move);

    you can get the co-ords of where the spell is, just make sure that you have a check that makes sure that the magic tab is open.

    I don't know if
    Simba Code:
    GameTab(TAB_MAGIC);
    does it so you'll have to check the function.

    Also, I'd personally make add to the antiban another case for
    Simba Code:
    MMouseOffClient('random');
    since it looks like you're multitasking.

    Hope this helps
    Yer a wizard, 'oopi

  3. #3
    Join Date
    Jan 2012
    Location
    Sydney, Australia
    Posts
    877
    Mentioned
    12 Post(s)
    Quoted
    368 Post(s)

    Default

    Hi mate.

    Is certainly a good attempt at the script.

    Have some feedback for you

    Flight added a magic include that I wrote to Aerolib a while back. You can find it in ..Simba\Includes\AeroLib\core\gametabs\magic.simba

    This include has all of the current spells listed for standard, lunar and ancient spell books.

    You can use it like so:

    Simba Code:
    procedure SelectSpell;
    begin
      if not IsSpellSelected then
        if CastSpell('Curse') then
          writeln('We have now selected the spell');
    end;

    This will check to see if we already have a spell selected, and if not, will select 'Curse' from the spell book.

    Another way to do it, is to use the include to get the spellbox and then use your own mouse functions to click on it, like so:

    Simba Code:
    function BoxMidPoint(Box:TBox):tpoint;
    begin
      Result.x := Round((Box.x2 - Box.X1) / 2);
      Result.y := Round((Box.y2 - Box.y1) / 2);
    end;

    procedure SelectSpell;
    begin
      if not IsSpellSelected then
      begin
        MissMouse(BoxMidPoint(getSpellBox('Curse')), 2, 2);
        FastClick(MOUSE_LEFT);
        writeln('Moved our mouse to the spell and selected it.');
      end;
    end;

    The first function BoxMidPoint is to simply get the mid point of a TBox. There is probably a simpler way to do this but I thought I would make my own

    The procedure SelectSpell will check to see if a spell is selected, and if not, use the MissMouse function to select the spell, using the co-ordinates it got from the GetSpellBox function and the BoxMidPoint function.

    Also, for future reference, you are loading your DTM and then immediately freeing it, before trying to call it with .interact on a type that does not support that function.

    A better way to do it would have been to declare MagicM as a TItem and then declared its DTM at the start of your script
    Simba Code:
    MagicM.DTM := DTMFromString('BlahBlahBlah');
    The only issue is this will no work with spells, as the TItem type is used exclusively with inventory (and sometimes bank).

    If you wanted to create a DTM for the spell, you could declare if as you have, by setting the type for MagicM as an integer, and declaring the DTM at the start of your script (not every loop).

    You could then use a build in function to find the DTM on the magic tab:

    Simba Code:
    program new;
    {$i AeroLib/AeroLib.Simba}

    var
      MagicM:integer;

    function FindCurseSpell:boolean;
    var
      x, y:integer;
    begin
      if GameTab(TAB_MAGIC) then
        if FindDTM(MagicM, x, y, MIX1, MIY1, MIX2, MIY2) then
        begin
          MissMouse(Point(x, y), 2, 2);
          exit(true);
        end;
    end;

    begin
      InitAL;
      MagicM := DTMFromString('BlahBlahBlah');
      FindCurseSpell;
      FreeDTM(MagicM);
    end.

    I will post more feedback when I am home from work.

  4. #4
    Join Date
    Jul 2017
    Posts
    21
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by anth_ View Post
    @jokerface25

    An easier way to do it (albeit alternative) would be to use a TBox, perhaps the function gaussMouseBox?

    Simba Code:
    GaussMouseBox(x1, y1, x2, y2, Mouse_Move);

    you can get the co-ords of where the spell is, just make sure that you have a check that makes sure that the magic tab is open.

    I don't know if
    Simba Code:
    GameTab(TAB_MAGIC);
    does it so you'll have to check the function.

    Also, I'd personally make add to the antiban another case for
    Simba Code:
    MMouseOffClient('random');
    since it looks like you're multitasking.

    Hope this helps
    Sorry for just getting back to you on this! Have'nt really had much time to try this out yet but im going to get back to work on it soon

  5. #5
    Join Date
    Jul 2017
    Posts
    21
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by Dan the man View Post
    Hi mate.

    Is certainly a good attempt at the script.

    Have some feedback for you

    Flight added a magic include that I wrote to Aerolib a while back. You can find it in ..Simba\Includes\AeroLib\core\gametabs\magic.simba

    This include has all of the current spells listed for standard, lunar and ancient spell books.

    You can use it like so:

    Simba Code:
    procedure SelectSpell;
    begin
      if not IsSpellSelected then
        if CastSpell('Curse') then
          writeln('We have now selected the spell');
    end;

    This will check to see if we already have a spell selected, and if not, will select 'Curse' from the spell book.

    Another way to do it, is to use the include to get the spellbox and then use your own mouse functions to click on it, like so:

    Simba Code:
    function BoxMidPoint(Box:TBox):tpoint;
    begin
      Result.x := Round((Box.x2 - Box.X1) / 2);
      Result.y := Round((Box.y2 - Box.y1) / 2);
    end;

    procedure SelectSpell;
    begin
      if not IsSpellSelected then
      begin
        MissMouse(BoxMidPoint(getSpellBox('Curse')), 2, 2);
        FastClick(MOUSE_LEFT);
        writeln('Moved our mouse to the spell and selected it.');
      end;
    end;

    The first function BoxMidPoint is to simply get the mid point of a TBox. There is probably a simpler way to do this but I thought I would make my own

    The procedure SelectSpell will check to see if a spell is selected, and if not, use the MissMouse function to select the spell, using the co-ordinates it got from the GetSpellBox function and the BoxMidPoint function.

    Also, for future reference, you are loading your DTM and then immediately freeing it, before trying to call it with .interact on a type that does not support that function.

    A better way to do it would have been to declare MagicM as a TItem and then declared its DTM at the start of your script
    Simba Code:
    MagicM.DTM := DTMFromString('BlahBlahBlah');
    The only issue is this will no work with spells, as the TItem type is used exclusively with inventory (and sometimes bank).

    If you wanted to create a DTM for the spell, you could declare if as you have, by setting the type for MagicM as an integer, and declaring the DTM at the start of your script (not every loop).

    You could then use a build in function to find the DTM on the magic tab:

    Simba Code:
    program new;
    {$i AeroLib/AeroLib.Simba}

    var
      MagicM:integer;

    function FindCurseSpell:boolean;
    var
      x, y:integer;
    begin
      if GameTab(TAB_MAGIC) then
        if FindDTM(MagicM, x, y, MIX1, MIY1, MIX2, MIY2) then
        begin
          MissMouse(Point(x, y), 2, 2);
          exit(true);
        end;
    end;

    begin
      InitAL;
      MagicM := DTMFromString('BlahBlahBlah');
      FindCurseSpell;
      FreeDTM(MagicM);
    end.

    I will post more feedback when I am home from work.
    Dan your super helpful and I appreciate it, I havnt had a chance to work on this yet but I probably will do tomorrow and I'll let you know how it works! Thanks

  6. #6
    Join Date
    Jan 2012
    Location
    Sydney, Australia
    Posts
    877
    Mentioned
    12 Post(s)
    Quoted
    368 Post(s)

  7. #7
    Join Date
    Aug 2017
    Location
    Alberta, CA
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    These guys already covered pretty much everything but personally if you want to keep it simple I've found that using static chords works alright for stuff like spell selection etc, but I mainly do that for my own scripts because I'm to lazy to dig through all the fancy functions aero has to offer

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
  •