Skip to content
Outlands Hub

Razor script

SUPER Auto Mage Attacker

by dennozz · 4367 lines
Download

Compatibility unverified

This community Razor script has not been tested in game by the Hub. Read its setup and client requirements before use.

Auto-mage attack 3.17.10

CombatMagic
SUPER Auto Mage Attacker.razor
1# This is an automated backup - check out https://outlands.uorazorscripts.com/script/da922f96-72cd-4f5b-92fe-e5604813ddfa for latest2# Automation by Jaseowns3## Script: SUPER Auto Mage Attacker4## Created by: dennozz#05#############################################6 7#Auto-mage attack 3.17.108 9#********** INFORMATION **********# 10 11# Made by @dennozz on discord. Feel free to msg me anytime for questions12 13# **If you like my work and wish to buy me a coffee: https://buymeacoffee.com/dennoz** #14 15# Inspired/learned by other scrips in https://outlands.uorazorscripts.com/16 17# This script will auto attacking using magery/necromancy spells. Script will auto heal and auto summon pets if needed.18# This script will work with full Mage Arcanes, Necro Mages, Mage Summoners.19 20#--- *!*!* SCRIPT IS UNDER DEVELOPMENT. *!*!*!* ---#21 22# !!! IMPORTANT !!! DISABLE: `Filter repeating system messages` ON RAZOR !!! # 23# !!! IMPORTANT !!! IF ENABLE NECRO ABILITIES IN SCRIPT MAKE SURE DO NOT CHECK MARK ON NECRO BAR  !!! # 24    25### Changes Log ###26 27# ** IF SCRIPT IS ATTACKING OR HEALING MAY EXPERIENCE ISSUE AFTER WORLD SAVING ** #28 29# Ver 3.17.10 Added option to ignore other players summoned, bonded and tamed creatures during auto-target (ignoreSummonedBondedTamed)30# Ver 3.17.9 Reset target variables on script start (fixes not attacking after switching from another script)31# Ver 3.17.8 Fixed magic reflect and reactive armor recast spam when spell is on cooldown32# Ver 3.17.7 Fixed infinite loop on target label correction33# Ver 3.17.6 Fixes to necromancy abilities casting bugs (poison targeting, summon loop flag reset, stuck ability loops)34# Ver 3.17.5 Minor fixes35# Ver 3.17.4 Added panacea ability for alchemy skill36# Ver 3.17.3 Fixed when meditation is set to 0, script was stopping when mana < 5037# Ver 3.17.2 Added arch protection and fixes to meditation use38# Ver 3.17 Added setting to auto trap pouches 39# Ver 3.15 Added ability to use explosion potions & fix minor bugs40# Ver 3.13 Fixes to followers and weapon ability41# Ver 3.12 Minor adjustments and changes to followers commands42# Ver 3.11.2 Fixes to weapon ability and followers commands43# Ver 3.11 Changes in summoning attack mechanics44# Ver 3.10.6 Minor fixes and changes45# Ver 3.10 Added Regs warning when missing any regs || Added variable to enable auto carve corpses46# Ver 3.09 Minor changes and fixes || Organization of variables. 47# Ver 3.08 Added ignore list. 48# Ver 3.07 Added a new auto target mode activating war mode to attack or reset the target selection49# Ver 3.06 Changes to the auto healing mechanic and variables50# Ver 3.05 Added variables to activate mini spells when mana below `X amount`51# Ver 3.04 Code restructure, add variable to break attacking and summon elemental if needed || added mindrot necro spell on regular casting52# Ver 3.00 Added auto-summoning and FIX on script stopping suddenly53# Ver.2.84 fixes and changes to the healing trigger mechanism54# Ver.2.77 fixes and changes to casting and targetting spells55# Ver.2.61 added spirit speak skill use56# Ver.2.60 fixes to manual targetting57# Ver.2.59 Set last target can be activated while fighting a mob to change targets 58 59### Changes Log ###60 61#********** SET YOUR SETTINGS **********#   62 63removelist animalsIgnoreList64createlist animalsIgnoreList65 66#--- Set Ignore Monsters ---#67#-- (add or remove animals) --#68 69pushlist animalsIgnoreList "a plover"70pushlist animalsIgnoreList "a sheep"71pushlist animalsIgnoreList "a frenzied ostard"72pushlist animalsIgnoreList "a tundra ostard"73pushlist animalsIgnoreList "a desert ostard"74pushlist animalsIgnoreList "a forest ostard"75pushlist animalsIgnoreList "a finch"76pushlist animalsIgnoreList "a sparrow"77pushlist animalsIgnoreList "a towhee"78pushlist animalsIgnoreList "a lapwing"79pushlist animalsIgnoreList "a silverback"80pushlist animalsIgnoreList "a giant frog"81pushlist animalsIgnoreList "a crow"82pushlist animalsIgnoreList "a woodpecker"83pushlist animalsIgnoreList "a horse"84pushlist animalsIgnoreList "a swift"85pushlist animalsIgnoreList "a skylark"86pushlist animalsIgnoreList "a corpser"87pushlist animalsIgnoreList "a hawk"88pushlist animalsIgnoreList "a chickadee"89pushlist animalsIgnoreList "a cat"90pushlist animalsIgnoreList "a dog"91pushlist animalsIgnoreList "a black bear"92pushlist animalsIgnoreList "a brown bear"93pushlist animalsIgnoreList "a grizzly bear"94pushlist animalsIgnoreList "a bull"95pushlist animalsIgnoreList "a cow"96pushlist animalsIgnoreList "a chicken"97pushlist animalsIgnoreList "a bird"98pushlist animalsIgnoreList "an eagle"99pushlist animalsIgnoreList "an elk"100pushlist animalsIgnoreList "a great hart"101pushlist animalsIgnoreList "a kingfisher"102pushlist animalsIgnoreList "a hind"103pushlist animalsIgnoreList "a llama"104pushlist animalsIgnoreList "a sand crab"105pushlist animalsIgnoreList "a pig"106pushlist animalsIgnoreList "a polar bear"107pushlist animalsIgnoreList "a walrus"108pushlist animalsIgnoreList "a cougar"109pushlist animalsIgnoreList "a wolf"110pushlist animalsIgnoreList "a goat"111pushlist animalsIgnoreList "a raven"112pushlist animalsIgnoreList "a magpie"113pushlist animalsIgnoreList "a warbler"114pushlist animalsIgnoreList "a tern"115pushlist animalsIgnoreList "a nightingale"116pushlist animalsIgnoreList "a colossal frog"117pushlist animalsIgnoreList "a wren"118 119pushlist animalsIgnoreList "red rubble"120pushlist animalsIgnoreList "a spirit wolf"121pushlist animalsIgnoreList "a spirit sabertus"122pushlist animalsIgnoreList "a death asp"123pushlist animalsIgnoreList "a death adder"124 125#--- Set Target Mode ---#126 127# 0 - Auto Target Selection 128# 1 - Auto Target Selection in warmode only (while warmode = on then will auto attack)129# 2 - Manual selection using hotkey `set last target`130 131@setvar! targetSelectionMode 0132@setvar! switchTargetWhenToggleWarMode 1133 134#--- Ignore Summoned / Bonded / Tamed ---#135 136# 1 - Ignore other players grey summons and pets (skips labels containing summoned, bonded, tame)137# 0 - Attack them like any other target138 139@setvar! ignoreSummonedBondedTamed 1140 141#--- Set Auto Trap Pouches ---#142 143@setvar! autoTrapPouches 1144 145#--- Set Mage attack spells ---#146 147@setvar! minimumManaToCastAnyDamageSpells 11148 149@setvar! castMagicArrow 1150@setvar! castHarm 1151@setvar! castFireball 1152@setvar! castLightning 1153 154@setvar! activateMagicArrowWhenManaBelow 200155@setvar! activateHarmWhenManaBelow 200156@setvar! activateFireballWhenManaBelow 200157@setvar! activateLightningWhenManaBelow 200158 159#--- Set Mage attack cooldowns ---#160 161@setvar! magicArrowCD 16000162@setvar! harmCD 16000163@setvar! fireballCD 16000164@setvar! lightningCD 16000165 166#--- Big Spells prioritize order ---#167 168@setvar! castFlamestrike 0169@setvar! castEnergyBolt 0170@setvar! castExplosion 0171@setvar! castMindblast 1172 173@setvar! minimumManaToCastBigSpellsOnly 11174 175#--- Set Mage auto heals ---#176 177@setvar! miniHeal 1178@setvar! greaterHeal 1179@setvar! cureSpell 1180 181#--- Set Mage Buffs ---#182 183@setvar! magicReflect 1184@setvar! blessSpell 1185@setvar! armorReflect 1186@setvar! protectionSpell 1187@setvar! archProtectionSpell 0188 189@setvar! miniumManaToBuff 50190 191#--- Set DeBuff Spells ---#192 193@setvar! castCurse 1194@setvar! castManaDrain 1195 196#--- Set Damage Necromancy Spells ---#197 198@setvar! NecroMindRot 1199@setvar! NecroEvilOmen 1200@setvar! NecroCorpseSkin 1201@setvar! NecroStrangle 0202 203@setvar! minManaToUseDamageBuffNecroSpells 50204 205#--- Poison ---#206 207@setvar! castPoison 1208 209#- Poison Level210# 0 - Greater or lesser 211# 1 - Deadly 212# 2 - Lethal213@setvar! poisonLevel 0214 215#- Poison Strike -#216 217# 0 - Disabled218# 1 - Apply in 1 ticks left or less219# 2 - Apply in 2 ticks left or less220# 3 - Apply in 3 ticks left or less221# 4 - Apply in 4 ticks left or less222# 5 - Apply in 5 ticks left or less223# 6 - Apply in 6 ticks left or less224# 7 - Apply in 7 ticks left or less225# 8 - Apply in 8 ticks left or less226# 9 - Apply in 9 ticks left or less227# 10 - Apply in 10 ticks left or less228 229@setvar! NecroPoisonStrike 6230 231#--- Set Follower Attack Mode ---#232 233# 0 - Say `All Kill`234# 1 - Say `All Patrol`235 236@setvar! followerAttackmode 0237 238#--- Set Elementals Count ---#239 240@setvar! earthElementals 2241@setvar! waterElementals 0242@setvar! airElementals 0243@setvar! fireElementals 0244@setvar! summonDaemons 0245@setvar! summonCreature 0246 247@setvar! breakCastingWhenFollowersBelow 4248 249#--- Set Followers Necromancy Spells ---#250 251@setvar! NecroVengefulSpirit 0252@setvar! NecroBloodOath 0253@setvar! NecroWither 0254 255#--- Set mushrooms ---#256 257@setvar! mushroomCount 3258@setvar! eatMushWhenManaLowerThan 50259@setvar! mushroomTimerCD 60000260 261#--- Set potions ---#262 263@setvar! drinkStr 0264@setvar! strengthLowerThan 120265 266@setvar! drinkAgility 0267@setvar! drinkMagicResist 0268@setvar! drinkHeal 1269@setvar! drinkCure 1270 271@setvar! drinkRefresh 1272@setvar! drinkWhenMissingStamina 15273 274@setvar! drinkExplosionPotion 0275@setvar! prioritizeExplosionWhenTimerAbove 14500276 277@setvar! panaceaAbility 0278 279#--- Auto healing hp diffs ---#280#--- All variables refer to hit points differences ---#281#--- When below certain hit points it will trigger ---#282 283@setvar! activateAutoHealDiff 30284 285@setvar! startCastMiniHealDiff 50286@setvar! endCastMiniHealDiff 200287 288@setvar! castEmergencyMiniHealDiff 50289 290@setvar! startCastGreaterHealDiff 30291@setvar! endCastGreaterHealDiff 200292 293@setvar! drinkHealPotDiff 30294 295@setvar! interruptCastingDiff 40296 297#--- Meditation ---#298 299@setvar! useMeditationSkill 1300@setvar! meditateWhenManaBelow 44301@setvar! meditateUntilManaReach 75302 303@setvar! lowManaWarningMessageWhenBelow 40304 305#--- Arcane Weapon Ability ---#306# 1 - Seeking307# 2 - Leyline308# 3 - Soulfire309 310@setvar! useWeaponAbility 0311@setvar useAbilityWhenManaLowerThan 60312 313#--- Drop Gold When Overweight ---#314 315@setvar! amountOfGoldToDrop 500316 317#--- Carve Corpse ---#318 319@setvar! autoCarveNearestCorpse 1320 321#********** DO NOT EDIT FROM HERE UNLESS YOU KNOW HOW TO SCRIPT **********# 322 323clearsysmsg324 325@setvar! isExplosionPotReady 0 326 327@setvar! missingRegs 0328 329@setvar! castStrike 0 330@setvar! repeatCastingPoison 0 331 332@setvar! castingBigSpellsEnabled 0333 334if castExplosion = 1 or castFlamestrike = 1 or castEnergyBolt = 1 or castMindblast = 1335    @setvar! castingBigSpellsEnabled 1    336endif337 338@setvar! currentTarget 0339@setvar! foundTarget 0340@setvar! tempTarget 0341 342@setvar! necroGump 622436516343@setvar! unholyPoints 0344 345if castExplosion = 1346    @setvar! bigSpellCounter 2347elseif castEnergyBolt = 1 348    @setvar! bigSpellCounter 1349endif350 351if not varexist previousTarget352    @setvar! previousTarget 0353endif354 355@setvar! maxwaittimeinms 650356 357# Give up correcting a target label after this many ms (stops infinite loop)358@setvar! labelFixTimeoutCD 2000359 360if not timerexists mushroomTimer361    settimer mushroomTimer mushroomTimerCD362endif363 364@setvar! curseCD 60000365@setvar! manaDrainCD 60000366 367if not timerexists curseTimer368    settimer curseTimer curseCD369endif370 371if not timerexists manaDrainTimer372    settimer manaDrainTimer manaDrainCD373endif374 375#--- Necro spells timers ---#376 377@setvar! necroMarginErrorCD 28000378 379# Give up on a necro ability after this many ms with no success/cooldown response (stops infinite loop)380@setvar! necroAbilityTimeoutCD 5000381 382@setvar! vengefulSpiritCD 30000383 384if not timerexists vengefulSpiritTimer385    settimer vengefulSpiritTimer vengefulSpiritCD386endif387 388@setvar! bloodOathCD 30000389 390if not timerexists bloodOathTimer391    settimer bloodOathTimer bloodOathCD392endif393 394@setvar! witherCD 30000395 396if not timerexists witherTimer397    settimer witherTimer witherCD398endif399 400@setvar! evilOmenCD 30000401 402if not timerexists evilOmenTimer403    settimer evilOmenTimer evilOmenCD404endif405 406@setvar! corpseSkinCD 30000407 408if not timerexists corpseSkinTimer409    settimer corpseSkinTimer corpseSkinCD410endif411 412@setvar! strangleCD 30000413 414if not timerexists strangleTimer415    settimer strangleTimer strangleCD416endif417 418@setvar! mindRotCD 30000419 420if not timerexists mindRotTimer421    settimer mindRotTimer mindRotCD422endif423 424@setvar! poisonStrikeCD 30000425 426if not timerexists poisonStrikeTimer427    settimer poisonStrikeTimer poisonStrikeCD428endif429 430#--- Script msgs timers ---#431 432if not timerexists explosionPotionTimer 433    settimer explosionPotionTimer 0434endif435 436@setvar! overweightMessageCD 3000437settimer overweightMessageTimer overweightMessageCD438 439@setvar! noTargetMessageCD 3000440settimer noTargetMessageTimer noTargetMessageCD441 442@setvar! searchingTargetMessageCD 3000443settimer searchingMessageTimer searchingTargetMessageCD444 445@setvar! poisonLabelCD 5000446settimer poisonLabelTimer poisonLabelCD447 448@setvar! targetSelectCD 3000449settimer targetSelectTimer targetSelectCD450 451@setvar! noRegsMessageCD 4000452settimer noRegsMessageTimer noRegsMessageCD453 454@setvar! allGuardCD 3000455settimer allGuardTimer allGuardCD456 457@setvar! foodMessageCD 3333458settimer foodMessageTimer foodMessageCD459 460#--- Summons timers ---#461 462@setvar! summonMsgCD 1500463settimer summonMsgTimer summonMsgCD464 465@setvar! manaMsgCD 2500466settimer manaMsgTimer manaMsgCD467 468#--- Resources timers ---#469 470@setvar! pouchMessageCD 2000471settimer pouchMessageTimer pouchMessageCD472 473@setvar! aidsMessageCD 2500474settimer aidsMessageTimer aidsMessageCD475 476@setvar! whiteMessageCD 3000477settimer whiteMessageTimer whiteMessageCD478 479@setvar! blueMessageCD 3500480settimer blueMessageTimer blueMessageCD481 482@setvar! blackMessageCD 4000483settimer blackMessageTimer blackMessageCD484 485@setvar! orangeMessageCD 4500486settimer orangeMessageTimer orangeMessageCD487 488@setvar! yellowMessageCD 5000489settimer yellowMessageTimer yellowMessageCD490 491@setvar! redMessageCD 5500492settimer redMessageTimer redMessageCD493 494#--- Magery buffs timers ---#495 496@setvar! magicReflectCD 15000497settimer magicReflectTimer magicReflectCD498 499@setvar! armorReflectCD 15000500settimer armorReflectTimer armorReflectCD501 502@setvar! protectionCD 15000503settimer protectionTimer protectionCD504 505@setvar! manaMessageCD 2222506settimer manaMessageTimer manaMessageCD507 508#--- Skills timers ---#509 510@setvar! spiritSpeakCD 60000511if not timerexists spiritSpeakTimer512    settimer spiritSpeakTimer spiritSpeakCD513endif514 515@setvar! meditationCD 10500516if not timerexists meditationTimer517    settimer meditationTimer meditationCD518endif519 520@setvar! meditationMessageCD 2777521if not timerexists meditationMessageTimer522    settimer meditationMessageTimer meditationMessageCD523endif524 525@setvar! carveCD 650526if not timerexists carveTimer527    settimer carveTimer carveCD528endif529 530#--- Magery attack spells timers ---#531 532if not timerexists magicArrowTimer 533    settimer magicArrowTimer magicArrowCD534endif535 536if not timerexists harmTimer 537    settimer harmTimer harmCD538endif539 540if not timerexists fireballTimer 541    settimer fireballTimer fireballCD542endif543 544if not timerexists lightningTimer 545    settimer lightningTimer lightningCD546endif547 548if skill "Arcane" >= 80549    @setvar! weaponAbilityCD 10000550    settimer weaponAbilityTimer weaponAbilityCD551 552    if not gumpexists 3954121934553        yell '[abilitieshotbar'554        wait maxwaittimeinms555    endif 556endif557 558if not varexist castingEarth or followers = 0 559    @setvar! castingEarth 0560endif561if not varexist castingWater or followers = 0 562    @setvar! castingWater 0563endif564if not varexist castingFire or followers = 0 565    @setvar! castingFire 0566endif567if not varexist castingAir or followers = 0 568    @setvar! castingAir 0569endif570if not varexist castingDaemon or followers = 0 571    @setvar! castingDaemon 0572endif573if not varexist castingCreature or followers = 0 574    @setvar! castingCreature 0575endif576 577#-- elementals variables --#578 579@setvar! maxFollowers 0580@setvar! currentFollowers 0581 582removelist maxFollowersList583createlist maxFollowersList584    585if earthElementals  = 1586    pushlist maxFollowersList x 587    pushlist maxFollowersList x 588elseif earthElementals = 2589    pushlist maxFollowersList x 590    pushlist maxFollowersList x 591    pushlist maxFollowersList x 592    pushlist maxFollowersList x593endif594 595if waterElementals = 1596    pushlist maxFollowersList x 597    pushlist maxFollowersList x 598elseif waterElementals = 2599    pushlist maxFollowersList x 600    pushlist maxFollowersList x 601    pushlist maxFollowersList x 602    pushlist maxFollowersList x603endif604 605if airElementals  = 1606    pushlist maxFollowersList x 607    pushlist maxFollowersList x 608elseif airElementals  = 2609    pushlist maxFollowersList x 610    pushlist maxFollowersList x 611    pushlist maxFollowersList x 612    pushlist maxFollowersList x613endif614 615if fireElementals  = 1616    pushlist maxFollowersList x 617    pushlist maxFollowersList x 618elseif fireElementals  = 2619    pushlist maxFollowersList x 620    pushlist maxFollowersList x 621    pushlist maxFollowersList x 622    pushlist maxFollowersList x623endif624 625if summonDaemons  = 1626    pushlist maxFollowersList x 627    pushlist maxFollowersList x 628elseif summonDaemons  = 2629    pushlist maxFollowersList x 630    pushlist maxFollowersList x 631    pushlist maxFollowersList x 632    pushlist maxFollowersList x633endif634 635if summonCreature = 1636    pushlist maxFollowersList x 637elseif summonCreature = 2638    pushlist maxFollowersList x 639    pushlist maxFollowersList x 640elseif summonCreature = 3641    pushlist maxFollowersList x 642    pushlist maxFollowersList x 643    pushlist maxFollowersList x 644elseif summonCreature = 4645    pushlist maxFollowersList x 646    pushlist maxFollowersList x 647    pushlist maxFollowersList x 648    pushlist maxFollowersList x 649elseif summonCreature = 5650    pushlist maxFollowersList x 651    pushlist maxFollowersList x 652    pushlist maxFollowersList x 653    pushlist maxFollowersList x 654    pushlist maxFollowersList x 655endif656 657if list maxFollowersList = 0 658    @setvar! maxFollowers 0659    660elseif list maxFollowersList = 1661    @setvar! maxFollowers 1662    663elseif list maxFollowersList = 2664    @setvar! maxFollowers 2665    666elseif list maxFollowersList = 3667    @setvar! maxFollowers 3668    669elseif list maxFollowersList = 4670    @setvar! maxFollowers 4671else 672    @setvar! maxFollowers 5673endif674 675if not varexist earthFirsty or followers = 0676    @setvar! earthFirsty 0677endif678 679if not varexist earthSecondly or followers = 0680    @setvar! earthSecondly 0681endif682 683if not varexist waterFirsty or followers = 0684    @setvar! waterFirsty 0685endif686 687if not varexist waterSecondly or followers = 0688    @setvar! waterSecondly 0689endif690 691if not varexist airFirsty or followers = 0692    @setvar! airFirsty 0693endif694 695if not varexist airSecondly or followers = 0696    @setvar! airSecondly 0697endif698 699if not varexist fireFirsty or followers = 0700    @setvar! fireFirsty 0701endif702 703if not varexist fireSecondly or followers = 0704    @setvar! fireSecondly 0705endif706 707if not varexist daemonFirsty or followers = 0708    @setvar! daemonFirsty 0709endif710 711if not varexist daemonSecondly or followers = 0712    @setvar! daemonSecondly 0713endif714 715if not varexist creatureFirsty or followers = 0716    @setvar! creatureFirsty 0717endif718 719if not varexist creatureSecondly or followers = 0720    @setvar! creatureSecondly 0721endif722 723if not varexist creatureThirdy or followers = 0724    @setvar! creatureThirdy 0725endif726 727if not varexist creatureFourthy or followers = 0728    @setvar! creatureFourthy 0729endif730 731if not varexist creatureFithy or followers = 0732    @setvar! creatureFithy 0733endif734 735#-- list creation --#736 737if not listexists earthListy or followers = 0738    removelist earthListy739    createlist earthListy740endif741 742if not listexists waterListy or followers = 0743    removelist waterListy744    createlist waterListy745endif746 747if not listexists airListy or followers = 0748    removelist airListy749    createlist airListy750endif751 752if not listexists fireListy or followers = 0753    removelist fireListy754    createlist fireListy755endif756 757if not listexists daemonListy or followers = 0758    removelist daemonListy759    createlist daemonListy760endif761 762if not listexists creatureListy or followers = 0763    removelist creatureListy764    createlist creatureListy765endif766 767if maxFollowers > 5 768    overhead "Error Max Followers > 5"769    sysmsg "Error Max Followers > 5:  Check your followers settings"770    stop771endif772 773#********** ACTIVATE NECROMANCER BAR IF USING ANY NECRO SPELLS **********# 774        775if skill 'necromancy' >= 50 and not gumpexists 622436516776    if findtype 'necromancer book' backpack777        yell '[necromancyhotbar'778        while not gumpexists 622436516779            yell '[necromancyhotbar'780            waitforgump 622436516 maxwaittimeinms781        endwhile782        wait maxwaittimeinms783    else784        overhead "Necro Book NOT Found!" 34785        wait 1000786    endif787endif788    789while not dead790 791    if not findtype 3972 or not findtype 3962  or not findtype 3963 or not findtype 3980 or not findtype 3976 or not findtype 3973 or not findtype 3974 or not findtype 3981 792        @setvar! missingRegs 1793        if timer noRegsMessageTimer > noRegsMessageCD794            overhead "* Missing Reagents *" 34795            settimer noRegsMessageTimer 0796        endif797    endif798 799#********* DROP GOLD IF OVERWEIGHT *********800    801    if weight > maxweight802        if timer overweightMessageTimer > overweightMessageCD803            overhead "Overweight !!" 34804            settimer overweightMessageTimer 0805        endif806        807        if 0 != amountOfGoldToDrop808            while weight > maxweight809                if findtype "gold coin" backpack as item810                    lift item amountOfGoldToDrop811                    droprelloc 0 0812                    getlabel backpack xxx813                    wait 200814                    if insysmsg "cannot drop anything"815                        drop backpack -1 -1 -1816                    endif817                    wait maxwaittimeinms818                    overhead "* Gold Dropped *" 55819                endif820            endwhile            821        endif822    endif823 824#********* CARVE CORPSE *********825    826    while 1 = autoCarveNearestCorpse and findtype "corpse" ground -1 -1 2 as corpsy and diffhits < activateAutoHealDiff and findtype 11552 backpack827        828        if timer carveTimer > carveCD829            if targetexists830                hotkey 'cancel current target'831            endif832            while not targetexists 833                skill 'forensicevaluation'834            endwhile835            836            if targetexists and find corpsy ground -1 -1 2837                sysmsg "Skinning corpse.." 11838                target 'self'    839                @ignore corpsy840                settimer carveTimer 0841            endif842        endif843    endwhile844    845    if timer allGuardTimer > allGuardCD and petsCurrentlyAttacking != 0 and followers > 0846        sysmsg "main loop: all guard"847        say 'ALL Guard ME' 55848        settimer allGuardTimer 0849    endif850    851    if not findbuff "food" 852        if findtype "tray" backpack as fody    853            dclick fody854            wait 200855        else 856            if timer foodMessageTimer > foodMessageCD857                overhead "No food found!" 34858                settimer foodMessageTimer 0859            endif860        endif861    endif862    863    #--- Drink str pot ---#864    865    if drinkStr = 1 and str < strengthLowerThan866        if not findbuff "Strength" 867            if findtype "White Potion" self868                dclicktype "White Potion"869                wait 200870            else871                if timer whiteMessageTimer > whiteMessageCD872                    overhead "Out of str pots" 34873                    settimer whiteMessageTimer 0 874                endif875            endif876        endif877    endif878    879    #--- Drink agility pot ---#880    881    if drinkAgility = 1882        if not findbuff "Agility" 883            if findtype "Blue Potion" self884                dclicktype "Blue Potion"885                sysmsg "agility pot" 86886                wait 200887            else888                if timer blueMessageTimer > blueMessageCD889                    overhead "Out of agility pots" 34890                    settimer blueMessageTimer 0 891                endif892            endif893        endif894    endif895        896    #--- Drink magic resist pot ---#897 898    if drinkMagicResist = 1899        if not findbuff "Magic Resist" 900            if findtype "Black Potion" self901                dclicktype "Black Potion"902                sysmsg "magic resist pot" 111903                wait 200904            else905                if timer blackMessageTimer > blackMessageCD906                    overhead "Out of resist pots" 34907                    settimer blackMessageTimer 0908                endif909            endif910        endif911    endif912    913    #--- Drink red pot ---#914    915    if diffstam > drinkWhenMissingStamina and 1 = drinkRefresh916        if findtype "Red Potion" self917            dclicktype "Red Potion"918            sysmsg "refresh pot" 36919            wait 200920        else921            if timer redMessageTimer > redMessageCD922                overhead "Out of refresh pots" 34923                settimer redMessageTimer 0 924            endif925        endif926    endif927 928#********** AUTO HEALING START  **********#         929 930    while diffhits >= activateAutoHealDiff or paralyzed or poisoned931        if dead932            stop933        endif934        935        if not findtype 3972 or not findtype 3962  or not findtype 3963 or not findtype 3980 or not findtype 3976 or not findtype 3973 or not findtype 3974 or not findtype 3981 936            @setvar! missingRegs 1937            if timer noRegsMessageTimer > noRegsMessageCD938                overhead "* Missing Reagents *" 34939                settimer noRegsMessageTimer 0940            endif941        endif942        943        @setvar! castingInterrupted 0944        945        if timer allGuardTimer > allGuardCD and followers > 0946            sysmsg "heal loop: all guard"947            say 'ALL Guard ME' 88948            settimer allGuardTimer 0949        endif950        951        sysmsg "auto-healing" 88      952    953        if not findbuff "food" 954            if findtype "tray" backpack as fody    955                dclick fody956                wait 200957            else 958                if timer foodMessageTimer > foodMessageCD959                    overhead "No food found!" 34960                    settimer foodMessageTimer 0961                endif962            endif963        endif964        965        if weight > maxweight966            if timer overweightMessageTimer > overweightMessageCD967                overhead "Overweight !!" 34968                settimer overweightMessageTimer 0969            endif970            971            if 0 != amountOfGoldToDrop972                while weight > maxweight973                    if findtype "gold coin" backpack as item974                        lift item amountOfGoldToDrop975                        droprelloc 0 0976                        getlabel backpack xxx977                        wait 200978                        if insysmsg "cannot drop anything"979                            drop backpack -1 -1 -1980                        endif981                        wait maxwaittimeinms982                        overhead "* Gold Dropped *" 55983                    endif984                endwhile            985            endif986        endif987        988        if panaceaAbility = 1989            if findbuff "bleed" or findbuff "diseased"990                if not findbuff "panacea potion cooldown"991                    if findtype "Orange Potion" self992                        dclicktype "Orange Potion"993                        wait 200994                        if findbuff "panacea potion cooldown"995                            overhead "Panacea Activated!" 55996                            sysmsg "Panacea Activated!" 55997                        endif998                    endif 999                endif1000            endif1001        endif1002        1003        #--- Trapped ---#1004        1005        if paralyzed 1006            if findtype "pouch" backpack 38 1007                yell "[pouch"            1008                wait 2001009            else1010                if timer pouchMessageTimer > pouchMessageCD1011                    overhead "Out of Pouches!" 341012                    settimer pouchMessageTimer 01013                endif1014            endif1015        endif1016            1017        #--- Self bandage ---#1018        1019        if diffhits >= 1 and not bandaging1020            if skill 'healing' >= 50 or skill "veterinary" >= 501021                if findtype 'clean bandage%s%' backpack1022                1023                    if targetexists1024                        hotkey 'cancel current target'  1025                    endif1026                    dclicktype 'clean bandage%s%'1027                    waitfortarget maxwaittimeinms1028                    target 'self'1029                    wait 2001030                    if bandaging1031                        sysmsg "bandage applied" 221032                    endif1033                else1034                    if timer aidsMessageTimer > aidsMessageCD1035                        overhead "Out of bandages" 341036                        settimer aidsMessageTimer 01037                    endif1038                endif1039            endif1040        endif1041        1042        #--- Drink str pot ---#1043        1044        if drinkStr = 1 and str < strengthLowerThan1045            if not findbuff "Strength" 1046                if findtype "White Potion" self1047                    dclicktype "White Potion"1048                    wait 2001049                else1050                    if timer whiteMessageTimer > whiteMessageCD1051                        overhead "Out of str pots" 341052                        settimer whiteMessageTimer 0 1053                    endif1054                endif1055            endif1056        endif1057        1058        #--- Drink agility pot ---#1059        1060        if drinkAgility = 11061            if not findbuff "Agility" 1062                if findtype "Blue Potion" self1063                    dclicktype "Blue Potion"1064                    sysmsg "agility pot" 861065                    wait 2001066                else1067                    if timer blueMessageTimer > blueMessageCD1068                        overhead "Out of agility pots" 341069                        settimer blueMessageTimer 0 1070                    endif1071                endif1072            endif1073        endif1074            1075        #--- Drink magic resist pot ---#1076    1077        if drinkMagicResist = 11078            if not findbuff "Magic Resist" 1079                if findtype "Black Potion" self1080                    dclicktype "Black Potion"1081                    sysmsg "magic resist pot" 1111082                    wait 2001083                else1084                    if timer blackMessageTimer > blackMessageCD1085                        overhead "Out of resist pots" 341086                        settimer blackMessageTimer 01087                    endif1088                endif1089            endif1090        endif1091        1092        #--- Drink red pot ---#1093        1094        if diffstam > drinkWhenMissingStamina and 1 = drinkRefresh1095            if findtype "Red Potion" self1096                dclicktype "Red Potion"1097                sysmsg "refresh pot" 361098                wait 2001099            else1100                if timer redMessageTimer > redMessageCD1101                    overhead "Out of refresh pots" 341102                    settimer redMessageTimer 0 1103                endif1104            endif1105        endif1106        1107        #--- Poisoned ---#1108        1109        if 1 = drinkCure or 1 = cureSpell1110            while poisoned1111                if findtype "Orange Potion" self1112                    1113                    dclicktype "Orange Potion"1114                    sysmsg "cure pot" 441115                    wait 2001116                else1117                    if timer orangeMessageTimer > orangeMessageCD1118                        overhead "Out of cure pots" 341119                        settimer orangeMessageTimer 01120                    endif1121                    1122                    if diffhits >= 30 or not findtype 3972 self or not findtype 3973 self1123                        break1124                    endif1125                    1126                    if skill 'magery' >= 40 and mana >= 6 and 1 = cureSpell and not casting1127                        cast 'cure'1128                        wait 501129                        while not casting                   1130                            if targetexists1131                                hotkey 'cancel current target'1132                            endif1133                            cast 'cure'  1134                            wait 501135                        endwhile  1136                        while not targetexists and casting1137                        endwhile1138                        waitfortarget maxwaittimeinms1139                        target 'self' 1140                        wait 2001141                    else 1142                        break1143                    endif1144                endif1145            endwhile1146        endif1147            1148        #--- Drink Heal Pot ---#1149    1150        if diffhits >= drinkHealPotDiff and 1 = drinkHeal1151            if findtype "Yellow Potion" self as hPot1152                getlabel hPot potLabel1153                if "(" in potLabel1154                else1155                    dclicktype 38521156                    getlabel backpack xxx1157                    sysmsg "heal pot" 551158                endif1159            else1160                if timer yellowMessageTimer > yellowMessageCD1161                    overhead "Out of heals pots" 341162                    settimer yellowMessageTimer 01163                endif1164            endif1165        endif1166            1167        #--- Cast heals ---#1168        1169        if skill 'magery' >= 40 and diffhits >= startCastMiniHealDiff and diffhits < endCastMiniHealDiff and mana >= 4 and miniHeal = 1 and not casting1170            if insysmsg "Your concentration is disturbed"1171            endif  1172            1173            sysmsg 'mini heal' 111174            cast 'heal'1175            while not casting                   1176                if targetexists1177                    hotkey 'cancel current target'1178                endif1179                cast 'heal'1180            endwhile  1181            1182            while not targetexists1183                if insysmsg "Your concentration is disturbed"1184                    interrupt1185                    @setvar! castingInterrupted 11186                    break                1187                endif1188            endwhile1189            1190            if 0 = castingInterrupted1191                target 'self' 1192            endif 1193            1194        elseif skill 'magery' >= 40 and diffhits >= castEmergencyMiniHealDiff and mana >= 4 and miniHeal = 1 and not casting1195            if insysmsg "Your concentration is disturbed"1196            endif  1197            sysmsg "mini heal" 111198            cast 'heal'1199            while not casting                   1200                if targetexists1201                    hotkey 'cancel current target'1202                endif1203                cast 'heal'1204            endwhile  1205            1206            while not targetexists1207                if insysmsg "Your concentration is disturbed"1208                    interrupt1209                    @setvar! castingInterrupted 11210                    break                1211                endif1212            endwhile1213            1214            if 0 = castingInterrupted1215                target 'self' 1216            endif 1217            1218        elseif skill 'magery' >= 60 and diffhits >= startCastGreaterHealDiff and diffhits < endCastGreaterHealDiff and mana >= 11 and greaterHeal = 1 and not casting1219            if insysmsg "Your concentration is disturbed"1220            endif  1221                        1222            sysmsg "greater heal" 111223            cast 'greater heal'         1224            while not casting                   1225                if targetexists1226                    hotkey 'cancel current target'1227                endif1228                cast 'greater heal'1229            endwhile  1230            1231            @settimer! spellTimer 0  1232            @setvar! spellCD 800  1233            1234            while not targetexists1235                if insysmsg "Your concentration is disturbed"1236                    interrupt1237                    @setvar! castingInterrupted 11238                    break                1239                endif 1240                1241                if timer spellTimer < spellCD1242                    #--- Poisoned ---#1243                    1244                    if 1 = drinkCure1245                        while poisoned and casting and not targetexists 1246                            if findtype "Orange Potion" self1247                                dclicktype "Orange Potion"1248                                sysmsg "cure pot" 441249                                wait 2001250                            else1251                                if timer orangeMessageTimer > orangeMessageCD1252                                    overhead "Out of cure pots" 341253                                    settimer orangeMessageTimer 01254                                endif1255                                break1256                            endif1257                        endwhile1258                    endif            1259                1260                #--- Drink Heal Pot ---#1261                1262                if diffhits >= drinkHealPotDiff and 1 = drinkHeal and casting and not targetexists1263                    if findtype "Yellow Potion" self as hPot1264                        getlabel hPot potLabel1265                        if "(" in potLabel1266                        else1267                            dclicktype 38521268                            sysmsg "heal pot" 551269                            getlabel backpack xxx1270                        endif1271                    else1272                        if timer yellowMessageTimer > yellowMessageCD1273                            overhead "Out of heals pots" 341274                            settimer yellowMessageTimer 01275                        endif1276                    endif1277                endif1278                    1279                endif1280            endwhile1281            1282            if 0 = castingInterrupted1283                target 'self' 1284            endif 1285        1286        endif 1287    1288    endwhile1289    1290    #--- Create mushroom ---#1291 1292    if counttype 29012 backpack = 0 and missingRegs = 01293        while counttype 29012 backpack < mushroomCount and mana > 3 and diffhits < activateAutoHealDiff1294            if not casting1295                cast 'create food'1296            endif1297        endwhile1298    endif  1299    1300    #--- Eat Mushroom ---# 1301 1302    if mana < eatMushWhenManaLowerThan and mushroomCount > 0 and timer mushroomTimer > mushroomTimerCD1303        if counttype 29012 backpack1304            if insysmsg "You consume a magic mushroom"1305            endif1306            sysmsg "Eating mush." 441307            dclicktype 29012 backpack1308            getlabel backpack xxx1309            wait 2001310            1311            if insysmsg "You consume a magic mushroom"1312                settimer mushroomTimer 01313            endif1314        else 1315            overhead "No mushrooms found!" 341316        endif1317    endif1318    1319#********** AUTO-MAGERY BUFFS IF NEEDED **********          1320    @setvar! castingInterrupted 01321    1322    if magicReflect = 1 and skill 'magery' >= 70 and not findbuff "Magic Reflection" and mana >= miniumManaToBuff and diffhits < activateAutoHealDiff and timer magicReflectTimer > magicReflectCD and findtype 3972 self and findtype 3974 self and findtype 3981 self and not find currentTarget ground -1 -1 121323        if insysmsg "that spell will not"1324        endif1325        if insysmsg "that spell is already"1326        endif1327        if insysmsg "before you may cast that again"1328        endif1329        sysmsg "magic reflect" 111330        cast 'Magic Reflection'1331        while not casting 1332            getlabel backpack xxx1333            wait 2001334            if insysmsg "that spell will not" or insysmsg "that spell is already" or insysmsg "before you may cast that again"1335                settimer magicReflectTimer 01336                break  1337            endif1338            if targetexists1339                hotkey 'cancel current target'1340            endif1341            cast 'Magic Reflection'1342        endwhile 1343        1344        while casting 1345            if diffhits >= interruptCastingDiff1346                interrupt1347                @setvar! castingInterrupted 1 1348                break1349            endif   1350        endwhile1351        wait 200  1352  1353    endif1354    1355    if armorReflect = 1 and skill 'magery' >= 30 and not findbuff "Reactive Armor" and mana >= miniumManaToBuff and diffhits < activateAutoHealDiff and timer armorReflectTimer > armorReflectCD and findtype 3980 self and findtype 3972 self and findtype 3981 self and not find currentTarget ground -1 -1 121356        if insysmsg "that spell will not"1357        endif1358        if insysmsg "that spell is already"1359        endif1360        if insysmsg "before you may cast that again"1361        endif1362        sysmsg "reflect armor" 111363        cast 'Reactive Armor'1364        while not casting   1365            getlabel backpack xxx1366            wait 2001367            if insysmsg "that spell will not" or insysmsg "that spell is already" or insysmsg "before you may cast that again"1368                settimer armorReflectTimer 01369                break  1370            endif1371            if targetexists1372                hotkey 'cancel current target'1373            endif1374            cast 'Reactive Armor'1375        endwhile  1376        1377        while casting 1378        endwhile1379        getlabel backpack xxx1380        wait 200  1381    endif     1382    1383    if protectionSpell = 1 and skill 'magery' >= 40 and not findbuff "Protection" and mana >= miniumManaToBuff and diffhits < activateAutoHealDiff and findtype 3980 self and findtype 3972 self and findtype 3973 self and not find currentTarget ground -1 -1 121384        sysmsg "protect" 111385        cast 'Protection'1386        while not casting1387            if targetexists1388                hotkey 'cancel current target'1389            endif1390            cast 'Protection'1391        endwhile  1392        while casting1393        endwhile1394        wait 200  1395    endif 1396    1397    if archProtectionSpell = 1 and skill 'magery' >= 60 and not findbuff "Protection" and mana >= miniumManaToBuff and diffhits < activateAutoHealDiff and findtype 3980 self and findtype 3972 self and findtype 3973 self  and findtype 3974 self and not find currentTarget ground -1 -1 121398        sysmsg "arch protect" 111399        cast 'Arch Protection'         1400        while not casting                  1401            if targetexists1402                hotkey 'cancel current target'1403            endif1404            cast 'Arch Protection' 1405            wait 501406        endwhile  1407        1408        while not targetexists and casting1409        endwhile1410        1411        waitfortarget maxwaittimeinms1412        target 'self' 1413        wait 200  1414    endif 1415    1416    if blessSpell = 1 and skill 'magery' >= 50 and not findbuff "Cunning" and mana >= miniumManaToBuff and diffhits < activateAutoHealDiff and findtype 3972 self and findtype 3974 self and not find currentTarget ground -1 -1 121417        sysmsg "bless" 111418        cast 'Bless'         1419        while not casting                  1420            if targetexists1421                hotkey 'cancel current target'1422            endif1423            cast 'Bless'1424            wait 501425        endwhile  1426        1427        while not targetexists and casting1428        endwhile1429        1430        waitfortarget maxwaittimeinms1431        target 'self' 1432        wait 200  1433    endif 1434    1435    @setvar! castingInterrupted 01436    if autoTrapPouches = 11437        while findtype 3705 backpack 0 and findtype 3972 self and findtype 3973 self and findtype 3980 self1438            if insysmsg "Your concentration is disturbed"1439            endif1440            cast 'magic trap'    1441            while not casting                   1442                if targetexists1443                    hotkey 'cancel current target'1444                endif1445                cast 'magic trap'1446            endwhile 1447            1448            while not targetexists1449                if insysmsg "Your concentration is disturbed"1450                    interrupt1451                    @setvar! castingInterrupted 11452                    break                1453                endif1454            endwhile1455            1456            if 0 = castingInterrupted1457                target self 1458            endif 1459            wait 2001460        endwhile1461    endif1462    1463#********** START AUTO SUMMONING **********# 1464 1465    while followers < maxFollowers and diffhits < activateAutoHealDiff1466    1467        if find currentTarget ground -1 -1 12 and not dead currentTarget1468            if followers >= breakCastingWhenFollowersBelow1469                break1470            endif1471        endif1472        1473        #--- Eat Food ---#1474 1475        if not findbuff "food" 1476            if findtype "tray" backpack as fody    1477                dclick fody1478                wait 2001479            else 1480                if timer foodMessageTimer > foodMessageCD1481                    overhead "No food found!" 341482                    settimer foodMessageTimer 01483                endif1484            endif1485        endif1486        1487        #--- Drink str pot ---#1488        1489        if drinkStr = 1 and str < strengthLowerThan1490            if not findbuff "Strength" 1491                if findtype "White Potion" self1492                    dclicktype "White Potion"1493                    wait 2001494                else1495                    if timer whiteMessageTimer > whiteMessageCD1496                        overhead "Out of str pots" 341497                        settimer whiteMessageTimer 0 1498                    endif1499                endif1500            endif1501        endif1502        1503        #--- Drink agility pot ---#1504        1505        if drinkAgility = 11506            if not findbuff "Agility" 1507                if findtype "Blue Potion" self1508                    dclicktype "Blue Potion"1509                    sysmsg "agility pot" 861510                    wait 2001511                else1512                    if timer blueMessageTimer > blueMessageCD1513                        overhead "Out of agility pots" 341514                        settimer blueMessageTimer 0 1515                    endif1516                endif1517            endif1518        endif1519            1520        #--- Drink magic resist pot ---#1521    1522        if drinkMagicResist = 11523            if not findbuff "Magic Resist" 1524                if findtype "Black Potion" self1525                    dclicktype "Black Potion"1526                    sysmsg "magic resist pot" 1111527                    wait 2001528                else1529                    if timer blackMessageTimer > blackMessageCD1530                        overhead "Out of resist pots" 341531                        settimer blackMessageTimer 01532                    endif1533                endif1534            endif1535        endif1536        1537        #--- Drink red pot ---#1538        1539        if diffstam > drinkWhenMissingStamina and 1 = drinkRefresh1540            if findtype "Red Potion" self1541                dclicktype "Red Potion"1542                sysmsg "refresh pot" 361543                wait 2001544            else1545                if timer redMessageTimer > redMessageCD1546                    overhead "Out of refresh pots" 341547                    settimer redMessageTimer 0 1548                endif1549            endif1550        endif1551        1552        #--- Create mushroom ---#1553    1554        if counttype 29012 backpack = 0 and missingRegs = 01555            while counttype 29012 backpack < mushroomCount and mana > 3 and diffhits < activateAutoHealDiff1556                if not casting1557                    cast 'create food'1558                endif1559            endwhile1560        endif  1561        1562        #--- Eat Mushroom ---#1563     1564        if mana < eatMushWhenManaLowerThan and mushroomCount > 0 and timer mushroomTimer > mushroomTimerCD1565            if counttype 29012 backpack1566                if insysmsg "You consume a magic mushroom"1567                endif1568                sysmsg "Eating mush." 441569                dclicktype 29012 backpack1570                getlabel backpack xxx1571                wait 2001572                1573                if insysmsg "You consume a magic mushroom"1574                    settimer mushroomTimer 01575                endif1576            else 1577                overhead "No mushrooms found!" 341578            endif1579        endif1580        1581        #--- Use Meditation ---#1582        1583        if 0 = useMeditationSkill and mana < 50 1584            break1585        elseif 1 = useMeditationSkill and mana < 50 and not findbuff "meditating" and timer meditationTimer > meditationCD1586            if insysmsg "you are at peace"1587            endif1588            if insysmsg "you enter a meditative trance"1589            endif1590            if insysmsg "You must wait a few moments to use another skill."1591            endif1592            1593            skill 'meditation'1594            getlabel backpack xxx1595            wait 2001596            if not findbuff 'meditating'1597                settimer meditationTimer 75001598            elseif findbuff 'meditating'1599                warmode on1600                warmode off1601                settimer meditationTimer 01602                while mana < 50 and diffhits < activateAutoHealDiff1603                    if not findbuff 'meditating'1604                        break1605                    endif1606                    if timer meditationMessageTimer > meditationMessageCD1607                        overhead "* actively meditating *" 111608                        settimer meditationMessageTimer 01609                    endif1610                endwhile1611            endif1612        endif 1613        1614        #--- Check for new elementals ---#1615        1616        if 1 = castingEarth and followers > 11617            sysmsg "fixing earth" 441618            while findtype 158|14 ground -1 -1 12 as ele 1619                menu ele 11620                waitfortarget maxwaittimeinms1621                if targetexists 1622                    if ele != earthFirsty and ele != earthSecondly1623                        hotkey 'cancel current target'1624                        1625                        if earthFirsty = 0 1626                            @setvar! earthFirsty ele1627                            sysmsg "add earth 1" 111628                            overhead "Earth 1" 634 ele1629                        else 1630                            @setvar! earthSecondly ele1631                            sysmsg "add earth 2" 111632                            overhead "Earth 2" 634 ele1633                        endif1634                        1635                        break1636                    endif1637                endif1638                @ignore ele1639            endwhile    1640            @clearignore1641            @setvar! castingEarth 01642            1643        elseif 1 = castingWater and followers > 11644            sysmsg "fixing water" 441645            while findtype 740|16 ground -1 -1 12 as ele 1646                menu ele 11647                waitfortarget maxwaittimeinms1648                if targetexists 1649                    if ele != waterFirsty and ele != waterSecondly1650                        hotkey 'cancel current target'1651                        1652                        if waterFirsty = 0 1653                            @setvar! waterFirsty ele1654                            sysmsg "add water 1" 111655                            overhead "Water 1" 399 ele1656                        else 1657                            @setvar! waterSecondly ele1658                            sysmsg "add water 2" 111659                            overhead "Water 2" 399 ele1660                        endif1661                        1662                        break1663                    endif1664                endif1665                @ignore ele1666            endwhile1667            @clearignore1668            @setvar! castingWater 01669            1670        elseif 1 = castingAir and followers > 11671            sysmsg "fixing air" 441672            while findtype 306|13 ground -1 -1 12 as ele 1673                menu ele 11674                waitfortarget maxwaittimeinms1675                if targetexists 1676                    if ele != airFirsty and ele != airSecondly1677                        hotkey 'cancel current target'1678                        1679                        if airFirsty = 0 1680                            @setvar! airFirsty ele1681                            sysmsg "add air 1" 111682                            overhead "Air 1" 933 ele1683                        else 1684                            @setvar! airSecondly ele1685                            sysmsg "add air 2" 111686                            overhead "Air 2" 933 ele1687                        endif1688                        1689                        break1690                    endif1691                endif1692                @ignore ele1693            endwhile    1694            @clearignore1695            @setvar! castingAir 01696            1697        elseif 1 = castingFire and followers > 11698            sysmsg "fixing fire" 441699            while findtype 24|15 ground -1 -1 12 as ele 1700                menu ele 11701                waitfortarget maxwaittimeinms1702                if targetexists 1703                    if ele != fireFirsty and ele != fireSecondly1704                        hotkey 'cancel current target'1705                        1706                        if fireFirsty = 0 1707                            @setvar! fireFirsty ele1708                            sysmsg "add fire 1" 111709                            overhead "Fire 1" 353 ele1710                        else 1711                            @setvar! fireSecondly ele1712                            sysmsg "add fire 2" 111713                            overhead "Fire 2" 353 ele1714                        endif1715                        1716                        break1717                    endif1718                endif1719                @ignore ele1720            endwhile1721            @clearignore1722            @setvar! castingFire 01723            1724        elseif 1 = castingDaemon and followers > 11725            sysmsg "fixing daemon" 441726            while findtype 9|722 ground -1 -1 12 as ele 1727                menu ele 11728                waitfortarget maxwaittimeinms1729                if targetexists 1730                    if ele != daemonFirsty and ele != daemonSecondly1731                        hotkey 'cancel current target'1732                        1733                        if daemonFirsty = 0 1734                            @setvar! daemonFirsty ele1735                            sysmsg "add daemon 1" 111736                            overhead "Daemon 1" 11 ele1737                        else 1738                            @setvar! daemonSecondly ele1739                            sysmsg "add daemon 2" 2351740                            overhead "Daemon 2" 235 ele1741                        endif1742                        1743                        break1744                    endif1745                endif1746                @ignore ele1747            endwhile     1748            @clearignore1749            @setvar! castingDaemon 01750            1751        elseif 1 = castingCreature and followers > 01752            sysmsg "fixing creature" 441753            while findtype 215|211|302|317|225|212|202|213|716|729|51|74|214|206|776|737|718|739|718|29|776|317|302|39|56|26|3|57|50|382|717|736|270 ground -1 -1 12 as ele 1754                menu ele 11755                waitfortarget maxwaittimeinms1756                if targetexists 1757                    if ele != creatureFirsty and ele != creatureSecondly and ele != creatureThirdy and ele != creatureFourthy and ele != creatureFithy1758                        hotkey 'cancel current target'1759                        wait 501760                        menu ele 31761                        if creatureFirsty = 0 1762                            @setvar! creatureFirsty ele1763                            sysmsg "Creature 1" 111764                            overhead "Creature 1" 11 ele1765                        elseif creatureSecondly = 0 1766                            @setvar! creatureSecondly ele1767                            sysmsg "add creature 2" 111768                            overhead "Creature 2" 11 ele1769                        elseif creatureThirdy = 0 1770                            @setvar! creatureThirdy ele1771                            sysmsg "add creature 3" 111772                            overhead "Creature 3" 11 ele1773                        elseif creatureFourthy = 0 1774                            @setvar! creatureFourthy ele1775                            sysmsg "add creature 4" 111776                            overhead "Creature 4" 11 ele1777                        elseif creatureFithy = 0 1778                            @setvar! creatureFithy ele1779                            sysmsg "add creature 5" 111780                            overhead "Creature 5" 11 ele1781                        endif1782                        1783                        break1784                    endif1785                endif1786                @ignore ele1787            endwhile 1788            @clearignore1789            @setvar! castingCreature 01790        endif1791        1792        #--- Check for dead elementals ---#1793        1794        if earthFirsty != 0 and dead earthFirsty1795            if list earthListy != 01796                poplist earthListy 'front' 1797                sysmsg "pop earth 1"1798            endif 1799            @setvar! earthFirsty 01800        endif1801            1802        if earthSecondly != 0 and dead earthSecondly1803            if list earthListy != 01804                poplist earthListy 'front'  1805                sysmsg "pop earth 2"1806            endif  1807            @setvar! earthSecondly 01808        endif1809            1810        if waterFirsty != 0 and dead waterFirsty1811            if list waterListy != 01812                poplist waterListy 'front'  1813                sysmsg "pop water 1"1814            endif1815            @setvar! waterFirsty 01816        endif1817            1818        if waterSecondly != 0 and dead waterSecondly1819            if list waterListy != 01820                poplist waterListy 'front' 1821                sysmsg "pop water 2"1822            endif1823            @setvar! waterSecondly 01824        endif1825            1826        if airFirsty != 0 and dead airFirsty1827            if list airListy != 01828                poplist airListy 'front'1829            endif1830            @setvar! airFirsty 01831        endif1832            1833        if airSecondly != 0 and dead airSecondly 1834            if list airListy != 01835                poplist airListy 'front'1836            endif 1837            @setvar! airSecondly 01838        endif1839            1840        if fireFirsty != 0 and dead fireFirsty 1841            if list fireListy != 01842                poplist fireListy 'front'   1843            endif1844            @setvar! fireFirsty 01845        endif1846            1847        if fireSecondly != 0 and dead fireSecondly 1848            if list fireListy != 01849                poplist fireListy 'front'   1850            endif 1851            @setvar! fireSecondly 01852        endif1853            1854        if daemonFirsty != 0 and dead daemonFirsty1855            if list daemonListy != 01856                poplist daemonListy 'front'1857            endif1858            @setvar! daemonFirsty 01859        endif1860            1861        if daemonSecondly != 0 and dead daemonSecondly 1862            if list daemonListy != 01863                poplist daemonListy 'front'1864            endif 1865            @setvar! daemonSecondly 01866        endif1867            1868        if creatureFirsty != 0 and dead creatureFirsty 1869            if list creatureListy != 01870                poplist creatureListy 'front'1871                sysmsg "pop creature 1"1872            endif 1873            @setvar! creatureFirsty 01874        endif1875            1876        if creatureSecondly != 0 and dead creatureSecondly 1877            if list creatureListy != 01878                poplist creatureListy 'front'1879                sysmsg "pop creature 2"1880            endif 1881            @setvar! creatureSecondly 01882        endif1883            1884        if creatureThirdy != 0 and dead creatureThirdy 1885            if list creatureListy != 01886                poplist creatureListy 'front'1887                sysmsg "pop creature 3"1888            endif 1889            @setvar! creatureThirdy 01890        endif1891            1892        if creatureFourthy != 0 and dead creatureFourthy 1893            if list creatureListy != 01894                poplist creatureListy 'front'1895                sysmsg "pop creature 4"1896            endif 1897            @setvar! creatureFourthy 01898        endif1899            1900        if creatureFithy != 0 and dead creatureFithy 1901            if list creatureListy != 01902                poplist creatureListy 'front'1903                sysmsg "pop creature 5"1904            endif 1905            @setvar! creatureFithy 01906        endif1907        1908        @clearsysmsg1909        @setvar! wasInterrupted 01910        1911#********** ACTIVATE NECROMANCER BAR IF USING ANY NECRO SPELLS **********# 1912        1913        if NecroVengefulSpirit = 1 or NecroBloodOath = 11914            if findtype 'necromancer book' backpack1915                yell '[necromancyhotbar'1916                while not gumpexists 6224365161917                    yell '[necromancyhotbar'1918                    waitforgump 622436516 maxwaittimeinms1919                endwhile1920            endif1921        endif1922        1923#********** ACTIVATE NECROMANCER VENGEFUL SPIRIT SPELL **********# 1924        1925        if ingump "20/" 6224365161926            @setvar! unholyPoints 201927        elseif ingump "19/" 6224365161928            @setvar! unholyPoints 191929        elseif ingump "18/" 6224365161930            @setvar! unholyPoints 181931        elseif ingump "17/" 6224365161932            @setvar! unholyPoints 171933        elseif ingump "16/" 6224365161934            @setvar! unholyPoints 161935        elseif ingump "15/" 6224365161936            @setvar! unholyPoints 151937        elseif ingump "14/" 6224365161938            @setvar! unholyPoints 141939        elseif ingump "13/" 6224365161940            @setvar! unholyPoints 131941        elseif ingump "12/" 6224365161942            @setvar! unholyPoints 121943        elseif ingump "11/" 6224365161944            @setvar! unholyPoints 111945        elseif ingump "10/" 6224365161946            @setvar! unholyPoints 101947        elseif ingump "9/" 6224365161948            @setvar! unholyPoints 91949        elseif ingump "8/" 6224365161950            @setvar! unholyPoints 81951        elseif ingump "7/" 6224365161952            @setvar! unholyPoints 71953        elseif ingump "6/" 6224365161954            @setvar! unholyPoints 61955        elseif ingump "5/" 6224365161956            @setvar! unholyPoints 51957        elseif ingump "4/" 6224365161958            @setvar! unholyPoints 41959        elseif ingump "3/" 6224365161960            @setvar! unholyPoints 31961        elseif ingump "2/" 6224365161962            @setvar! unholyPoints 21963        elseif ingump "1/" 6224365161964            @setvar! unholyPoints 11965        else 1966            @setvar unholyPoints 01967        endif1968        1969        if 1 = NecroVengefulSpirit and 0 < unholyPoints and timer vengefulSpiritTimer > vengefulSpiritCD and skill 'necromancy' >= 50 and diffhits < activateAutoHealDiff1970            if insysmsg "unholy symbols remaining"1971            endif1972            if insysmsg "seconds before you may use that ability again."1973            endif1974 1975            @setvar! castingInterrupted 01976            @settimer! necroAbilityTimer 01977 1978            while not insysmsg "unholy symbols remaining"1979                if timer necroAbilityTimer > necroAbilityTimeoutCD1980                    sysmsg "vengefulspirit no response" 441981                    @setvar! castingInterrupted 11982                    settimer vengefulSpiritTimer necroMarginErrorCD1983                    break1984                endif1985                sysmsg "vengefulspirit" 661986                hotkey 'vengeful spirit'1987                getlabel backpack xxx1988                wait 2001989                if insysmsg "seconds before you may use that ability again."1990                    sysmsg "vengefulspirit on cooldown" 441991                    @setvar! castingInterrupted 11992                    settimer vengefulSpiritTimer necroMarginErrorCD1993                    break    1994                endif1995            endwhile1996            1997            if 0 = castingInterrupted1998                overhead '[>Vengeful Spirit<]' 441999                settimer vengefulSpiritTimer 02000            endif2001        endif2002        2003#********** ACTIVATE NECROMANCER BLOOD OATH SPELL **********# 2004        2005        if ingump "20/" 6224365162006            @setvar! unholyPoints 202007        elseif ingump "19/" 6224365162008            @setvar! unholyPoints 192009        elseif ingump "18/" 6224365162010            @setvar! unholyPoints 182011        elseif ingump "17/" 6224365162012            @setvar! unholyPoints 172013        elseif ingump "16/" 6224365162014            @setvar! unholyPoints 162015        elseif ingump "15/" 6224365162016            @setvar! unholyPoints 152017        elseif ingump "14/" 6224365162018            @setvar! unholyPoints 142019        elseif ingump "13/" 6224365162020            @setvar! unholyPoints 132021        elseif ingump "12/" 6224365162022            @setvar! unholyPoints 122023        elseif ingump "11/" 6224365162024            @setvar! unholyPoints 112025        elseif ingump "10/" 6224365162026            @setvar! unholyPoints 102027        elseif ingump "9/" 6224365162028            @setvar! unholyPoints 92029        elseif ingump "8/" 6224365162030            @setvar! unholyPoints 82031        elseif ingump "7/" 6224365162032            @setvar! unholyPoints 72033        elseif ingump "6/" 6224365162034            @setvar! unholyPoints 62035        elseif ingump "5/" 6224365162036            @setvar! unholyPoints 52037        elseif ingump "4/" 6224365162038            @setvar! unholyPoints 42039        elseif ingump "3/" 6224365162040            @setvar! unholyPoints 32041        elseif ingump "2/" 6224365162042            @setvar! unholyPoints 22043        elseif ingump "1/" 6224365162044            @setvar! unholyPoints 12045        else 2046            @setvar unholyPoints 02047        endif2048                2049        if 1 = NecroBloodOath and 3 < unholyPoints and timer bloodOathTimer > bloodOathCD and skill 'necromancy' >= 80 and diffhits < activateAutoHealDiff2050            if insysmsg "unholy symbols remaining"2051            endif2052            if insysmsg "seconds before you may use that ability again."2053            endif2054 2055            @setvar! castingInterrupted 02056            @settimer! necroAbilityTimer 02057 2058            while not insysmsg "unholy symbols remaining"2059                if timer necroAbilityTimer > necroAbilityTimeoutCD2060                    sysmsg "bloodoath no response" 442061                    @setvar! castingInterrupted 12062                    settimer bloodOathTimer necroMarginErrorCD2063                    break2064                endif2065                sysmsg "bloodoath" 662066                hotkey 'blood oath'2067                getlabel backpack xxx2068                wait 2002069                if insysmsg "seconds before you may use that ability again."2070                    sysmsg "blood oath on cooldown" 442071                    @setvar! castingInterrupted 12072                    settimer bloodOathTimer necroMarginErrorCD2073                    break    2074                endif2075            endwhile2076            2077            if 0 = castingInterrupted2078                overhead '[>Blood Oath<]' 442079                settimer bloodOathTimer 02080            endif2081        endif2082        2083#********** ACTIVATE NECROMANCER WITHER SPELL **********# 2084        2085        if ingump "20/" 6224365162086            @setvar! unholyPoints 202087        elseif ingump "19/" 6224365162088            @setvar! unholyPoints 192089        elseif ingump "18/" 6224365162090            @setvar! unholyPoints 182091        elseif ingump "17/" 6224365162092            @setvar! unholyPoints 172093        elseif ingump "16/" 6224365162094            @setvar! unholyPoints 162095        elseif ingump "15/" 6224365162096            @setvar! unholyPoints 152097        elseif ingump "14/" 6224365162098            @setvar! unholyPoints 142099        elseif ingump "13/" 6224365162100            @setvar! unholyPoints 132101        elseif ingump "12/" 6224365162102            @setvar! unholyPoints 122103        elseif ingump "11/" 6224365162104            @setvar! unholyPoints 112105        elseif ingump "10/" 6224365162106            @setvar! unholyPoints 102107        elseif ingump "9/" 6224365162108            @setvar! unholyPoints 92109        elseif ingump "8/" 6224365162110            @setvar! unholyPoints 82111        elseif ingump "7/" 6224365162112            @setvar! unholyPoints 72113        elseif ingump "6/" 6224365162114            @setvar! unholyPoints 62115        elseif ingump "5/" 6224365162116            @setvar! unholyPoints 52117        elseif ingump "4/" 6224365162118            @setvar! unholyPoints 42119        elseif ingump "3/" 6224365162120            @setvar! unholyPoints 32121        elseif ingump "2/" 6224365162122            @setvar! unholyPoints 22123        elseif ingump "1/" 6224365162124            @setvar! unholyPoints 12125        else 2126            @setvar unholyPoints 02127        endif2128                2129        if 1 = NecroWither and 4 < unholyPoints and timer witherTimer > witherCD and skill 'necromancy' >= 90 and diffhits < activateAutoHealDiff2130            if insysmsg "unholy symbols remaining"2131            endif2132            if insysmsg "seconds before you may use that ability again."2133            endif2134 2135            @setvar! castingInterrupted 02136            @settimer! necroAbilityTimer 02137 2138            while not insysmsg "unholy symbols remaining"2139                if timer necroAbilityTimer > necroAbilityTimeoutCD2140                    sysmsg "wither no response" 442141                    @setvar! castingInterrupted 12142                    settimer witherTimer necroMarginErrorCD2143                    break2144                endif2145                sysmsg "wither" 662146                hotkey 'wither'2147                getlabel backpack xxx2148                wait 2002149                if insysmsg "seconds before you may use that ability again."2150                    sysmsg "wither on cooldown" 442151                    @setvar! castingInterrupted 12152                    settimer witherTimer necroMarginErrorCD2153                    break    2154                endif2155            endwhile2156            2157            if 0 = castingInterrupted2158                overhead '[>Wither<]' 442159                settimer witherTimer 02160            endif2161        endif2162        2163        if list earthListy = 0 2164            #sysmsg "Earth List = 0"2165        elseif list earthListy = 12166            #sysmsg "Earth List = 1"2167        elseif list earthListy = 22168            #sysmsg "Earth List = 2"2169        endif2170        2171        if list waterListy = 0 2172            #sysmsg "Water List = 0"2173        elseif list waterListy = 12174            #sysmsg "Water List = 1"2175        elseif list waterListy = 22176            #sysmsg "Water List = 2"2177        endif2178        2179        if list creatureListy = 0 2180            #sysmsg "Creature List = 0"2181        elseif list creatureListy = 12182            #sysmsg "Creature List = 1"2183        elseif list creatureListy = 22184            #sysmsg "Creature List = 2"2185        elseif list creatureListy = 22186            #sysmsg "Creature List = 2"2187        elseif list creatureListy = 22188            #sysmsg "Creature List = 2"2189        endif2190        2191        @setvar! missingSummonRegs 02192        @setvar! summoningSucessful 02193        2194        if not findtype 3963 self or not findtype 3974 self or not findtype 3981 self2195            @setvar! missingSummonRegs 12196            if timer noRegsMessageTimer > noRegsMessageCD2197                overhead 'No regs to summon!' 342198                sysmsg 'No regs to summon!' 342199                settimer noRegsMessageTimer 02200            endif2201            wait noRegsMessageCD2202        elseif not findtype 3980 self 2203            if fireElementals != 0 or summonDaemons != 02204                @setvar! missingSummonRegs 12205                if timer noRegsMessageTimer > noRegsMessageCD2206                    overhead 'No regs to summon!' 342207                    sysmsg 'No regs to summon!' 342208                    settimer noRegsMessageTimer 02209                endif2210                wait noRegsMessageCD2211            endif2212        elseif mana < 502213            if timer noRegsMessageTimer > noRegsMessageCD2214                overhead "* low mana to summon *" 342215                settimer noRegsMessageTimer 02216            endif2217        endif2218            2219#********** CAST EARTH ELEMENTAL **********# 2220    2221        if earthElementals != 0 and list earthListy < earthElementals and followers < 4 and diffhits < activateAutoHealDiff and not casting and missingSummonRegs = 0 and mana > 492222        2223            cast 'Earth Elemental'2224            @setvar! castingEarth 12225            while not casting                   2226                cast 'Earth Elemental'  2227                if targetexists2228                    hotkey 'cancel current target'2229                endif2230            endwhile  2231            2232            while not dead2233                2234                if diffhits >= interruptCastingDiff2235                    @setvar! wasInterrupted 1 2236                    sysmsg "interrupted low health" 332237                    interrupt2238                    break2239                endif2240                2241                if not casting2242                    getlabel backpack xxx2243                    wait 2002244                    2245                    if insysmsg "Your concentration"2246                        @setvar! wasInterrupted 1 2247                        sysmsg "interrupted concentration" 33   2248                    else 2249                        sysmsg "casting finished" 112250                    endif2251                    2252                    break2253                endif2254                2255                if timer summonMsgTimer > summonMsgCD2256                    overhead "* summoning earth... *" 6342257                    sysmsg "* summoning earth... *" 6342258                    settimer summonMsgTimer 02259                endif2260                2261            endwhile2262 2263            if 0 = wasInterrupted2264                @setvar! summoningSucessful 12265                sysmsg "Summon Earth Successful" 2266                pushlist earthListy 'x' 'front'2267                2268                while not dead2269                    if findtype 158|14 ground -1 -1 12 as ele 2270                        menu ele 12271                        waitfortarget maxwaittimeinms2272                        if targetexists 2273                            if ele != earthFirsty and ele != earthSecondly2274                                hotkey 'cancel current target'2275                                wait 502276                                menu ele 3 2277                                2278                                if earthFirsty = 0 2279                                    @setvar! earthFirsty ele2280                                    sysmsg "add earth 1" 112281                                    overhead "Earth 1" 634 ele2282                                else 2283                                    @setvar! earthSecondly ele2284                                    sysmsg "add earth 2" 112285                                    overhead "Earth 2" 634 ele2286                                endif2287                                2288                                break2289                            endif2290                        endif2291                        @ignore ele2292                    endif2293                endwhile2294                2295                @clearignore2296                @setvar! castingEarth 02297            endif2298            2299#********** CAST WATER ELEMENTAL **********# 2300        2301        elseif waterElementals != 0 and list waterListy < waterElementals and followers < 4 and diffhits < activateAutoHealDiff and not casting and missingSummonRegs = 0 and mana > 492302            cast 'Water Elemental'2303            @setvar! castingWater 12304            while not casting                   2305                cast 'Water Elemental'  2306                if targetexists2307                    hotkey 'cancel current target'2308                endif2309            endwhile 2310            2311            while not dead2312                2313                if diffhits >= interruptCastingDiff2314                    @setvar! wasInterrupted 1 2315                    sysmsg "interrupted low health" 332316                    interrupt2317                    break2318                endif2319                2320                if not casting2321                    getlabel backpack xxx2322                    wait 2002323                    2324                    if insysmsg "Your concentration"2325                        @setvar! wasInterrupted 1 2326                        sysmsg "interrupted concentration" 33   2327                    else 2328                        sysmsg "casting finished" 112329                    endif2330                    2331                    break2332                endif2333                2334                if timer summonMsgTimer > summonMsgCD2335                    overhead "* summoning water... *" 3992336                    sysmsg "* summoning water... *" 3992337                    settimer summonMsgTimer 02338                endif2339                2340            endwhile2341 2342            if 0 = wasInterrupted2343                @setvar! summoningSucessful 12344                sysmsg "Summon Water Successful" 2345                pushlist waterListy 'x' 'front'2346                2347                while not dead2348                    if findtype 740|16 ground -1 -1 12 as ele 2349                        menu ele 12350                        waitfortarget maxwaittimeinms2351                        if targetexists 2352                            if ele != waterFirsty and ele != waterSecondly2353                                hotkey 'cancel current target'2354                                wait 502355                                menu ele 3 2356                                if waterFirsty = 0 2357                                    @setvar! waterFirsty ele2358                                    sysmsg "add water 1" 112359                                    overhead "Water 1" 399 ele2360                                else 2361                                    @setvar! waterSecondly ele2362                                    sysmsg "add water 2" 112363                                    overhead "Water 2" 399 ele2364                                endif2365                                2366                                break2367                            endif2368                        endif2369                        @ignore ele2370                    endif2371                endwhile2372                2373                @clearignore2374                @setvar! castingWater 02375            endif2376        2377#********** CAST AIR ELEMENTAL **********# 2378        2379        elseif airElementals != 0 and list airListy < airElementals and followers < 4 and diffhits < activateAutoHealDiff and not casting and missingSummonRegs = 0 and mana > 49                    2380            cast 'Air Elemental'2381            @setvar! castingAir 12382            while not casting                   2383                cast 'Air Elemental'  2384                if targetexists2385                    hotkey 'cancel current target'2386                endif2387            endwhile  2388            2389            while not dead2390                2391                if diffhits >= interruptCastingDiff2392                    @setvar! wasInterrupted 1 2393                    sysmsg "interrupted low health" 332394                    interrupt2395                    break2396                endif2397                2398                if not casting2399                    getlabel backpack xxx2400                    wait 2002401                    2402                    if insysmsg "Your concentration"2403                        @setvar! wasInterrupted 1 2404                        sysmsg "interrupted concentration" 33   2405                    else 2406                        sysmsg "casting finished" 112407                    endif2408                    2409                    break2410                endif2411                2412                if timer summonMsgTimer > summonMsgCD2413                    overhead "* summoning air... *" 9332414                    sysmsg "* summoning air... *" 9332415                    settimer summonMsgTimer 02416                endif2417                2418            endwhile2419            2420            if 0 = wasInterrupted2421                @setvar! summoningSucessful 12422                sysmsg "Summon Air Successful" 2423                pushlist airListy 'x' 'front'2424                2425                while not dead2426                    if findtype 306|13 ground -1 -1 12 as ele 2427                        menu ele 12428                        waitfortarget maxwaittimeinms2429                        if targetexists 2430                            if ele != airFirsty and ele != airSecondly2431                                hotkey 'cancel current target'2432                                wait 502433                                menu ele 3 2434                                if airFirsty = 0 2435                                    @setvar! airFirsty ele2436                                    sysmsg "add air 1" 112437                                    overhead "Air 1" 933 ele2438                                else 2439                                    @setvar! airSecondly ele2440                                    sysmsg "add air 2" 112441                                    overhead "Air 2" 933 ele2442                                endif2443                                2444                                break2445                            endif2446                        endif2447                        @ignore ele2448                    endif2449                endwhile2450                @clearignore2451                @setvar! castingAir 02452            endif2453        2454#********** CAST FIRE ELEMENTAL **********# 2455        2456        elseif fireElementals != 0 and list fireListy < fireElementals and followers < 4 and diffhits < activateAutoHealDiff and not casting and missingSummonRegs = 0 and mana > 49                      2457            cast 'Fire Elemental'2458            @setvar! castingFire 12459            while not casting                   2460                cast 'Fire Elemental'  2461                if targetexists2462                    hotkey 'cancel current target'2463                endif2464            endwhile  2465            2466            while not dead2467                2468                if diffhits >= interruptCastingDiff2469                    @setvar! wasInterrupted 1 2470                    sysmsg "interrupted low health" 332471                    interrupt2472                    break2473                endif2474                2475                if not casting2476                    getlabel backpack xxx2477                    wait 2002478                    2479                    if insysmsg "Your concentration"2480                        @setvar! wasInterrupted 1 2481                        sysmsg "interrupted concentration" 33   2482                    else 2483                        sysmsg "casting finished" 112484                    endif2485                    2486                    break2487                endif2488                2489                if timer summonMsgTimer > summonMsgCD2490                    overhead "* summoning fire... *" 3532491                    sysmsg "* summoning fire... *" 3532492                    settimer summonMsgTimer 02493                endif2494                2495            endwhile2496            2497            if 0 = wasInterrupted2498                @setvar! summoningSucessful 12499                sysmsg "Summon Fire Successful" 2500                pushlist fireListy 'x' 'front'2501                2502                while not dead2503                    if findtype 24|15 ground -1 -1 12 as ele 2504                        menu ele 12505                        waitfortarget maxwaittimeinms2506                        if targetexists 2507                            if ele != fireFirsty and ele != fireSecondly2508                                hotkey 'cancel current target'2509                                wait 502510                                menu ele 3 2511                                if fireFirsty = 0 2512                                    @setvar! fireFirsty ele2513                                    sysmsg "add fire 1" 112514                                    overhead "Fire 1" 353 ele2515                                else 2516                                    @setvar! fireSecondly ele2517                                    sysmsg "add fire 2" 112518                                    overhead "Fire 2" 353 ele2519                                endif2520                                2521                                break2522                            endif2523                        endif2524                        @ignore ele2525                    endif2526                endwhile2527                @clearignore2528                @setvar! castingFire 02529            endif2530            2531#********** CAST DAEMON **********# 2532        2533        elseif summonDaemons != 0 and list daemonListy < summonDaemons and followers < 4 and diffhits < activateAutoHealDiff and not casting and missingSummonRegs = 0 and mana > 49                        2534            cast 'Summon Daemon'2535            @setvar! castingDaemon 12536            while not casting                   2537                cast 'Summon Daemon'  2538                if targetexists2539                    hotkey 'cancel current target'2540                endif2541            endwhile  2542            2543            while not dead2544                2545                if diffhits >= interruptCastingDiff2546                    @setvar! wasInterrupted 1 2547                    sysmsg "interrupted low health" 332548                    interrupt2549                    break2550                endif2551                2552                if not casting2553                    getlabel backpack xxx2554                    wait 2002555                    2556                    if insysmsg "Your concentration"2557                        @setvar! wasInterrupted 1 2558                        sysmsg "interrupted concentration" 33   2559                    else 2560                        sysmsg "casting finished" 112561                    endif2562                    2563                    break2564                endif2565                2566                if timer summonMsgTimer > summonMsgCD2567                    overhead "* summoning daemon... *" 2352568                    sysmsg "* summoning daemon... *" 2352569                    settimer summonMsgTimer 02570                endif2571                2572            endwhile2573            2574            if 0 = wasInterrupted2575                @setvar! summoningSucessful 12576                sysmsg "Summon Daemon Successful" 2577                pushlist daemonListy 'x' 'front'2578                while not dead2579                    if findtype 9|722 ground -1 -1 12 as ele 2580                        menu ele 12581                        waitfortarget maxwaittimeinms2582                        if targetexists 2583                            if ele != daemonFirsty and ele != daemonSecondly2584                                hotkey 'cancel current target'2585                                wait 502586                                menu ele 3 2587                                2588                                if daemonFirsty = 0 2589                                    @setvar! daemonFirsty ele2590                                    sysmsg "add daemon 1" 112591                                    overhead "Daemon 1" 11 ele2592                                else 2593                                    @setvar! daemonSecondly ele2594                                    sysmsg "add daemon 2" 2352595                                    overhead "Daemon 2" 235 ele2596                                endif2597                                2598                                break2599                            endif2600                        endif2601                        @ignore ele2602                    endif2603                endwhile2604                @clearignore2605                @setvar! castingDaemon 02606            endif2607            2608#********** CAST SUMMON CREATURE **********# 2609        2610        elseif summonCreature != 0 and list creatureListy < summonCreature and followers < 5 and diffhits < activateAutoHealDiff and not casting and missingSummonRegs = 0 and mana > 13                   2611            cast 'Summ. Creature'2612            @setvar! castingCreature 12613            while not casting                   2614                cast 'Summ. Creature'  2615                if targetexists2616                    hotkey 'cancel current target'2617                endif2618            endwhile  2619            2620            while not dead2621                2622                if diffhits >= interruptCastingDiff2623                    @setvar! wasInterrupted 1 2624                    sysmsg "interrupted low health" 332625                    interrupt2626                    break2627                endif2628                2629                if not casting2630                    getlabel backpack xxx2631                    wait 2002632                    2633                    if insysmsg "Your concentration"2634                        @setvar! wasInterrupted 1 2635                        sysmsg "interrupted concentration" 33   2636                    else 2637                        sysmsg "casting finished" 112638                    endif2639                    2640                    break2641                endif2642                2643                if timer summonMsgTimer > summonMsgCD2644                    overhead "* summon creature... *" 8812645                    sysmsg "* summon creature... *" 8812646                    settimer summonMsgTimer 02647                endif2648                2649            endwhile2650 2651            if 0 = wasInterrupted2652                @setvar! summoningSucessful 12653                sysmsg "Summon Creature Successful" 2654                pushlist creatureListy 'x' 'front'2655                while not dead2656                    if findtype 215|211|302|317|225|212|202|213|716|729|51|74|214|206|776|737|718|739|718|29|776|317|302|39|56|26|3|57|50|382|717|736|270 ground -1 -1 12 as ele 2657                        menu ele 12658                        waitfortarget maxwaittimeinms2659                        if targetexists 2660                            if ele != creatureFirsty and ele != creatureSecondly and ele != creatureThirdy and ele != creatureFourthy and ele != creatureFithy2661                                hotkey 'cancel current target'2662                                wait 502663                                menu ele 3                                2664                                if creatureFirsty = 0 2665                                    @setvar! creatureFirsty ele2666                                    sysmsg "add creature 1" 11 2667                                    overhead "Creature 1" 11 ele2668                                elseif creatureSecondly = 0 2669                                    @setvar! creatureSecondly ele2670                                    sysmsg "add creature 2" 112671                                    overhead "Creature 2" 11 ele2672                                elseif creatureThirdy = 0 2673                                    @setvar! creatureThirdy ele2674                                    sysmsg "add creature 3" 112675                                    overhead "Creature 3" 11 ele2676                                elseif creatureFourthy = 0 2677                                    @setvar! creatureFourthy ele2678                                    sysmsg "add creature 4" 112679                                    overhead "Creature 4" 11 ele2680                                elseif creatureFithy = 0 2681                                    @setvar! creatureFithy ele2682                                    sysmsg "add creature 5" 112683                                    overhead "Creature 5" 11 ele2684                                endif2685                                2686                                break2687                            endif2688                        endif2689                        @ignore ele2690                    endif2691                endwhile2692                2693                @clearignore2694                @setvar! castingCreature 02695            endif2696            2697        endif2698    2699    endwhile2700    2701#********* CARVE CORPSE *********2702    2703    while 1 = autoCarveNearestCorpse and findtype "corpse" ground -1 -1 2 as corpsy and diffhits < activateAutoHealDiff and findtype 11552 backpack2704        2705        if timer carveTimer > carveCD2706            if targetexists2707                hotkey 'cancel current target'2708            endif2709            while not targetexists 2710                skill 'forensicevaluation'2711            endwhile2712            2713            if targetexists and find corpsy ground -1 -1 22714                sysmsg "Skinning corpse.." 112715                target 'self'    2716                @ignore corpsy2717                settimer carveTimer 02718            endif2719        endif2720    endwhile2721 2722#********* MANUAL-SELECT NEW TARGET *********2723 2724    if 2 = targetSelectionMode2725 2726        if insysmsg "target a new"2727            @setvar! currentTarget 02728            @setvar! foundTarget 02729            2730            if targetexists2731                hotkey 'cancel current target'2732            endif2733            if insysmsg "Select"2734            endif2735            2736            overhead "Select Target: " 552737            @setvar! tempTarget   2738            getlabel backpack xxx2739            wait 2002740        endif    2741        2742        if insysmsg "Select"2743            if not find tempTarget ground -1 -1 122744                overhead "* Target Not Found *" 342745            endif2746        endif2747 2748        if find tempTarget ground -1 -1 12 and not dead tempTarget2749            if previousTarget != tempTarget2750                settimer curseTimer curseCD2751                settimer manaDrainTimer manaDrainCD2752            endif2753        2754            @setvar! foundTarget 1 2755            @setvar! currentTarget tempTarget2756            @setvar! previousTarget currentTarget2757            attack currentTarget2758            getlabel currentTarget myLabel2759            sysmsg "Target: {{myLabel}}" 55          2760        else 2761            if timer targetSelectTimer > targetSelectCD2762                overhead "* Waiting for Target *" 112763                settimer targetSelectTimer 0    2764            endif2765        endif2766        wait 200    2767        2768    elseif 0 = targetSelectionMode or warmode on 2769 2770#********* AUTO-SELECT NEW TARGET *********2771        2772        if not find currentTarget ground -1 -1 122773            @setvar! currentTarget 02774            @setvar! foundTarget 02775            2776            if targetexists2777                hotkey 'cancel current target'2778            endif2779            2780            hotkey 'target closest grey monster'2781            #sysmsg "hotkey closest" 552782            2783            if not find lasttarget ground -1 -1 122784                if timer noTargetMessageTimer > noTargetMessageCD2785                    overhead 'No target nearby' 332786                    settimer noTargetMessageTimer 02787                endif2788            elseif noto lasttarget = "friend" or noto lasttarget = "innocent"2789                if timer noTargetMessageTimer > noTargetMessageCD2790                    overhead 'No target nearby' 332791                    settimer noTargetMessageTimer 02792                endif            2793            elseif not dead lasttarget2794                @setvar! tempTarget lasttarget2795                while diffhits < activateAutoHealDiff2796                    if timer searchingMessageTimer > searchingTargetMessageCD2797                        overhead '* Searching target *' 902798                        settimer searchingMessageTimer 02799                    endif2800                    if maxFollowers > 02801                        if followers < breakCastingWhenFollowersBelow  and useMeditationSkill = 12802                            sysmsg "breaking search to cast elementals" 112803                            break2804                        endif2805                    endif2806                    2807                    @setvar! tempTarget lasttarget 2808                                       2809                    if index != 0 2810                        hotkey "next non-friendly monster target"2811                        #sysmsg "hotkey non-friendly" 552812                        @setvar! tempTarget lasttarget 2813                        #overhead "*{{index}}*" 34 tempTarget2814                        2815                        #if index = 12816                        #    @setvar! firstTarget lasttarget2817                        #elseif firstTarget = tempTarget2818                        #    @setvar! foundTarget 22819                        #    break2820                        #endif2821                    endif2822                    2823                    if find tempTarget ground -1 -1 122824                        if insysmsg "Target cannot be seen"2825                        endif2826                        if insysmsg "That is too far away."2827                        endif2828                        if insysmsg "You must wait"2829                        endif2830                        if insysmsg "Perhaps"2831                        endif2832                        if insysmsg "You are too far away from them."2833                        endif2834                        if insysmsg "They do not appear to have anything to offer you."2835                        endif2836                        2837                        getlabel tempTarget tempLabel2838                        2839                        @settimer! labelFixTimer 02840                        while "-" in tempLabel2841                            if dead tempTarget or not find tempTarget ground -1 -1 122842                                break2843                            endif2844                            if timer labelFixTimer > labelFixTimeoutCD2845                                sysmsg "* label stuck - skipping fix *" 342846                                break2847                            endif2848                            sysmsg "* correcting target label.. *" 342849                            getlabel tempTarget tempLabel2850                        endwhile2851                        2852                        if inlist animalsIgnoreList tempLabel2853                            @ignore tempTarget2854                            2855                        elseif ignoreSummonedBondedTamed = 1 and "(summoned" in tempLabel2856                            @ignore tempTarget2857                            2858                        elseif ignoreSummonedBondedTamed = 1 and "(bonded" in tempLabel2859                            @ignore tempTarget2860                            2861                        elseif ignoreSummonedBondedTamed = 1 and "(tame" in tempLabel2862                            @ignore tempTarget2863                            2864                        else2865                            skill 'begging'2866                            while not targetexists2867                               if insysmsg! 'you must wait'2868                                    break2869                               endif2870                            endwhile2871                            if not insysmsg! 'you must wait'2872                                target tempTarget2873                                getlabel backpack xxx2874                                wait 2002875                            endif2876                            2877                            if not dead tempTarget2878                                if insysmsg "Target cannot be seen"2879                                    sysmsg "*Not visible* [{{index}}]" 442880                                    overhead  "*Not visible* [{{index}}]" 44 tempTarget2881                                elseif insysmsg "That is too far away."2882                                    overhead "*Too far* [{{index}}]" 44 tempTarget2883                                #elseif insysmsg "You must wait"2884                                    #overhead "*Skill cooldown*" 112885                                    #sysmsg "*Skill cooldown*" 112886                                    #break2887                                elseif insysmsg "Perhaps" or insysmsg "You are too far away from them." or insysmsg "They do not appear to have anything to offer you." or insysmsg! "You must wait"2888                                    2889                                    if insysmsg "You must wait"2890                                        sysmsg "* target skill cooldown targetting closest mob *" 342891                                        hotkey 'target closest grey monster'   2892                                        @setvar! tempTarget lasttarget 2893                                    endif2894                                    2895                                    if previousTarget != tempTarget2896                                        settimer curseTimer curseCD2897                                        settimer manaDrainTimer manaDrainCD2898                                    endif2899                                2900                                    @setvar! foundTarget 1 2901                                    @setvar! currentTarget tempTarget2902                                    @setvar! previousTarget currentTarget2903                                    attack currentTarget2904                                    sysmsg "Target: {{tempLabel}}" 552905                                    overhead "Target found!" 662906                                    break2907                                endif2908                            endif2909                        endif2910                    endif2911                    2912                    if targetexists2913                        hotkey 'cancel current target'2914                    endif2915 2916                    if casting 2917                        interrupt2918                    endif    2919 2920                #********* DROP GOLD IF OVERWEIGHT *********2921                2922                    if weight > maxweight2923                        if timer overweightMessageTimer > overweightMessageCD2924                            overhead "Overweight !!" 342925                            settimer overweightMessageTimer 02926                        endif2927                        2928                        if 0 != amountOfGoldToDrop2929                            while weight > maxweight2930                                if findtype "gold coin" backpack as item2931                                    lift item amountOfGoldToDrop2932                                    droprelloc 0 02933                                    getlabel backpack xxx2934                                    wait 2002935                                    if insysmsg "cannot drop anything"2936                                        drop backpack -1 -1 -12937                                    endif2938                                    wait maxwaittimeinms2939                                    overhead "* Gold Dropped *" 552940                                endif2941                            endwhile            2942                        endif2943                    endif2944    2945                #********* CARVE CORPSE *********2946                    2947                    while 1 = autoCarveNearestCorpse and findtype "corpse" ground -1 -1 2 as corpsy and diffhits < activateAutoHealDiff and findtype 11552 backpack2948                        if timer carveTimer > carveCD2949                            if targetexists2950                                hotkey 'cancel current target'2951                            endif2952                            while not targetexists 2953                                skill 'forensicevaluation'2954                            endwhile2955                            2956                            if targetexists and find corpsy ground -1 -1 22957                                sysmsg "Skinning corpse.." 112958                                target 'self'    2959                                @ignore corpsy2960                                settimer carveTimer 02961                            endif2962                        endif2963                    endwhile2964                    2965                endwhile2966            endif2967            2968            if targetexists2969                hotkey 'cancel current target'2970            endif2971        endif2972    endif2973    2974    #--- Use Meditation ---#2975    2976    if 1 = useMeditationSkill and mana < 50 and not findbuff "meditating" and timer meditationTimer > meditationCD2977        if insysmsg "you are at peace"2978        endif2979        if insysmsg "you enter a meditative trance"2980        endif2981        if insysmsg "You must wait a few moments to use another skill."2982        endif2983        2984        skill 'meditation'2985        getlabel backpack xxx2986        wait 2002987        if not findbuff 'meditating'2988            settimer meditationTimer 75002989        elseif findbuff 'meditating'2990            warmode on2991            warmode off2992            settimer meditationTimer 02993            while mana < 50 and diffhits < activateAutoHealDiff2994                if not findbuff 'meditating'2995                    break2996                endif2997                if timer meditationMessageTimer > meditationMessageCD2998                    overhead "* actively meditating *" 112999                    settimer meditationMessageTimer 03000                endif3001            endwhile3002        endif3003    endif 3004    3005    @setvar! petsCurrentlyAttacking 0 3006    3007#********** BEGIN AUTO ATTACKING LOOP **********#    3008    3009    while foundTarget = 1 and not dead currentTarget and find currentTarget ground -1 -1 12 and diffhits < activateAutoHealDiff and mana >= minimumManaToCastAnyDamageSpells3010        3011        if not findtype 3972 or not findtype 3962  or not findtype 3963 or not findtype 3980 or not findtype 3976 or not findtype 3973 or not findtype 3974 or not findtype 39813012            @setvar! missingRegs 13013            if timer noRegsMessageTimer > noRegsMessageCD3014                overhead "* Missing Reagents *" 343015                settimer noRegsMessageTimer 03016            endif3017        endif3018        3019        #--- Eat food ---#3020        3021        if not findbuff "food" 3022            if findtype "tray" backpack as fody    3023                dclick fody3024                wait 2003025            else 3026                if timer foodMessageTimer > foodMessageCD3027                    overhead "No food found!" 343028                    settimer foodMessageTimer 03029                endif3030            endif3031        endif3032        3033        #--- Drink str pot ---#3034        3035        if drinkStr = 1 and str < strengthLowerThan3036            if not findbuff "Strength" 3037                if findtype "White Potion" self3038                    dclicktype "White Potion"3039                    wait 2003040                else3041                    if timer whiteMessageTimer > whiteMessageCD3042                        overhead "Out of str pots" 343043                        settimer whiteMessageTimer 0 3044                    endif3045                endif3046            endif3047        endif3048        3049        #--- Drink agility pot ---#3050        3051        if drinkAgility = 13052            if not findbuff "Agility" 3053                if findtype "Blue Potion" self3054                    dclicktype "Blue Potion"3055                    sysmsg "agility pot" 863056                    wait 2003057                else3058                    if timer blueMessageTimer > blueMessageCD3059                        overhead "Out of agility pots" 343060                        settimer blueMessageTimer 0 3061                    endif3062                endif3063            endif3064        endif3065            3066        #--- Drink magic resist pot ---#3067    3068        if drinkMagicResist = 13069            if not findbuff "Magic Resist" 3070                if findtype "Black Potion" self3071                    dclicktype "Black Potion"3072                    sysmsg "magic resist pot" 1113073                    wait 2003074                else3075                    if timer blackMessageTimer > blackMessageCD3076                        overhead "Out of resist pots" 343077                        settimer blackMessageTimer 03078                    endif3079                endif3080            endif3081        endif3082        3083        #--- Drink red pot ---#3084        3085        if diffstam > drinkWhenMissingStamina and 1 = drinkRefresh3086            if findtype "Red Potion" self3087                dclicktype "Red Potion"3088                sysmsg "refresh pot" 363089                wait 2003090            else3091                if timer redMessageTimer > redMessageCD3092                    overhead "Out of refresh pots" 343093                    settimer redMessageTimer 0 3094                endif3095            endif3096        endif3097 3098        @setvar! castingInterrupted 03099        #sysmsg 'found target' 553100        3101        if targetexists3102            hotkey 'cancel current target'3103        endif3104        3105        if followers > 0 and 0 = petsCurrentlyAttacking and timer allGuardTimer > allGuardCD3106            sysmsg "all kill" 11 3107            if followerAttackmode = 03108                say "ALL Kill" 343109            else3110                say "ALL Patrol" 343111            endif3112            3113            while not targetexists3114                wait 2003115                if not targetexists3116                    if followerAttackmode = 03117                        say "ALL Kill" 343118                    else3119                        say "ALL Patrol" 343120                    endif3121                endif3122            endwhile3123            target currentTarget3124            @setvar! petsCurrentlyAttacking 1 3125            settimer allGuardTimer 03126        elseif followers > 0 and 1 = petsCurrentlyAttacking and timer allGuardTimer > allGuardCD3127            sysmsg "attack loop: all guard"3128            say 'ALL Guard ME' 343129            settimer allGuardTimer 03130            @setvar! petsCurrentlyAttacking 23131        endif  3132        3133        #--- Create mushroom ---#3134    3135        if counttype 29012 backpack = 0 and missingRegs = 03136            while counttype 29012 backpack < mushroomCount and mana > 3 and diffhits < activateAutoHealDiff3137                if not casting3138                    cast 'create food'3139                endif3140            endwhile3141        endif 3142        3143        #--- Eat Mushroom ---# 3144 3145        if mana < eatMushWhenManaLowerThan and mushroomCount > 0 and timer mushroomTimer > mushroomTimerCD3146            if counttype 29012 backpack3147                if insysmsg "You consume a magic mushroom"3148                endif3149                sysmsg "Eating mush." 443150                dclicktype 29012 backpack3151                getlabel backpack xxx3152                wait 2003153                3154                if insysmsg "You consume a magic mushroom"3155                    settimer mushroomTimer 03156                endif3157            else 3158                overhead "No mushrooms found!" 343159            endif3160        endif3161        3162        #--- Use Meditation ---#3163        3164        if 1 = useMeditationSkill and mana < meditateWhenManaBelow and not findbuff "meditating" and timer meditationTimer > meditationCD3165            if insysmsg "you are at peace"3166            endif3167            if insysmsg "you enter a meditative trance"3168            endif3169            if insysmsg "You must wait a few moments to use another skill."3170            endif3171            3172            skill 'meditation'3173            getlabel backpack xxx3174            wait 2003175            if not findbuff 'meditating'3176                settimer meditationTimer 75003177            elseif findbuff 'meditating'3178                warmode on3179                warmode off3180                settimer meditationTimer 03181                while mana < meditateUntilManaReach and diffhits < activateAutoHealDiff3182                    if not findbuff 'meditating'3183                        break3184                    endif3185                    if timer meditationMessageTimer > meditationMessageCD3186                        overhead "* actively meditating *" 113187                        settimer meditationMessageTimer 03188                    endif3189                endwhile3190            endif3191        endif  3192        3193        if 2 = targetSelectionMode3194            if insysmsg! "target a new"3195                sysmsg "Breaking to set last target!" 443196                break3197            endif3198        endif3199        3200        3201#********** CHECK POISONING STATUS **********#3202        3203        if castPoison = 1 and not dead currentTarget and find currentTarget ground -1 -1 123204             3205            @setvar! repeatCastingPoison 13206            3207            @settimer! labelFixTimer 03208            while not dead currentTarget and find currentTarget ground -1 -1 123209                getlabel currentTarget targetLabel3210                if "-" in targetLabel3211                    if timer labelFixTimer > labelFixTimeoutCD3212                        sysmsg "* label stuck - skipping fix *" 343213                        break3214                    endif3215                    getlabel currentTarget targetLabel3216                    sysmsg "fixing poison label" 343217                else3218                    break3219                endif3220            endwhile3221            3222            if "Ticks" in targetLabel or "resists" in targetLabel3223                3224                if timer poisonLabelTimer > poisonLabelCD3225                    overhead targetLabel 443226                    overhead targetLabel  44 currentTarget3227                    settimer poisonLabelTimer 03228                endif     3229                3230                if 2 = poisonLevel3231                    if "Lethal" in targetLabel3232                        @setvar! repeatCastingPoison 03233                    endif3234                elseif 1 = poisonLevel3235                    if "Lethal" in targetLabel or "Deadly" in targetLabel3236                        @setvar! repeatCastingPoison 03237                    endif3238                else 3239                    @setvar! repeatCastingPoison 03240                endif3241                3242                if 0 = repeatCastingPoison and 0 != NecroPoisonStrike 3243                    @setvar! castStrike 03244                    3245                    if ingump "20/" 6224365163246                        @setvar! unholyPoints 203247                    elseif ingump "19/" 6224365163248                        @setvar! unholyPoints 193249                    elseif ingump "18/" 6224365163250                        @setvar! unholyPoints 183251                    elseif ingump "17/" 6224365163252                        @setvar! unholyPoints 173253                    elseif ingump "16/" 6224365163254                        @setvar! unholyPoints 163255                    elseif ingump "15/" 6224365163256                        @setvar! unholyPoints 153257                    elseif ingump "14/" 6224365163258                        @setvar! unholyPoints 143259                    elseif ingump "13/" 6224365163260                        @setvar! unholyPoints 133261                    elseif ingump "12/" 6224365163262                        @setvar! unholyPoints 123263                    elseif ingump "11/" 6224365163264                        @setvar! unholyPoints 113265                    elseif ingump "10/" 6224365163266                        @setvar! unholyPoints 103267                    elseif ingump "9/" 6224365163268                        @setvar! unholyPoints 93269                    elseif ingump "8/" 6224365163270                        @setvar! unholyPoints 83271                    elseif ingump "7/" 6224365163272                        @setvar! unholyPoints 73273                    elseif ingump "6/" 6224365163274                        @setvar! unholyPoints 63275                    elseif ingump "5/" 6224365163276                        @setvar! unholyPoints 53277                    elseif ingump "4/" 6224365163278                        @setvar! unholyPoints 43279                    elseif ingump "3/" 6224365163280                        @setvar! unholyPoints 33281                    elseif ingump "2/" 6224365163282                        @setvar! unholyPoints 23283                    elseif ingump "1/" 6224365163284                        @setvar! unholyPoints 13285                    else 3286                        @setvar unholyPoints 03287                    endif  3288                    3289                    if 1 = NecroPoisonStrike 3290                        if "[1" in targetLabel3291                            @setvar! castStrike 13292                        endif3293                    elseif 2 = NecroPoisonStrike 3294                        if "[2" in targetLabel3295                            @setvar! castStrike 13296                        endif3297                    elseif 3 = NecroPoisonStrike 3298                        if "[2" in targetLabel or "[3" in targetLabel3299                            @setvar! castStrike 1 3300                        endif                    3301                    elseif 4 = NecroPoisonStrike 3302                        if "[2" in targetLabel or "[3" in targetLabel or "[4" in targetLabel3303                            @setvar! castStrike 1 3304                        endif                      3305                    elseif 5 = NecroPoisonStrike 3306                        if "[2" in targetLabel or "[3" in targetLabel or "[4" in targetLabel or "[5" in targetLabel3307                            @setvar! castStrike 1 3308                        endif                      3309                    elseif 6 = NecroPoisonStrike 3310                        if "[2" in targetLabel or "[3" in targetLabel or "[4" in targetLabel or "[5" in targetLabel or "[6" in targetLabel3311                            @setvar! castStrike 1 3312                        endif                         3313                    elseif 7 = NecroPoisonStrike 3314                        if "[2" in targetLabel or "[3" in targetLabel or "[4" in targetLabel or "[5" in targetLabel or "[6" in targetLabel or "[7" in targetLabel3315                            @setvar! castStrike 1 3316                        endif                    3317                    elseif 8 = NecroPoisonStrike 3318                        if "[2" in targetLabel or "[3" in targetLabel or "[4" in targetLabel or "[5" in targetLabel or "[6" in targetLabel or "[7" in targetLabel or "[8" in targetLabel3319                            @setvar! castStrike 1 3320                        endif                      3321                    elseif 9 = NecroPoisonStrike 3322                        if "[2" in targetLabel or "[3" in targetLabel or "[4" in targetLabel or "[5" in targetLabel or "[6" in targetLabel or "[7" in targetLabel or "[8" in targetLabel or "[9" in targetLabel3323                            @setvar! castStrike 1 3324                        endif                      3325                    elseif 10 = NecroPoisonStrike 3326                        if "[2" in targetLabel or "[3" in targetLabel or "[4" in targetLabel or "[5" in targetLabel or "[6" in targetLabel or "[7" in targetLabel or "[8" in targetLabel or "[9" in targetLabel or "[10" in targetLabel3327                            @setvar! castStrike 1 3328                        endif                       3329                    endif3330                    3331                endif3332            endif3333        endif3334        3335        if ingump "20/" 6224365163336            @setvar! unholyPoints 203337        elseif ingump "19/" 6224365163338            @setvar! unholyPoints 193339        elseif ingump "18/" 6224365163340            @setvar! unholyPoints 183341        elseif ingump "17/" 6224365163342            @setvar! unholyPoints 173343        elseif ingump "16/" 6224365163344            @setvar! unholyPoints 163345        elseif ingump "15/" 6224365163346            @setvar! unholyPoints 153347        elseif ingump "14/" 6224365163348            @setvar! unholyPoints 143349        elseif ingump "13/" 6224365163350            @setvar! unholyPoints 133351        elseif ingump "12/" 6224365163352            @setvar! unholyPoints 123353        elseif ingump "11/" 6224365163354            @setvar! unholyPoints 113355        elseif ingump "10/" 6224365163356            @setvar! unholyPoints 103357        elseif ingump "9/" 6224365163358            @setvar! unholyPoints 93359        elseif ingump "8/" 6224365163360            @setvar! unholyPoints 83361        elseif ingump "7/" 6224365163362            @setvar! unholyPoints 73363        elseif ingump "6/" 6224365163364            @setvar! unholyPoints 63365        elseif ingump "5/" 6224365163366            @setvar! unholyPoints 53367        elseif ingump "4/" 6224365163368            @setvar! unholyPoints 43369        elseif ingump "3/" 6224365163370            @setvar! unholyPoints 33371        elseif ingump "2/" 6224365163372            @setvar! unholyPoints 23373        elseif ingump "1/" 6224365163374            @setvar! unholyPoints 13375        else 3376            @setvar unholyPoints 03377        endif 3378        3379        if drinkExplosionPotion = 1 3380            if findtype 'purple potion' self as explotPot 3381                getlabel explotPot potLabel3382                if "(" in potLabel3383                    if timer explosionPotionTimer > prioritizeExplosionWhenTimerAbove3384                        @setvar! isExplosionPotReady 13385                    else3386                        @setvar! isExplosionPotReady 03387                    endif3388                else3389                    @setvar! isExplosionPotReady 1    3390                endif3391            endif3392        endif3393        3394#********** DRINK EXPLO POT  **********#    3395        3396        if isExplosionPotReady = 1 and not dead currentTarget and find currentTarget ground -1 -1 123397            @setvar! isExplosionPotReady 03398            3399            if insysmsg "Where should i throw this potion?"3400            endif              3401            3402            while not insysmsg "Where should i throw this potion?"3403                potion 'explosion'3404            endwhile3405            3406            sysmsg "Explosion Pot {{explosionPotionTimer}}" 1243407            settimer explosionPotionTimer 03408            3409            while not targetexists 3410                if dead currentTarget and not find currentTarget ground -1 -1 123411                    @setvar! castingInterrupted 13412                    hotkey 'cancel current target'3413                    break3414                endif3415                sysmsg index3416            endwhile3417            if 0 = castingInterrupted3418                target currentTarget3419                getlabel backpack xxx3420                wait 2003421            endif3422            3423#********** CAST POISON  **********#          3424         3425        elseif repeatCastingPoison = 1 and diffhits < activateAutoHealDiff and mana >= 9 and not dead currentTarget and find currentTarget ground -1 -1 12 and findtype 3976 self3426            3427            if insysmsg "Your concentration is disturbed"3428            endif       3429            if insysmsg "target cannot be seen"3430            endif  3431            sysmsg "poison" 113432            cast 'Poison'           3433            while not casting   3434                if targetexists3435                    hotkey 'cancel current target'3436                endif3437                cast 'Poison'             3438            endwhile  3439            3440            while not targetexists3441                if dead currentTarget and not find currentTarget ground -1 -1 123442                    interrupt3443                    @setvar! castingInterrupted 13444                    break3445                endif3446                if insysmsg "Your concentration is disturbed"3447                    interrupt3448                    @setvar! castingInterrupted 13449                    break                3450                endif3451            endwhile3452                3453            if 0 = castingInterrupted and 1 = NecroMindRot and 2 < unholyPoints and timer mindRotTimer > mindRotCD and skill 'necromancy' >= 75 3454                if insysmsg "unholy symbols remaining"3455                endif3456                if insysmsg "seconds before you may use that ability again."3457                endif3458                3459                @setvar! mindRotInterrupted 03460                @settimer! necroAbilityTimer 03461 3462                while not insysmsg "unholy symbols remaining"3463                    if dead currentTarget and not find currentTarget ground -1 -1 123464                        @setvar! mindRotInterrupted 13465                        break3466                    endif3467                    if timer necroAbilityTimer > necroAbilityTimeoutCD3468                        sysmsg "mindrot no response" 443469                        @setvar! mindRotInterrupted 13470                        settimer mindRotTimer necroMarginErrorCD3471                        break3472                    endif3473                    sysmsg "mindrot" 663474                    hotkey 'mind rot'3475                    getlabel backpack xxx3476                    wait 2003477                    if insysmsg "seconds before you may use that ability again."3478                        @setvar! mindRotInterrupted 13479                        settimer mindRotTimer necroMarginErrorCD3480                        sysmsg "mindrot on cooldown" 443481                        break    3482                    endif3483                endwhile3484                3485                if 0 = mindRotInterrupted3486                    overhead '[>Mind Rot<]' 443487                    settimer mindRotTimer 03488                endif3489            endif3490            3491            if 0 = castingInterrupted3492                target currentTarget3493                getlabel backpack xxx3494                wait 200 3495                3496                if insysmsg "target cannot be seen"3497                    sysmsg "Poison - resetting target" 113498                    @setvar! foundTarget 03499                    @setvar! currentTarget 03500                    break3501                endif3502            endif3503 3504#********* CAST NECRO POISON STRIKE *********   3505 3506        elseif 1 = castStrike and 0 < unholyPoints and timer poisonStrikeTimer > poisonStrikeCD and skill 'necromancy' >= 55 and diffhits < activateAutoHealDiff and not dead currentTarget and find currentTarget ground -1 -1 123507            if insysmsg "unholy symbols remaining"3508            endif3509            if insysmsg "seconds before you may use that ability again."3510            endif3511            if insysmsg "You do not have a Spell-based poison or disease effect on that target."3512            endif3513            3514            while not insysmsg! "unholy symbols remaining"3515                if dead currentTarget and not find currentTarget ground -1 -1 123516                    break3517                endif 3518                3519                sysmsg "strike" 663520                hotkey 'poison strike'3521                waitfortarget maxwaittimeinms3522                target currentTarget3523                getlabel backpack xxx3524                wait 200                3525                3526                if insysmsg "seconds before you may use that ability again."3527                    sysmsg "Poison Strike Cooldown" 443528                    settimer poisonStrikeTimer necroMarginErrorCD3529                    break3530                elseif insysmsg "You do not have a Spell-based poison or disease effect on that target."3531                    sysmsg "Target not Poisoned for Strike" 443532                    settimer poisonStrikeTimer necroMarginErrorCD3533                    break3534                endif             3535            endwhile3536            3537            if insysmsg "unholy symbols remaining"3538                overhead '[>Poison Strike<]' 443539                settimer poisonStrikeTimer 03540            endif3541 3542#********** CAST CURSE  **********#    3543 3544        elseif 1 = castCurse and timer curseTimer > curseCD and mana >= 11 and diffhits < activateAutoHealDiff and not dead currentTarget and find currentTarget ground -1 -1 12 and findtype 3972 self and findtype 3976 self and findtype 3980 self3545            if insysmsg "Your concentration is disturbed"3546            endif       3547            if insysmsg "target cannot be seen"3548            endif           3549            sysmsg "Curse" 113550            cast 'Curse'           3551            while not casting   3552                if targetexists3553                    hotkey 'cancel current target'3554                endif3555                cast 'Curse'             3556            endwhile  3557            3558            @settimer! spellTimer 0  3559            @setvar! spellCD 800    3560            3561            while not targetexists3562                if diffhits >= interruptCastingDiff3563                    interrupt3564                    @setvar! castingInterrupted 1 3565                    break3566                endif3567                if dead currentTarget and not find currentTarget ground -1 -1 123568                    interrupt3569                    @setvar! castingInterrupted 13570                    break3571                endif3572                if insysmsg "Your concentration is disturbed"3573                    interrupt3574                    @setvar! castingInterrupted 13575                    break                3576                endif     3577                3578                if timer spellTimer < spellCD3579                    #--- Poisoned ---#3580                    3581                    if 1 = drinkCure3582                        while poisoned and casting and not targetexists3583                            if findtype "Orange Potion" self3584                                sysmsg "pot cure - curse" 113585                                dclicktype "Orange Potion"3586                                sysmsg "cure pot" 443587                                wait 2003588                            else3589                                if timer orangeMessageTimer > orangeMessageCD3590                                    overhead "Out of cure pots" 343591                                    settimer orangeMessageTimer 03592                                endif3593                                break3594                            endif3595                        endwhile3596                    endif            3597                3598                    #--- Drink Heal Pot ---#3599                    3600                    if diffhits >= drinkHealPotDiff and 1 = drinkHeal3601                        if findtype "Yellow Potion" self as hPot3602                            getlabel hPot potLabel3603                            if "(" in potLabel3604                            else3605                                dclicktype 38523606                                getlabel backpack xxx3607                                sysmsg "heal pot" 553608                            endif3609                        else3610                            if timer yellowMessageTimer > yellowMessageCD3611                                overhead "Out of heals pots" 343612                                settimer yellowMessageTimer 03613                            endif3614                        endif3615                    endif3616                    3617                endif3618                3619            endwhile3620            3621            if 0 = castingInterrupted3622                settimer curseTimer 03623                target currentTarget3624                getlabel backpack xxx3625                wait 2003626                3627                if insysmsg "target cannot be seen"3628                    sysmsg "Curse - resetting target" 113629                    @setvar! foundTarget 03630                    @setvar! currentTarget 03631                    break3632                endif3633            endif      3634            3635#********** CAST MANA DRAIN  **********#3636 3637        elseif 1 = castManaDrain and timer manaDrainTimer > manaDrainCD and mana >= 11 and diffhits < activateAutoHealDiff and not dead currentTarget and find currentTarget ground -1 -1 12 and findtype 3962 self and findtype 3974 self and findtype 3981 self3638            if insysmsg "Your concentration is disturbed"3639            endif       3640            if insysmsg "target cannot be seen"3641            endif              3642            sysmsg "Drain" 11 3643            cast 'Mana Drain'           3644            while not casting   3645                if targetexists3646                    hotkey 'cancel current target'3647                endif3648                cast 'Mana Drain'            3649            endwhile  3650            3651            @settimer! spellTimer 0  3652            @setvar! spellCD 800  3653            3654            while not targetexists3655                if diffhits >= interruptCastingDiff3656                    interrupt3657                    @setvar! castingInterrupted 1 3658                    break3659                endif3660                if dead currentTarget and not find currentTarget ground -1 -1 123661                    interrupt3662                    @setvar! castingInterrupted 13663                    break3664                endif3665                if insysmsg "Your concentration is disturbed"3666                    interrupt3667                    @setvar! castingInterrupted 13668                    break                3669                endif3670                3671                if timer spellTimer < spellCD3672                    #--- Poisoned ---#3673                    3674                    if 1 = drinkCure3675                        while poisoned and casting and not targetexists 3676                            if findtype "Orange Potion" self3677                                sysmsg "pot cure - drain" 113678                                dclicktype "Orange Potion"3679                                sysmsg "cure pot" 443680                                wait 2003681                            else3682                                if timer orangeMessageTimer > orangeMessageCD3683                                    overhead "Out of cure pots" 343684                                    settimer orangeMessageTimer 03685                                endif3686                                break3687                            endif3688                        endwhile3689                    endif            3690                3691                    #--- Drink Heal Pot ---#3692                    3693                    if diffhits >= drinkHealPotDiff and 1 = drinkHeal3694                        if findtype "Yellow Potion" self as hPot3695                            getlabel hPot potLabel3696                            if "(" in potLabel3697                            else3698                                dclicktype 38523699                                getlabel backpack xxx3700                                sysmsg "heal pot" 553701                            endif3702                        else3703                            if timer yellowMessageTimer > yellowMessageCD3704                                overhead "Out of heals pots" 343705                                settimer yellowMessageTimer 03706                            endif3707                        endif3708                    endif3709                    3710                endif3711                3712            endwhile3713 3714            if 0 = castingInterrupted3715                settimer manaDrainTimer 03716                target currentTarget3717                getlabel backpack xxx3718                wait 2003719                3720                if insysmsg "target cannot be seen"3721                    sysmsg "Drain - resetting target" 113722                    @setvar! foundTarget 03723                    @setvar! currentTarget 03724                    break3725                endif3726            endif 3727            3728#********* CAST NECRO STRANGLE *********            3729            3730        elseif 1 = NecroStrangle and 3 < unholyPoints and timer strangleTimer > strangleCD and skill 'necromancy' >= 85 and mana >= minManaToUseDamageBuffNecroSpells and diffhits < activateAutoHealDiff and not dead currentTarget and find currentTarget ground -1 -1 123731            if insysmsg "unholy symbols remaining"3732            endif3733            if insysmsg "seconds before you may use that ability again."3734            endif3735 3736            @settimer! necroAbilityTimer 03737 3738            while not insysmsg "unholy symbols remaining"3739                if dead currentTarget and not find currentTarget ground -1 -1 123740                    @setvar! castingInterrupted 13741                    break3742                endif3743                if timer necroAbilityTimer > necroAbilityTimeoutCD3744                    sysmsg "strangle no response" 443745                    @setvar! castingInterrupted 13746                    settimer strangleTimer necroMarginErrorCD3747                    break3748                endif3749                sysmsg "strangle" 663750                hotkey 'strangle'3751                getlabel backpack xxx3752                wait 2003753                if insysmsg "seconds before you may use that ability again."3754                    sysmsg "strangle on cooldown" 443755                    @setvar! castingInterrupted 13756                    settimer strangleTimer necroMarginErrorCD3757                    break    3758                endif3759            endwhile3760            3761            if 0 = castingInterrupted3762                overhead '[>Strangle<]' 443763                settimer strangleTimer 03764            endif3765            3766#********* CAST NECRO CORPSE SKIN *********3767            3768        elseif 1 = NecroCorpseSkin and 1 < unholyPoints and timer corpseSkinTimer > corpseSkinCD and skill 'necromancy' >= 65 and mana >= minManaToUseDamageBuffNecroSpells and diffhits < activateAutoHealDiff and not dead currentTarget and find currentTarget ground -1 -1 123769            if insysmsg "unholy symbols remaining"3770            endif3771            if insysmsg "seconds before you may use that ability again."3772            endif3773 3774            @settimer! necroAbilityTimer 03775 3776            while not insysmsg "unholy symbols remaining"3777                if dead currentTarget and not find currentTarget ground -1 -1 123778                    @setvar! castingInterrupted 13779                    break3780                endif3781                if timer necroAbilityTimer > necroAbilityTimeoutCD3782                    sysmsg "corpseskin no response" 443783                    @setvar! castingInterrupted 13784                    settimer corpseSkinTimer necroMarginErrorCD3785                    break3786                endif3787                sysmsg "corpseskin" 663788                hotkey 'corpse skin'3789                getlabel backpack xxx3790                wait 2003791                if insysmsg "seconds before you may use that ability again."3792                    sysmsg "necro margin error 2" 443793                    @setvar! castingInterrupted 13794                    settimer corpseSkinTimer necroMarginErrorCD3795                    break    3796                endif3797            endwhile3798            3799            if 0 = castingInterrupted3800                overhead '[>Corpse Skin<]' 443801                settimer corpseSkinTimer 03802            endif3803            3804#********* CAST NECRO EVIL OMEN *********3805 3806        elseif 1 = NecroEvilOmen and 1 < unholyPoints and timer evilOmenTimer > evilOmenCD and skill 'necromancy' >= 60 and mana >= minManaToUseDamageBuffNecroSpells and diffhits < activateAutoHealDiff and not dead currentTarget and find currentTarget ground -1 -1 123807            if insysmsg "unholy symbols remaining"3808            endif3809            if insysmsg "seconds before you may use that ability again."3810            endif3811 3812            @settimer! necroAbilityTimer 03813 3814            while not insysmsg "unholy symbols remaining"3815                if dead currentTarget and not find currentTarget ground -1 -1 123816                    @setvar! castingInterrupted 13817                    break3818                endif3819                if timer necroAbilityTimer > necroAbilityTimeoutCD3820                    sysmsg "evilomen no response" 443821                    @setvar! castingInterrupted 13822                    settimer evilOmenTimer necroMarginErrorCD3823                    break3824                endif3825                sysmsg "evilomen" 663826                hotkey 'evil omen'3827                getlabel backpack xxx3828                wait 2003829                if insysmsg "seconds before you may use that ability again."3830                    sysmsg "evilomen on cooldown" 443831                    @setvar! castingInterrupted 13832                    settimer evilOmenTimer necroMarginErrorCD3833                    break    3834                endif3835            endwhile3836            3837            if 0 = castingInterrupted3838                overhead '[>Evil Omen<]' 443839                settimer evilOmenTimer 03840            endif3841            3842#********* CAST NECRO MIND ROT *********3843 3844        elseif 1 = NecroMindRot and 4 < unholyPoints and timer mindRotTimer > mindRotCD and skill 'necromancy' >= 75 and mana >= minManaToUseDamageBuffNecroSpells and diffhits < activateAutoHealDiff and not dead currentTarget and find currentTarget ground -1 -1 123845            if insysmsg "unholy symbols remaining"3846            endif3847            if insysmsg "seconds before you may use that ability again."3848            endif3849 3850            @settimer! necroAbilityTimer 03851 3852            while not insysmsg "unholy symbols remaining"3853                if dead currentTarget and not find currentTarget ground -1 -1 123854                    @setvar! castingInterrupted 13855                    break3856                endif3857                if timer necroAbilityTimer > necroAbilityTimeoutCD3858                    sysmsg "mindrot no response" 443859                    @setvar! castingInterrupted 13860                    settimer mindRotTimer necroMarginErrorCD3861                    break3862                endif3863                sysmsg "mindrot" 663864                hotkey 'mind rot'3865                getlabel backpack xxx3866                wait 2003867                if insysmsg "seconds before you may use that ability again."3868                    sysmsg "mindrot on cooldown" 443869                    @setvar! castingInterrupted 13870                    settimer mindRotTimer necroMarginErrorCD3871                    break    3872                endif3873            endwhile3874            3875            if 0 = castingInterrupted3876                overhead '[>Mind Rot<]' 443877                settimer mindRotTimer 03878            endif3879            3880#********** CAST MAGIC ARROW  **********#3881 3882        elseif castMagicArrow = 1 and timer magicArrowTimer > magicArrowCD and diffhits < activateAutoHealDiff and mana >= 4 and mana < activateMagicArrowWhenManaBelow and not dead currentTarget and find currentTarget ground -1 -1 12 and findtype 3980 self3883            if insysmsg "Your concentration is disturbed"3884            endif       3885            if insysmsg "target cannot be seen"3886            endif             3887            sysmsg "arrow" 113888            cast 'magic arrow'           3889            while not casting   3890                if targetexists3891                    hotkey 'cancel current target'3892                endif3893                cast 'magic arrow'             3894            endwhile  3895            3896            while not targetexists3897                if dead currentTarget and not find currentTarget ground -1 -1 123898                    interrupt3899                    @setvar! castingInterrupted 13900                    break3901                endif3902                if insysmsg "Your concentration is disturbed"3903                    interrupt3904                    @setvar! castingInterrupted 13905                    break                3906                endif3907            endwhile3908 3909            if 0 = castingInterrupted3910                target currentTarget3911                getlabel backpack xxx3912                wait 2003913                3914                if insysmsg "wizardry"3915                    settimer magicArrowTimer 0 3916                elseif insysmsg "target cannot be seen"3917                    sysmsg "Magic - resetting target" 113918                    @setvar! foundTarget 03919                    @setvar! currentTarget 03920                    break3921                else3922                    settimer magicArrowTimer 150003923                endif3924            endif    3925            3926#********** CAST HARM  **********#        3927 3928        elseif castHarm = 1 and timer harmTimer > harmCD and diffhits < activateAutoHealDiff and mana >= 6 and mana < activateHarmWhenManaBelow and not dead currentTarget and find currentTarget ground -1 -1 12 and findtype 3976 self and findtype 3981 self3929            if insysmsg "Your concentration is disturbed"3930            endif       3931            if insysmsg "target cannot be seen"3932            endif  3933            sysmsg "harm" 113934            cast 'harm'           3935            while not casting    3936                if targetexists3937                    hotkey 'cancel current target'3938                endif3939                cast 'harm'             3940            endwhile  3941            3942            while not targetexists3943                if dead currentTarget and not find currentTarget ground -1 -1 123944                    interrupt3945                    @setvar! castingInterrupted 13946                    break3947                endif3948                if insysmsg "Your concentration is disturbed"3949                    interrupt3950                    @setvar! castingInterrupted 13951                    break                3952                endif3953            endwhile3954 3955            if 0 = castingInterrupted3956                target currentTarget3957                getlabel backpack xxx3958                wait 200 3959                3960                if insysmsg "wizardry"3961                    settimer harmTimer 0 3962                elseif insysmsg "target cannot be seen"3963                    sysmsg "Harm - resetting target" 113964                    @setvar! foundTarget 03965                    @setvar! currentTarget 03966                    break3967                else 3968                    settimer harmTimer 150003969                endif3970            endif   3971 3972#********** CAST FIREBALL  **********#   3973 3974        elseif castFireball = 1 and timer fireballTimer > fireballCD and diffhits < activateAutoHealDiff and mana >= 9 and mana < activateFireballWhenManaBelow and not dead currentTarget and find currentTarget ground -1 -1 12 and findtype 3962 self3975            sysmsg "fireball" 113976            if insysmsg "Your concentration is disturbed"3977            endif       3978            if insysmsg "target cannot be seen"3979            endif  3980            cast 'fireball'           3981            while not casting    3982                if targetexists3983                    hotkey 'cancel current target'3984                endif3985                cast 'fireball'             3986            endwhile  3987            3988            while not targetexists3989                if dead currentTarget and not find currentTarget ground -1 -1 123990                    interrupt3991                    @setvar! castingInterrupted 13992                    break3993                endif3994                if insysmsg "Your concentration is disturbed"3995                    interrupt3996                    @setvar! castingInterrupted 13997                    break                3998                endif3999            endwhile4000 4001            if 0 = castingInterrupted4002                target currentTarget4003                getlabel backpack xxx4004                wait 2004005                4006                if insysmsg "wizardry"4007                    settimer fireballTimer 0 4008                elseif insysmsg "target cannot be seen"4009                    sysmsg "Fireball - resetting target" 114010                    @setvar! foundTarget 04011                    @setvar! currentTarget 04012                    break4013                else4014                    settimer fireballTimer 150004015                endif4016            endif  4017 4018#********** CAST LIGHTNING  **********#   4019 4020        elseif castLightning = 1 and timer lightningTimer > lightningCD and diffhits < activateAutoHealDiff and mana >= 11 and mana < activateLightningWhenManaBelow and not dead currentTarget and find currentTarget ground -1 -1 12 and findtype 3974 self and findtype 3980 self4021            sysmsg "lightning" 114022            if insysmsg "Your concentration is disturbed"4023            endif       4024            if insysmsg "target cannot be seen"4025            endif  4026            cast 'lightning'           4027            while not casting   4028                if targetexists4029                    hotkey 'cancel current target'4030                endif4031                cast 'lightning'             4032            endwhile  4033            4034            @settimer! spellTimer 0  4035            @setvar! spellCD 800     4036            4037            while not targetexists4038                if diffhits >= interruptCastingDiff4039                    interrupt4040                    @setvar! castingInterrupted 1 4041                    break4042                endif4043                if dead currentTarget and not find currentTarget ground -1 -1 124044                    interrupt4045                    @setvar! castingInterrupted 14046                    break4047                endif4048                if insysmsg "Your concentration is disturbed"4049                    interrupt4050                    @setvar! castingInterrupted 14051                    break                4052                endif4053                4054                if timer spellTimer < spellCD4055                    #--- Poisoned ---#4056                    4057                    if 1 = drinkCure4058                        while poisoned and casting and not targetexists 4059                            if findtype "Orange Potion" self4060                                sysmsg "pot cure - lightning" 114061                                dclicktype "Orange Potion"4062                                sysmsg "cure pot" 444063                                wait 2004064                            else4065                                if timer orangeMessageTimer > orangeMessageCD4066                                    overhead "Out of cure pots" 344067                                    settimer orangeMessageTimer 04068                                endif4069                                break4070                            endif4071                        endwhile4072                    endif            4073                4074                    #--- Drink Heal Pot ---#4075                    4076                    if diffhits >= drinkHealPotDiff and 1 = drinkHeal4077                        if findtype "Yellow Potion" self as hPot4078                            getlabel hPot potLabel4079                            if "(" in potLabel4080                            else4081                                dclicktype 38524082                                getlabel backpack xxx4083                                sysmsg "heal pot" 554084                            endif4085                        else4086                            if timer yellowMessageTimer > yellowMessageCD4087                                overhead "Out of heals pots" 344088                                settimer yellowMessageTimer 04089                            endif4090                        endif4091                    endif4092                endif4093                4094            endwhile4095 4096            if 0 = castingInterrupted4097                target currentTarget4098                getlabel backpack xxx4099                wait 200 4100                4101                if insysmsg "wizardry"4102                    settimer lightningTimer 0 4103                elseif insysmsg "target cannot be seen"4104                    sysmsg "Lightning - resetting target" 114105                    @setvar! foundTarget 04106                    @setvar! currentTarget 04107                    break4108                else 4109                    settimer lightningTimer 150004110                endif4111            endif 4112 4113#********** CAST BIG SPELLS  **********# 4114 4115        elseif 1 = castingBigSpellsEnabled and mana > minimumManaToCastBigSpellsOnly and diffhits < activateAutoHealDiff and not dead currentTarget and find currentTarget ground -1 -1 124116            if diffhits < activateAutoHealDiff4117                if insysmsg "Your concentration is disturbed"4118                endif       4119                if insysmsg "target cannot be seen"4120                endif     4121                4122                @setvar! spellCD 0 4123                4124                if castFlamestrike = 1 and mana >= 40 and findtype 3981 self and findtype 3980 self4125                    sysmsg "flamestrike" 114126                    cast 'flamestrike'           4127                    while not casting    4128                        if targetexists4129                            hotkey 'cancel current target'4130                        endif4131                        cast 'flamestrike'             4132                    endwhile4133                    @settimer! spellTimer 0  4134                    @setvar! spellCD 14004135                elseif castEnergyBolt = 1 and bigSpellCounter = 1 and mana >= 20 and findtype 3962 self and findtype 3976 self4136                    sysmsg "energy" 114137                    cast 'energy bolt'           4138                    while not casting    4139                        if targetexists4140                            hotkey 'cancel current target'4141                        endif4142                        cast 'energy bolt'             4143                    endwhile4144                    @settimer! spellTimer 0  4145                    @setvar! spellCD 1200                    4146                elseif castExplosion = 1 and bigSpellCounter = 2 and mana >= 20 and findtype 3963 self and findtype 3974 self4147                    sysmsg "explo" 114148                    cast 'Explosion'           4149                    while not casting    4150                        if targetexists4151                            hotkey 'cancel current target'4152                        endif4153                        cast 'Explosion'             4154                    endwhile4155                    @settimer! spellTimer 0  4156                    @setvar! spellCD 1200                 4157                elseif castMindblast = 1 and mana >= 14 and findtype 3962 self and findtype 3974 self and findtype 3976 self and findtype 3980 self4158                    sysmsg "mind" 114159                    cast 'mind blast'           4160                    while not casting    4161                        if targetexists4162                            hotkey 'cancel current target'4163                        endif4164                        cast 'mind blast'             4165                    endwhile4166                    @settimer! spellTimer 0  4167                    @setvar! spellCD 1000   4168                endif4169                4170                while not targetexists and spellCD != 04171                    if mana < 14 4172                        interrupt4173                        @setvar! castingInterrupted 1 4174                        break                    4175                    endif4176                    if diffhits >= interruptCastingDiff4177                        interrupt4178                        @setvar! castingInterrupted 1 4179                        break4180                    endif4181                    if dead currentTarget and not find currentTarget ground -1 -1 124182                        interrupt4183                        @setvar! castingInterrupted 14184                        break4185                    endif4186                    if insysmsg "Your concentration is disturbed"4187                        interrupt4188                        @setvar! castingInterrupted 14189                        break                4190                    endif4191                    4192                    if timer spellTimer < spellCD4193                        #--- Poisoned ---#4194                        4195                        if 1 = drinkCure 4196                            while poisoned and casting and not targetexists 4197                                if findtype "Orange Potion" self4198                                    sysmsg "pot cure - big spells" 114199                                    dclicktype "Orange Potion"4200                                    sysmsg "cure pot" 444201                                    wait 2004202                                else4203                                    if timer orangeMessageTimer > orangeMessageCD4204                                        overhead "Out of cure pots" 344205                                        settimer orangeMessageTimer 04206                                    endif4207                                    break4208                                endif4209                            endwhile4210                        endif            4211                    4212                        #--- Drink Heal Pot ---#4213                        4214                        if diffhits >= drinkHealPotDiff and 1 = drinkHeal4215                            if findtype "Yellow Potion" self as hPot4216                                getlabel hPot potLabel4217                                if "(" in potLabel4218                                else4219                                    dclicktype 38524220                                    getlabel backpack xxx4221                                    sysmsg "heal pot" 554222                                endif4223                            else4224                                if timer yellowMessageTimer > yellowMessageCD4225                                    overhead "Out of heals pots" 344226                                    settimer yellowMessageTimer 04227                                endif4228                            endif4229                        endif4230                        4231                    endif4232                    4233                endwhile4234    4235                if 0 = castingInterrupted and spellCD != 04236                    target currentTarget4237                    getlabel backpack xxx4238                    wait 2004239                    4240                    if insysmsg "target cannot be seen"4241                        sysmsg "Big spells - resetting target" 114242                        @setvar! foundTarget 04243                        @setvar! currentTarget 04244                        break4245                    endif4246                    4247                    if bigSpellCounter = 1 4248                        if castExplosion = 1 4249                            @setvar! bigSpellCounter 24250                        endif4251                    elseif bigSpellCounter = 24252                        if castEnergyBolt = 1 4253                            @setvar! bigSpellCounter 14254                        endif4255                    endif4256                endif4257                4258            endif4259        endif4260        4261 #********** USE WEAPON ABILITY **********# 4262 4263        if skill "Arcane" >= 80 and useWeaponAbility != 04264            if timer weaponAbilityTimer > weaponAbilityCD4265                if insysmsg "You cannot perform that ability yet"4266                endif4267                if useWeaponAbility = 14268                    gumpresponse 11 39541219344269                    getlabel backpack xxx4270                    wait 1004271                    gumpresponse 10 39541219344272                    4273                    getlabel backpack xxx4274                    wait 200                4275                    if insysmsg "You cannot perform that ability yet"4276                        sysmsg "Ability cooldown" 444277                        settimer weaponAbilityTimer 0    4278                    else4279                        sysmsg "Ability activated" 44    4280                    endif4281                    4282                elseif useWeaponAbility = 2 and mana < useAbilityWhenManaLowerThan4283                    gumpresponse 10 39541219344284                    getlabel backpack xxx4285                    wait 1004286                    gumpresponse 11 39541219344287                    4288                    getlabel backpack xxx4289                    wait 200                4290                    if insysmsg "You cannot perform that ability yet"4291                        sysmsg "Ability cooldown" 444292                        settimer weaponAbilityTimer 0    4293                    else4294                        sysmsg "Ability activated" 44    4295                    endif4296                    4297                elseif useWeaponAbility = 3 4298                    gumpresponse 11 39541219344299                    getlabel backpack xxx4300                    wait 1004301                    gumpresponse 12 39541219344302                    4303                    getlabel backpack xxx4304                    wait 200                4305                    if insysmsg "You cannot perform that ability yet"4306                        sysmsg "Ability cooldown" 444307                        settimer weaponAbilityTimer 0    4308                    else4309                        sysmsg "Ability activated" 44    4310                    endif4311                    4312                endif4313            endif4314        endif 4315        4316        if mana < lowManaWarningMessageWhenBelow and timer manaMessageTimer > manaMessageCD4317            overhead "Low mana warning" 344318            settimer manaMessageTimer 04319        endif4320        4321        if earthElementals != 0 or waterElementals != 0 or fireElementals != 0 or airElementals != 0 or summonDaemons != 0 or summonCreature != 04322            if followers < breakCastingWhenFollowersBelow4323                break4324            endif4325        endif4326        4327        if 0 = targetSelectionMode and 1 = switchTargetWhenToggleWarMode4328            if warmode4329                warmode off4330                @setvar! foundTarget 04331                @setvar! currentTarget 0      4332                sysmsg "0-Switching Targets" 344333            endif4334        elseif 1 = targetSelectionMode and 1 = switchTargetWhenToggleWarMode4335            if not warmode4336                warmode on4337                @setvar! foundTarget 04338                @setvar! currentTarget 0   4339                sysmsg "1-Switching Targets" 344340            endif4341        endif4342        4343    endwhile4344    4345#********* ^ AUTO ATTACKING ENDS ^ *********    4346    4347    if followers > 0 and petsCurrentlyAttacking != 0 and diffhits < activateAutoHealDiff4348 4349        if skill 'spirit' >= 50 and timer spiritSpeakTimer > spiritSpeakCD and findtype 'corpse' ground -1 -1 18 and dead currentTarget and not find currentTarget ground -1 -1 124350 4351            if insysmsg "you establish contact"4352            endif4353            if insysmsg "you fail your attempt"4354            endif4355            4356            skill 'spiritspeak'4357            getlabel backpack xxx4358            wait 2004359            4360            if insysmsg "you establish contact" or insysmsg "you fail your attempt"4361                settimer spiritSpeakTimer 04362            endif4363            4364        endif4365    endif4366    4367endwhile