Results 1 to 9 of 9

Thread: [OSRS][Aerolib] Magic Include

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

    Default [OSRS][Aerolib] Magic Include

    Hi all,

    I was bored and couldn't think of any scripts to write so I decided to make a magic include because we don't have one as yet (I hope!) for Aerolib.

    The include supports all current spells in Lunar, normal and ancinet spell books.

    I will look at adding more functions to it later.

    Hope this helps a few people

    Simba Code:
    {
    =====
    Magic
    =====
    }


    function getSpellBox(Name: String): Tbox;
    begin
      case Capitalize(LowerCase(Name)) of
        //Normal Spell Book
        'Lumbridge Home Teleport':      Result := toBox(559, 220, 582, 243);
        'Wind Strike':                  Result := toBox(583, 220, 606, 243);
        'Confuse':                      Result := toBox(607, 220, 630, 243);
        'Enchant Crossbow Bolt':        Result := toBox(631, 220, 654, 243);
        'Water Strike':                 Result := toBox(655, 220, 678, 243);
        'Lvl-1 Enchant':                Result := toBox(679, 220, 702, 243);
        'Earth Strike':                 Result := toBox(703, 220, 726, 243);
        'Weaken':                       Result := toBox(559, 244, 582, 267);
        'Fire Strike':                  Result := toBox(583, 244, 606, 267);
        'Bones to Bananas':             Result := toBox(607, 244, 630, 267);
        'Wind Bolt':                    Result := toBox(631, 244, 654, 267);
        'Curse':                        Result := toBox(655, 244, 678, 267);
        'Bind':                         Result := toBox(679, 244, 702, 267);
        'Low Level Alchemy':            Result := toBox(703, 244, 726, 267);
        'Water Bolt':                   Result := toBox(559, 268, 582, 291);
        'Varrock Teleport':             Result := toBox(583, 268, 606, 291);
        'Lvl-2 Enchant':                Result := toBox(607, 268, 630, 291);
        'Earth Bolt':                   Result := toBox(631, 268, 654, 291);
        'Lumbridge Teleport':           Result := toBox(655, 268, 678, 291);
        'Telekenetic Grab':             Result := toBox(679, 268, 702, 291);
        'Fire Bolt':                    Result := toBox(703, 268, 726, 291);
        'Falador Teleport':             Result := toBox(559, 292, 582, 315);
        'Crumble Undead':               Result := toBox(583, 292, 606, 315);
        'Teleport to House':            Result := toBox(607, 292, 630, 315);
        'Wind Blast':                   Result := toBox(631, 292, 654, 315);
        'Superhead Item':               Result := toBox(655, 292, 678, 315);
        'Camelot Teleport':             Result := toBox(679, 292, 702, 315);
        'Water Blast':                  Result := toBox(703, 292, 726, 315);
        'Lvl-3 Enchant':                Result := toBox(559, 316, 582, 339);
        'Iban Blast':                   Result := toBox(583, 316, 606, 339);
        'Snare':                        Result := toBox(607, 316, 630, 339);
        'Magic Dart':                   Result := toBox(631, 316, 654, 339);
        'Ardougne Teleport':            Result := toBox(655, 316, 678, 339);
        'Earth Blast':                  Result := toBox(679, 316, 702, 339);
        'High Level Alchemy':           Result := toBox(703, 316, 726, 339);
        'Charge Water Orb':             Result := toBox(559, 340, 582, 363);
        'Lvl-4 Enchant':                Result := toBox(583, 340, 606, 363);
        'Watchtower Teleport':          Result := toBox(607, 340, 630, 363);
        'Fire Blast':                   Result := toBox(631, 340, 654, 363);
        'Charge Earth Orb':             Result := toBox(655, 340, 678, 363);
        'Bones to Peaches':             Result := toBox(679, 340, 702, 363);
        'Saradomin Strike':             Result := toBox(703, 340, 726, 363);
        'Claws of Guthix':              Result := toBox(559, 364, 582, 387);
        'Flames of Zamorak':            Result := toBox(583, 364, 606, 387);
        'Trollheim Teleport':           Result := toBox(607, 364, 630, 387);
        'Wind Wave':                    Result := toBox(631, 364, 654, 387);
        'Charge Fire Orb':              Result := toBox(655, 364, 678, 387);
        'Teleport to Ape Atoll':        Result := toBox(679, 364, 702, 387);
        'Water Wave':                   Result := toBox(703, 364, 726, 387);
        'Charge Air Orb':               Result := toBox(559, 388, 582, 411);
        'Vulnerability':                Result := toBox(583, 388, 606, 411);
        'Lvl-5 Enchant':                Result := toBox(607, 388, 630, 411);
        'Teleport to Kourend':          Result := toBox(631, 388, 654, 411);
        'Earth Wave':                   Result := toBox(655, 388, 678, 411);
        'Enfeeble':                     Result := toBox(679, 388, 702, 411);
        'Teleother Lumbridge':          Result := toBox(703, 388, 726, 411);
        'Fire Wave':                    Result := toBox(559, 412, 582, 435);
        'Entangle':                     Result := toBox(583, 412, 606, 435);
        'Stun':                         Result := toBox(607, 412, 630, 435);
        'Charge':                       Result := toBox(631, 412, 654, 435);
        'Teleother Falador':            Result := toBox(655, 412, 678, 435);
        'Tele Block':                   Result := toBox(679, 412, 702, 435);
        'Teleport to Bounty Target':    Result := toBox(703, 412, 726, 435);
        'Lvl-6 Enchant':                Result := toBox(559, 436, 582, 459);
        'Teleother Camelot':            Result := toBox(583, 436, 606, 459);
        'Lvl-7 Enchant':                Result := toBox(607, 436, 630, 459);
        //Lunar SpellBook
        'Lunar Home Teleport':          Result := toBox(555, 213, 578, 236);
        'Bake Pie':                     Result := toBox(585, 213, 608, 236);
        'Cure Plant':                   Result := toBox(615, 213, 638, 236);
        'Monster Examine':              Result := toBox(645, 213, 668, 236);
        'NPC Contact':                  Result := toBox(675, 213, 698, 236);
        'Cure Other':                   Result := toBox(705, 213, 728, 236);
        'Humidify':                     Result := toBox(555, 242, 578, 265);
        'Moonclan Teleport':            Result := toBox(585, 242, 608, 265);
        'Tele Group Moonclan':          Result := toBox(615, 242, 638, 265);
        'Cure Me':                      Result := toBox(645, 242, 668, 265);
        'Hunter Kit':                   Result := toBox(675, 242, 698, 265);
        'Waterbirth Teleport':          Result := toBox(705, 242, 728, 265);
        'Tele Group Waterbirth':        Result := toBox(555, 271, 578, 294);
        'Cure Group':                   Result := toBox(585, 271, 608, 294);
        'Stat Spy':                     Result := toBox(615, 271, 638, 294);
        'Barbarian Teleport':           Result := toBox(645, 271, 668, 294);
        'Tele Group Barbarian':         Result := toBox(675, 271, 698, 294);
        'Superglass Make':              Result := toBox(705, 271, 728, 294);
        'Tan Leather':                  Result := toBox(555, 300, 578, 323);
        'Khazard Teleport':             Result := toBox(585, 300, 608, 323);
        'Tele Group Khazard':           Result := toBox(615, 300, 638, 323);
        'Dream':                        Result := toBox(645, 300, 668, 323);
        'String Jewellery':             Result := toBox(675, 300, 698, 323);
        'Stat Restore Pot Share':       Result := toBox(705, 300, 728, 323);
        'Magic Imbue':                  Result := toBox(555, 329, 578, 352);
        'Fertile Soil':                 Result := toBox(585, 329, 608, 352);
        'Boost Potion Share':           Result := toBox(615, 329, 638, 352);
        'Fishing Guild Teleport':       Result := toBox(645, 329, 668, 352);
        'Teleport to Bounty Target':    Result := toBox(675, 329, 698, 352);
        'Tele Group Fishing Guild':     Result := toBox(705, 329, 728, 352);
        'Plank Make':                   Result := toBox(555, 358, 578, 381);
        'Catherby Teleport':            Result := toBox(585, 358, 608, 381);
        'Tele Group Catherby':          Result := toBox(615, 358, 638, 381);
        'Recharge Dragonstone':         Result := toBox(645, 358, 668, 381);
        'Ice Plateau Teleport':         Result := toBox(675, 358, 698, 381);
        'Tele Group Ice Plateau':       Result := toBox(705, 358, 728, 381);
        'Energy Transfer':              Result := toBox(555, 387, 578, 410);
        'Heal Other':                   Result := toBox(585, 387, 608, 410);
        'Vengeance Other':              Result := toBox(615, 387, 638, 410);
        'Vengeance':                    Result := toBox(645, 387, 668, 410);
        'Heal Group':                   Result := toBox(675, 387, 698, 410);
        'Spellbook Swap':               Result := toBox(705, 387, 728, 410);
        'Geomancy':                     Result := toBox(555, 416, 578, 439);
        'Spin Flax':                    Result := toBox(585, 416, 608, 439);
        //Ancient spells
        'Edgeville Home Teleport':      Result := toBox(566, 213, 589, 236);
        'Smoke Rush':                   Result := toBox(611, 213, 634, 236);
        'Shadow Rush':                  Result := toBox(657, 213, 680, 236);
        'Paddewwa Teleport':            Result := toBox(698, 213, 721, 236);
        'Blood Rush':                   Result := toBox(566, 241, 589, 264);
        'Ice Rush':                     Result := toBox(611, 241, 634, 264);
        'Senntisten Teleport':          Result := toBox(657, 241, 680, 264);
        'Smoke Burst':                  Result := toBox(698, 241, 721, 264);
        'Shadow Burst':                 Result := toBox(566, 269, 589, 292);
        'Kharyrll Teleport':            Result := toBox(611, 269, 634, 292);
        'Blood Burst':                  Result := toBox(657, 269, 680, 292);
        'Ice Burst':                    Result := toBox(698, 269, 721, 292);
        'Lassar Teleport':              Result := toBox(566, 297, 589, 320);
        'Smoke Blitz':                  Result := toBox(611, 297, 634, 320);
        'Shadow Blitz':                 Result := toBox(657, 297, 680, 320);
        'Dareeyak Teleport':            Result := toBox(698, 297, 721, 320);
        'Blood Blitz':                  Result := toBox(566, 325, 589, 348);
        'Ice Blitz':                    Result := toBox(611, 325, 634, 348);
        'Carrallangar Teleport':        Result := toBox(657, 325, 680, 348);
        'Teleport to Bounty Target':    Result := toBox(698, 325, 721, 348);
        'Smoke Barrage':                Result := toBox(566, 353, 589, 376);
        'Shadow Barrage':               Result := toBox(611, 353, 634, 376);
        'Annakarl Teleport':            Result := toBox(657, 353, 680, 376);
        'Blood Barrage':                Result := toBox(698, 353, 721, 376);
        'Ice Barrage':                  Result := toBox(566, 381, 589, 404);
        'Ghorrock Teleport':            Result := toBox(611, 381, 634, 404);
      end;
    end;

    {*
    isSpellSelected
    ~~~~~~~~~~~~

    .. code-block:: AeroLib

        isSpellSelected: Boolean;

    Returns true if the specified spell is selected.

    Example:

        if isSpellSelected then
          WriteLn('We currently have a spell clicked.');

    *}


    function isSpellSelected: boolean;
    var
      Color_SpellActive: TColEx;

    begin
      result := False
      Color_SpellActive.create(7829766, 25, 0.68, 0.42);
      if Color_SpellActive.FindIn(ToBox(40, 6, 108, 20)) then
        if waitUpTextMulti(['->', '>'], 500) then
          result := True
    end;

    {*
    CastSpell
    ~~~~~~~~~~~~

    .. code-block:: AeroLib

        CastSpell(SpellName: String): Boolean;

    Casts a spell with the designated name.

    Examples:

        if CastSpell('Smoke Burst') then
          WriteLn('We cast ' +SpellName);

        CastSpell('Smoke Burst');

    *}



    function CastSpell(SpellName: String): Boolean;
    var
      Box: Tbox;

    begin
      Result := False;
      if GameTab(TAB_MAGIC) then
      begin
        Box := getSpellBox(SpellName);
        Gaussmousebox(Box.X1, Box.Y1, Box.X2, Box.Y2, MOUSE_MOVE);
        if waitUpTextMulti([SpellName], 500) then
        begin
          FastClick(MOUSE_LEFT);
          Exit(True);
        end;
      warn('Spell missing. May be incorrect spell book.', WT_CORE);
      end;
    end;
    Last edited by Dan the man; 09-07-2016 at 04:25 AM.

  2. #2
    Join Date
    Mar 2013
    Posts
    1,010
    Mentioned
    35 Post(s)
    Quoted
    620 Post(s)

    Default

    What's the point in SpellBox? it's a totally unneeded wrapper and why use Variant for getSpellBox? Kinda pointless when it can only use a string currently.

    Edit: for isSpellSelected do "Result := False;" at the start of the func since it saves 3 lines and removes the need for the two elses
    Last edited by Harrier; 09-04-2016 at 03:03 PM.
    #slack4admin2016
    <slacky> I will build a wall
    <slacky> I will ban reflection and OGL hooking until we know what the hell is going on

  3. #3
    Join Date
    Aug 2016
    Location
    Kentucky
    Posts
    254
    Mentioned
    3 Post(s)
    Quoted
    96 Post(s)

    Default

    Great include. I really like this concept. It would be nice to have this in aerolib to use.

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

    Default

    Quote Originally Posted by Harrier View Post
    What's the point in SpellBox? it's a totally unneeded wrapper and why use Variant for getSpellBox? Kinda pointless when it can only use a string currently.

    Edit: for isSpellSelected do "Result := False;" at the start of the func since it saves 3 lines and removes the need for the two elses
    Adjusted accordingly. Cheers for the feedback.

  5. #5
    Join Date
    Mar 2013
    Posts
    1,010
    Mentioned
    35 Post(s)
    Quoted
    620 Post(s)

    Default

    Quote Originally Posted by Dan the man View Post
    Adjusted accordingly. Cheers for the feedback.
    and you can also just do Exit(True); instead of Result := True; Exit;
    #slack4admin2016
    <slacky> I will build a wall
    <slacky> I will ban reflection and OGL hooking until we know what the hell is going on

  6. #6
    Join Date
    Sep 2014
    Location
    C:\Simba\
    Posts
    565
    Mentioned
    9 Post(s)
    Quoted
    71 Post(s)

    Default

    Feel free to ask me any questions, I will do my best to answer them!

    Previously known as YouPee.

  7. #7
    Join Date
    Mar 2013
    Posts
    1,010
    Mentioned
    35 Post(s)
    Quoted
    620 Post(s)

    Default

    Quote Originally Posted by Joopi View Post
    Yes, lets look at a function which I wrote over a year ago in a unfinished script which I ripped SimbaExt out of without re-optimising the code and only uploaded it to github since people bugged me on IRC for an example script for SRL/SRL.
    #slack4admin2016
    <slacky> I will build a wall
    <slacky> I will ban reflection and OGL hooking until we know what the hell is going on

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

  9. #9
    Join Date
    Nov 2011
    Posts
    79
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default

    ooo this is cool. I have an idea for a script that I'll be putting together once I get more of the basics down...

    A little crumble the undead action

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
  •