RH mod for SK now 2.5

Post your completed (working) macros here. Only for macros using MQ2Data syntax!

Moderator: MacroQuest Developers

Birdbrain
a lesser mummy
a lesser mummy
Posts: 45
Joined: Sat Oct 23, 2004 1:40 pm

Post by Birdbrain » Thu Jan 20, 2005 6:23 pm

can anyone post the old one please?

r0tax
orc pawn
orc pawn
Posts: 10
Joined: Thu Feb 17, 2005 12:26 am

Post by r0tax » Tue Feb 22, 2005 6:51 am

getting same thing...crashing to bite.. =\ looks like it'd be great script tho..

majic
orc pawn
orc pawn
Posts: 20
Joined: Fri Dec 03, 2004 10:08 pm

Post by majic » Tue Feb 22, 2005 8:17 am

i have it up and running will look into posting what i have when i get to the next hotel tonight

r0tax
orc pawn
orc pawn
Posts: 10
Joined: Thu Feb 17, 2005 12:26 am

Post by r0tax » Tue Feb 22, 2005 9:13 am

good deal, thanks alot. i got it partially working by commenting out all the bs that causes errors on 'init' . .

majic
orc pawn
orc pawn
Posts: 20
Joined: Fri Dec 03, 2004 10:08 pm

skh.mac part 1 of 2

Post by majic » Tue Feb 22, 2005 4:03 pm

Code: Select all

|--------------------------------------------------------------------------------- 
| 
| Shadow Knight Helper (SKH) Macro 
| - v6.0 RH by Jerle (10/26/04) Edited by lazyshammy to SKH v2.5
| - Edited by Majic nothing major!
|--------------------------------------------------------------------------------- 
| 
| SKH Syntax: 
| 
| Usage: /mac SKH 
| 
| Default settings can be changed by their respective controlling /command 
| 
| Type /SKHhelp for help or /status to see current settings! 
| 
|--------------------------------------------------------------------------------- 


#include spellcast.inc
#Chat tell 
#Event AttackOn        "#*#Auto attack is on#*#" 
#Event AttackOff       "#*#Auto attack is off#*#" 
#Event Enraged         "#*#|${Target.CleanName}| has become ENRAGED#*#" 
#Event NLEnraged       "#*#|${Target.CleanName}| is no longer enraged#*#" 
#Event TooFarAway      "#*#Your target is too far away, get closer#*#" 
#Event Exp             "#*#You gain#*#experience#*#" 
#Event Slain           "#*# slain#*#" 
#Event Zoned           "#*#You have entered#*#" 
#Event GotHit          "#1#YOU for#*#points of damage." 
#Event GotMissed       "#1#to#*#YOU, but #*#" 
#Event SpellBounced    "#*#Your spell did not take hold#*#" 
#Event SwitchWeapon    "#*#|${switchtext}|#*#" "
#Event TogTaunt        "[MQ2] Autotaunt#*#"
#Event TogTank         "[MQ2] Autotank#*#"
#Event TogStick        "[MQ2] Autostick#*#" 
#Event TogLeash        "[MQ2] Leash#*#" 
#Event TogAuto         "[MQ2] Autoassist#*#" 
#Event TogDynaggro     "[MQ2] Dynaggro#*#" 
#Event TogPause        "[MQ2] Pause#*#" 
#Event TogTSwitch      "[MQ2] AutoTargetSwitch#*#" 
#Event TogDynclose     "[MQ2] Dynclose#*#" 
#Event LinkParse       "[MQ2] LinkParse#*#" 
#Event SetStopFighting "[MQ2] SetStopFighting#*#" 
#Event SetEndFloor     "[MQ2] SetEndFloor#*#" 
#Event SetCloseness    "[MQ2] SetCloseness#*#" 
#Event SetFirstassist  "[MQ2] SetMainassist#*#" 
#Event SetSecondassist "[MQ2] SetSecondassist#*#" 
#Event SetThirdassist  "[MQ2] SetThirdassist#*#" 
#Event SetAutoNinja    "[MQ2] SetAutoNinja#*#" 
#Event SetWeaponSwitch "[MQ2] SetWeaponSwitch#*#" 
#Event SetStickDist    "[MQ2] SetStickDist#*#"  
#Event SetVoice        "[MQ2] SetVoice#*#" 
#Event SetBite         "[MQ2] SetBite#*#" 
#Event SetDD           "[MQ2] AutoSnare#*#"
#Event SetSpear        "[MQ2] AutoSpear#*#"
#Event SetToH          "[MQ2] AutoToH#*#"
#Event SetToP          "[MQ2] AutoToP#*#"
#Event SetToF          "[MQ2] AutoToF#*#"
#Event SetToD          "[MQ2] AutoToD#*#"
#Event SetSpear        "[MQ2] AutoVoice#*#"
#Event SetProc         "[MQ2] AutoProc#*#
#Event SetLifetap      "[MQ2] AutoLifetap#*#
#Event SetDisc1        "[MQ2] SetDisc1#*#" 
#Event SetDisc2        "[MQ2] SetDisc2#*#" 
#Event SetLeashFlex    "[MQ2] SetLeashFlex#*#" 
#Event SetVerbosity    "[MQ2] SetVerbosity#*#" 
#Event SetChannel      "[MQ2] SetChannel#*#" 
#Event DragBodies      "[MQ2] DragBodies#*#" 
#Event LootMyCorpse    "[MQ2] LootMyCorpse#*#" 
#Event AutoFollow      "[MQ2] AutoFollow#*#" 
#Event AddMaster       "[MQ2] AddMaster#*#" 
#Event RemMaster       "[MQ2] RemoveMaster#*#" 
#Event ItemSet         "[MQ2] ItemSet#*#" 
#Event ItemBounce      "[MQ2] ItemBounce#*#" 
#Event ItemCast        "[MQ2] ItemCast#*#" 
#Event HelpInfo        "[MQ2] SKH Help#*#" 
#Event StatInfo        "[MQ2] SKH Status#*#" 

Sub Main 

  /echo Loading Shadow Knight Helper... Please Wait! 

  /declare StopFightingHealth int outer 30 
  /declare isEnraged bool outer FALSE 
  /declare LDExp float outer ${Me.PctGroupLeaderExp} 
  /declare AAExp float outer ${Me.PctAAExp} 
  /declare Exp2 float outer ${Me.PctExp} 
  /declare doStick bool outer TRUE 
  /declare X float outer 
  /declare Y float outer 
  /declare behindTarget bool outer FALSE 
  /declare i int outer 
  /declare dir int outer 
  /declare delta int outer 
  /declare strafedir string outer 
  /declare closeness int outer 70 
  /declare doLeash bool outer FALSE  
  /declare leashlength int outer 0 
  /declare stakeX int outer ${Me.X} 
  /declare stakeY int outer ${Me.Y} 
  /declare leashholder string outer Nobody 
  /declare doAutoassist bool outer FALSE 
  /declare mainassist string outer Nobody 
  /declare firstassist string outer Nobody 
  /declare secondassist string outer Nobody 
  /declare thirdassist string outer Nobody 
  /declare assistpct int outer 100 
  /declare oldtargetID int outer ${Target.ID} 
  /declare assisttimer timer outer 0 
  /declare doDynaggro bool outer FALSE 
  /declare gotHit bool outer FALSE 
  /declare aggrotimer timer outer 0 
  /declare ialias string outer None 
  /declare doIclick bool outer FALSE 
  /declare bouncenum int outer 1 
  /declare ibounce string outer None 
  /declare itemspellname string outer None 
  /declare clicktimer timer outer 0 
  /declare isPaused bool outer FALSE 
  /declare ninjamode string outer OFF 
  /declare ninjadist int outer 50 
  /declare doSwitch bool outer FALSE 
  /declare switchtext string outer +Undefined+ 
  /declare weapon1 string outer None 
  /declare weapon2 string outer None 
  /declare wstype string outer Detrimental 
  /declare doTSwitch bool outer TRUE 
  /declare lastevent string outer None 
  /declare rngtarget int outer 200 
  /declare rngtank int outer 100 
  /declare useMU bool outer FALSE 
  /declare oldheading string outer Default  
  /declare doDisc1 bool outer FALSE 
  /declare disc1 string outer NONE
  /declare disc1end int outer 60 
  /declare disc1reuse int outer 5 
  /declare disc1reusetimer timer outer 0 
  /declare doDisc2 bool outer FALSE 
  /declare disc2 string outer NONE 
  /declare disc2end int outer 60 
  /declare disc2reuse int outer 5 
  /declare disc2reusetimer timer outer 0 
  /declare discactive timer outer 0 
  /declare leashflex int outer 10 
  /declare doDynclose bool outer TRUE 
  /declare closenessdesired int outer 70 
  /declare acquiretimer timer outer 0 
  /declare snuggleup bool outer FALSE 
  /declare isTanking bool outer FALSE 
  /declare verbosity int outer 2 
  /declare channel string outer echo 
  /declare SKHversion string outer 2.5
  /declare doTaunt bool outer TRUE
  /declare doToH bool outer TRUE
  /declare doToP bool outer TRUE
  /declare doProc bool outer TRUE
  /declare doToD bool outer TRUE
  /declare doLifetap bool outer TRUE
  /declare doSpear bool outer TRUE
  /declare doVoice bool outer TRUE
  /declare needToH bool outer TRUE
  /declare needToP bool outer TRUE
  /declare needToF bool outer TRUE
  /declare doToF bool outer TRUE
  /declare doDD bool outer TRUE
  /declare doBite bool outer TRUE
  /declare needDD bool outer TRUE
  /declare Voicereciever outer "${Me}"
  /declare Spearcast int outer 0 
  /declare Voice string outer "Voice of Death"
  /declare Terror string outer "Terror of Death"
  /declare Attackdebuff string outer "Torrent of Hate"
  /declare Acdebuff string outer "Torrent of Pain"
  /declare Snare string outer "Dooming Darkness"
  /declare Spear string outer "Spear of Plague"
  /declare Strdebuff string outer "Torrent of Fatigue"
  /declare Proc string outer "Mental Corruption"
  /declare Lifetap string outer "Spirit Tap"
  /declare Bite string outer "Zevfeer's Bite"
  /declare Speargem  int outer 5
  /declare DDgem int outer 4
  /declare ToPgem int outer 2
  /declare ToHgem int outer 1
  /declare Bitegem int outer 5
  /declare ToDgem int outer 6
  /declare Voicegem int outer 7
  /declare ToFgem int outer 3
  /declare Procgemm int outer 6
  /declare Lifetapgem int outer 4
  /declare Lifetaphp int outer 50
  /declare Bitehp int outer 50


  /goto :BypassVCheck 
  |- Check versions and load aliases if necessary 
  /if (${Ini[SKHSettings.ini,General,Version].Equal[${SKHversion}]}) /goto :EndAlias 
  :BypassVCheck 

  /if (${verbosity}>=0) /${channel} Setting Aliases... 
  /squelch /alias /status /echo SKH Status 
  /squelch /alias /SKHhelp /echo SKH Help  
  /squelch /alias /stopfight /echo SetStopFighting 
  /squelch /alias /autostick /echo Autostick 
  /squelch /alias /leash /echo Leash 
  /squelch /alias /autoassist /echo Autoassist 
  /squelch /alias /dynaggro /echo Dynaggro 
  /squelch /alias /closeness /echo SetCloseness 
  /squelch /alias /mainassist /echo SetMainassist 
  /squelch /alias /secondassist /echo SetSecondassist 
  /squelch /alias /thirdassist /echo SetThirdassist 
  /squelch /alias /drag /echo DragBodies 
  /squelch /alias /lootmycorpse /echo LootMyCorpse 
  /squelch /alias /autofollow /echo AutoFollow 
  /squelch /alias /iset /echo ItemSet 
  /squelch /alias /ibounce /echo ItemBounce 
  /squelch /alias /iclick /echo ItemCast 
  /squelch /alias /pause /echo Pause 
  /squelch /alias /autoninja /echo SetAutoNinja 
  /squelch /alias /addmaster /echo AddMaster 
  /squelch /alias /remmaster /echo RemoveMaster 
  /squelch /alias /weaponswitch /echo SetWeaponSwitch 
  /squelch /alias /targetswitch /echo AutoTargetSwitch 
  /squelch /alias /stickdist /echo SetStickDist 
  /squelch /alias /autodisc1 /echo SetDisc1 
  /squelch /alias /autodisc2 /echo SetDisc2 
  /squelch /alias /leashflex /echo SetLeashFlex 
  /squelch /alias /verbosity /echo SetVerbosity 
  /squelch /alias /channel /echo SetChannel 
  /squelch /alias /dynclose /echo Dynclose 
  /squelch /alias /lp /echo LinkParse 
  /squelch /alias /Autotaunt /echo Autotaunt
  /squelch /alias /MainTank /echo Autotank
  /squelch /alias /AutoSnare /echo AutoSnare
  /squelch /alias /AutoToP /echo AutoToP
  /squelch /alias /AutoToH /echo AutoToH
  /squelch /alias /AutoToD /echo AutoToD
  /squelch /alias /AutoSpear /echo AutoSpear
  /squelch /alias /SetVoice /echo SetVoice
  /squelch /alias /AutoToF /echo AutoToF
  /squelch /alias /AutoProc /echo AutoProc
  /squelch /alias /AutoLifetap /echo AutoLifetap
  /squelch /alias /SetBite /echo SetBite

  :EndAlias 

  |-- Update the Version information 
  /ini "SKHSettings.ini" "General" "Version" "${SKHversion}" 

  |-- Read in INI settings, if defined...  Leashing is only stored TRUE if there is a Leash-holding Master! 
  /if (${Ini[SKHSettings.ini,General,StopFightingHealth].NotEqual[NULL]}) /varset StopFightingHealth ${Ini[SKHSettings.ini,General,StopFightingHealth]} 
  /if (${Ini[SKHSettings.ini,General,AutoStick].NotEqual[NULL]}) /varset doStick ${Ini[SKHSettings.ini,General,AutoStick]} 
  /if (${Ini[SKHSettings.ini,General,Closeness].NotEqual[NULL]}) /varset closeness ${Ini[SKHSettings.ini,General,Closeness]} 
  /if (${Ini[SKHSettings.ini,General,Leashing].NotEqual[NULL]}) /varset doLeash ${Ini[SKHSettings.ini,General,Leashing]} 
  /if (${Ini[SKHSettings.ini,General,LeashHolder].NotEqual[NULL]}) /varset leashholder ${Ini[SKHSettings.ini,General,LeashHolder]} 
  /if (${Ini[SKHSettings.ini,General,LeashLength].NotEqual[NULL]}) /varset leashlength ${Ini[SKHSettings.ini,General,LeashLength]} 
  /if (${Ini[SKHSettings.ini,General,LeashFlex].NotEqual[NULL]}) /varset leashflex ${Ini[SKHSettings.ini,General,LeashFlex]} 
  /if (${Ini[SKHSettings.ini,General,AutoAssist].NotEqual[NULL]}) /varset doAutoassist ${Ini[SKHSettings.ini,General,AutoAssist]} 
  /if (${Ini[SKHSettings.ini,General,AssistPercentage].NotEqual[NULL]}) /varset assistpct ${Ini[SKHSettings.ini,General,AssistPercentage]} 
  /if (${Ini[SKHSettings.ini,General,MainAssist].NotEqual[NULL]}) /varset mainassist ${Ini[SKHSettings.ini,General,MainAssist]} 
  /if (${Ini[SKHSettings.ini,General,MainAssist].NotEqual[NULL]}) /varset firstassist ${Ini[SKHSettings.ini,General,MainAssist]} 
  /if (${Ini[SKHSettings.ini,General,SecondAssist].NotEqual[NULL]}) /varset secondassist ${Ini[SKHSettings.ini,General,SecondAssist]} 
  /if (${Ini[SKHSettings.ini,General,ThirdAssist].NotEqual[NULL]}) /varset thirdassist ${Ini[SKHSettings.ini,General,ThirdAssist]} 
  /if (${Ini[SKHSettings.ini,General,DynamicAggro].NotEqual[NULL]}) /varset doDynaggro ${Ini[SKHSettings.ini,General,DynamicAggro]} 
  /if (${Ini[SKHSettings.ini,General,AutoNinjaMode].NotEqual[NULL]}) /varset ninjamode ${Ini[SKHSettings.ini,General,AutoNinjaMode]} 
  /if (${Ini[SKHSettings.ini,General,AutoNinjaDistance].NotEqual[NULL]}) /varset ninjadist ${Ini[SKHSettings.ini,General,AutoNinjaDistance]} 
  /if (${Ini[SKHSettings.ini,General,WeaponSwitching].NotEqual[NULL]}) /varset doSwitch ${Ini[SKHSettings.ini,General,WeaponSwitching]} 
  /if (${Ini[SKHSettings.ini,General,TargetSwitching].NotEqual[NULL]}) /varset doTSwitch ${Ini[SKHSettings.ini,General,TargetSwitching]} 
  /if (${Ini[SKHSettings.ini,General,StickRangeToTarget].NotEqual[NULL]}) /varset rngtarget ${Ini[SKHSettings.ini,General,StickRangeToTarget]} 
  /if (${Ini[SKHSettings.ini,General,StickRangeToTank].NotEqual[NULL]}) /varset rngtank ${Ini[SKHSettings.ini,General,StickRangeToTank]} 
  /if (${Ini[SKHSettings.ini,General,VoidHealth].NotEqual[NULL]}) /varset Voidhealth ${Ini[SKHSettings.ini,General,VoidHealth]} 
  /if (${Ini[SKHSettings.ini,General,AutoDisc1].NotEqual[NULL]}) /varset doDisc1 ${Ini[SKHSettings.ini,General,AutoDisc1]} 
  /if (${Ini[SKHSettings.ini,General,Disc1].NotEqual[NULL]}) /varset disc1 ${Ini[SKHSettings.ini,General,Disc1]} 
  /if (${Ini[SKHSettings.ini,General,Disc1Endurance].NotEqual[NULL]}) /varset disc1end ${Ini[SKHSettings.ini,General,Disc1Endurance]} 
  /if (${Ini[SKHSettings.ini,General,Disc1Reuse].NotEqual[NULL]}) /varset disc1reuse ${Ini[SKHSettings.ini,General,Disc1Reuse]} 
  /if (${Ini[SKHSettings.ini,General,AutoDisc2].NotEqual[NULL]}) /varset doDisc2 ${Ini[SKHSettings.ini,General,AutoDisc2]} 
  /if (${Ini[SKHSettings.ini,General,Disc2].NotEqual[NULL]}) /varset disc2 ${Ini[SKHSettings.ini,General,Disc2]} 
  /if (${Ini[SKHSettings.ini,General,Disc2Endurance].NotEqual[NULL]}) /varset disc2end ${Ini[SKHSettings.ini,General,Disc2Endurance]} 
  /if (${Ini[SKHSettings.ini,General,Disc2Reuse].NotEqual[NULL]}) /varset disc2reuse ${Ini[SKHSettings.ini,General,Disc2Reuse]} 
  /if (${Ini[SKHSettings.ini,General,DynamicCloseness].NotEqual[NULL]}) /varset dynclose ${Ini[SKHSettings.ini,General,DynamicCloseess]} 
  /if (${Ini[SKHSettings.ini,General,Verbosity].NotEqual[NULL]}) /varset verbosity ${Ini[SKHSettings.ini,General,Verbosity]} 
  /if (${Ini[SKHSettings.ini,General,Channel].NotEqual[NULL]}) /varset channel ${Ini[SKHSettings.ini,General,Channel]} 
  /if (${Ini[SKHSettings.ini,Weapons,Weapon1].NotEqual[NULL]}) /varset weapon1 ${Ini[SKHSettings.ini,Weapons,Weapon1]} 
  /if (${Ini[SKHSettings.ini,Weapons,Weapon2].NotEqual[NULL]}) /varset weapon2 ${Ini[SKHSettings.ini,Weapons,Weapon2]} 
  /if (${Ini[SKHSettings.ini,Weapons,SwitchText].NotEqual[NULL]}) /varset switchtext ${Ini[SKHSettings.ini,Weapons,SwitchText]}
  /if (${Ini[SKHSettings.ini,General,AutoTaunt].NotEqual[NULL]}) /varset doTaunt ${Ini[SKHSettings.ini,General,AutoTaunt]}
  /if (${Ini[SKHSettings.ini,General,Tanking].NotEqual[NULL]}) /varset isTanking ${Ini[SKHSettings.ini,General,Tanking]}
  /if (${Ini[SKHSettings.ini,Spells,AutoSnare].NotEqual[NULL]}) /varset doDD ${Ini[SKHSettings.ini,Spells,AutoSnare]}
  /if (${Ini[SKHSettings.ini,Spells,AutoToH].NotEqual[NULL]}) /varset doToH ${Ini[SKHSettings.ini,Spells,AutoToH]}
  /if (${Ini[SKHSettings.ini,Spells,AutoToP].NotEqual[NULL]}) /varset doToP ${Ini[SKHSettings.ini,Spells,AutoToP]}
  /if (${Ini[SKHSettings.ini,Spells,AutoToD].NotEqual[NULL]}) /varset doToD ${Ini[SKHSettings.ini,Spells,AutoToD]}
  /if (${Ini[SKHSettings.ini,Spells,AutoSpear].NotEqual[NULL]}) /varset doSpear ${Ini[SKHSettings.ini,Spells,AutoSpear]}
  /if (${Ini[SKHSettings.ini,Spells,AutoVoice].NotEqual[NULL]}) /varset doVoice ${Ini[SKHSettings.ini,Spells,AutoVoice]}
  /if (${Ini[SKHSettings.ini,Spells,AutoProc].NotEqual[NULL]}) /varset doProc ${Ini[SKHSettings.ini,Spells,AutoProc]}
  /if (${Ini[SKHSettings.ini,Spells,AutoLifetap].NotEqual[NULL]}) /varset doLifetap ${Ini[SKHSettings.ini,Spells,AutoLifetap]}
  /if (${Ini[SKHSettings.ini,Spells,AutoBite].NotEqual[NULL]}) /varset doBite ${Ini[SKHSettings.ini,Spells,AutoBite]}
  /if (${Ini[SKHSettings.ini,Spells,Voicereciever].NotEqual[NULL]}) /varset Voicereciever ${Ini[SKHSettings.ini,Spells,Voicereciever]}
  /if (${Ini[SKHSettings.ini,Spells,Darkness].NotEqual[NULL]}) /varset Snare "${Ini[SKHSettings.ini,Spells,Darkness]}"
  /if (${Ini[SKHSettings.ini,Spells,Spear].NotEqual[NULL]}) /varset Spear "${Ini[SKHSettings.ini,Spells,Spear]}"
  /if (${Ini[SKHSettings.ini,Spells,Hate].NotEqual[NULL]}) /varset Attackdebuff ${Ini[SKHSettings.ini,Spells,Hate]}"
  /if (${Ini[SKHSettings.ini,Spells,Pain].NotEqual[NULL]}) /varset Acdebuff "${Ini[SKHSettings.ini,Spells,Pain]}"
  /if (${Ini[SKHSettings.ini,Spells,Voice].NotEqual[NULL]}) /varset Voice "${Ini[SKHSettings.ini,Spells,Voice]}"
  /if (${Ini[SKHSettings.ini,Spells,Proc].NotEqual[NULL]}) /varset Proc "${Ini[SKHSettings.ini,Spells,Proc]}"
  /if (${Ini[SKHSettings.ini,Spells,Lifetap].NotEqual[NULL]}) /varset Lifetap "${Ini[SKHSettings.ini,Spells,Lifetap]}"
  /if (${Ini[SKHSettings.ini,Spells,Bite].NotEqual[NULL]}) /varset Bite "${Ini[SKHSettings.ini,Spells,Bite]}"
  /if (${Ini[SKHSettings.ini,Spells,Strdebuff].NotEqual[NULL]}) /varset Strdebuff "${Ini[SKHSettings.ini,Spells,Strdebuff]}"
  /if (${Ini[SKHSettings.ini,Spells,SpearGem].NotEqual[NULL]}) /varset Speargem ${Ini[SKHSettings.ini,Spells,SpearGem]}
  /if (${Ini[SKHSettings.ini,Spells,DarknessGem].NotEqual[NULL]}) /varset DDgem ${Ini[SKHSettings.ini,Spells,DarknessGem]}
  /if (${Ini[SKHSettings.ini,Spells,TerrorGem].NotEqual[NULL]}) /varset ToDgem ${Ini[SKHSettings.ini,Spells,Terrorgem]}
  /if (${Ini[SKHSettings.ini,Spells,AcdebuffGem].NotEqual[NULL]}) /varset ToHgem ${Ini[SKHSettings.ini,Spells,AcdebuffGem]}
  /if (${Ini[SKHSettings.ini,Spells,StrdebuffGem].NotEqual[NULL]}) /varset ToFgem ${Ini[SKHSettings.ini,Spells,StrdebuffGem]}
  /if (${Ini[SKHSettings.ini,Spells,VoiceGem].NotEqual[NULL]}) /varset Voicegem ${Ini[SKHSettings.ini,Spells,VoiceGem]}}
  /if (${Ini[SKHSettings.ini,Spells,ProcGem].NotEqual[NULL]}) /varset Procgem ${Ini[SKHSettings.ini,Spells,ProcGem]}}
  /if (${Ini[SKHSettings.ini,Spells,LifetapGem].NotEqual[NULL]}) /varset Lifetapgem ${Ini[SKHSettings.ini,Spells,LifetapGem]}}
  /if (${Ini[SKHSettings.ini,Spells,BiteGem].NotEqual[NULL]}) /varset Bitegem ${Ini[SKHSettings.ini,Spells,BiteGem]}}
  /if (${Ini[SKHSettings.ini,Spells,AttackdebuffGem].NotEqual[NULL]}) /varset ToPgem ${Ini[SKHSettings.ini,Spells,Attackdebuffgem]}
  /if (${Ini[SKHSettings.ini,Spells,Lifetaphp].NotEqual[NULL]}) /varset Lifetaphp ${Ini[SKHSettings.ini,Spells,Lifetaphp]}
  /if (${Ini[SKHSettings.ini,Spells,Bitehp].NotEqual[NULL]}) /varset Bitehp ${Ini[SKHSettings.ini,Spells,Bitehp]}
  /varset closenessdesired ${closeness} 
  /varset wstype ${FindItem[${weapon1}].Spell.SpellType} 

  |- Set spell gems in INI
  /if (!${Ini[SKHSettings.ini,Spells,SpearGem].Length}) { 
    |- It's not in there yet  
      /ini "SKHSettings.ini" "Spells" "Speargem" "${Speargem}" 
  } 

  /if (!${Ini[SKHSettings.ini,Spells,DarknessGem].Length}) { 
    |- It's not in there yet  
      /ini "SKHSettings.ini" "Spells" "DDgem" "${DDgem}" 
  }

  /if (!${Ini[SKHSettings.ini,Spells,TerrorGem].Length}) { 
    |- It's not in there yet  
      /ini "SKHSettings.ini" "Spells" "ToDgem" "${ToDgem}" 
  }

 /if (!${Ini[SKHSettings.ini,Spells,AcdebuffGem].Length}) { 
    |- It's not in there yet  
      /ini "SKHSettings.ini" "Spells" "ToDgem" "${ToDgem}" 
  }

  /if (!${Ini[SKHSettings.ini,Spells,AttackebuffGem].Length}) { 
    |- It's not in there yet  
      /ini "SKHSettings.ini" "Spells" "ToHgem" "${ToHgem}" 
  }

  /if (!${Ini[SKHSettings.ini,Spells,VoiceGem].Length}) { 
    |- It's not in there yet  
      /ini "SKHSettings.ini" "Spells" "VoiceGem" "${Voicegem}" 
  }

  /if (!${Ini[SKHSettings.ini,Spells,ProcGem].Length}) { 
    |- It's not in there yet  
      /ini "SKHSettings.ini" "Spells" "ProcGem" "${Procgem}" 
  }

  /if (!${Ini[SKHSettings.ini,Spells,StrdebuffGem].Length}) { 
    |- It's not in there yet  
      /ini "SKHSettings.ini" "Spells" "StrdebuffGem" "${Strdebuffgem}" 
  }

  /if (!${Ini[SKHSettings.ini,Spells,BiteGem].Length}) { 
    |- It's not in there yet  
      /ini "SKHSettings.ini" "Spells" "BiteGem" "${Bitegem}" 
  }

  |- Build Empty master list in SKHSettings.ini file if it doesn't exist 
  /if (!${Ini[SKHSettings.ini,Masters,Controller1].Length}) { 
    |- It's not in there yet 
    /for i 1 to 20 
      /ini "SKHSettings.ini" "Masters" "Controller${i}" "Nobody" 
    /next i 
  } 

  /echo =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  /echo LazyShammy's Shadow Knight Helper (v${SKHVersion})  Mod of RH v6.0
  /echo =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  /echo Use "/SKHhelp" to display help information 
  /echo SKH Status 

  :ForeverLoop 

   |- Service any events 

   /doevents 
    
   |- If we're stunned or SKH is paused, just service events 

   /if (${Me.State.Equal[STUN]} || ${isPaused}) { 
     /delay 2 
     /goto :ForeverLoop 
   } 

   |- SKHile fighting or not fighting... 

   |- Turn attacking back on if enraged target, and no longer facing it 
   /if (${isEnraged} && ${Target.ID} && ${doAutoassist} && !${Me.Combat}) { 
     /call Check_Behind 
     /varset behindTarget ${Macro.Return} 
     /if (${Target.ID} && ${behindTarget}) { 
       /attack on 
       /if (${verbosity}>=1) /${channel} ** Attack re-started (No Enrage Risk): ${Target.CleanName} 
     }  
   } 

   |- Stop fighting if we lose our target 
   /if (${Me.Combat} && !${Target.ID}) /attack off 

   |- Are we suposed to stick to a target? 
   /if ((${Me.Combat} || ${strikeReady}) && ${Target.ID} && ${doStick} && (${Target.Distance}<${rngtarget}) && ${Target.Type.Equal[NPC]}) { 
      
     |- Check to see if we're too far from our tank (if applicable) 
     /if (${doAutoassist} && (${Spawn[${mainassist}].Distance}>${rngtank})) { 
       /if (${useMU} && ${Stick.Status.Equal[ON]}) /squelch /stick off 
       /goto :DoneSticking 
     } 
  
     |- Check to see if we're mounted and dismount if so 
     /if (${Me.Buff[Summon Drogmor].ID} || ${Me.Buff[Summon Horse].ID}) /dismount 

     |- Use MQ2MoveUtils ? If so, start sticking and bypass SKH movement tools 
     /if (${useMU}) {  
/varset isTanking TRUE
     /if (${Ini[SKHSettings.ini,General,Tanking].Equal[TRUE]}) /varset isTanking TRUE
       /if (${aggrotimer.Value} || ${Me.TargetOfTarget.Name.Equal[${Me}]}) /varset isTanking TRUE 
       /if (!${Stick.Status.Equal[ON]} || ${snuggleup}) { 
         /if (${isTanking}) { 
           /squelch /stick ${closeness}% mpause ${If[${Me.Swimming},uw,]} 
         } else { 
           /squelch /stick ${closeness}% behind mpause ${If[${Me.Swimming},uw,]} 
         } 
         /varset snuggleup FALSE 
       } else { 
         /if (${Stick.MoveBehind}) { 
           /if (${isTanking}) { 
             /squelch /stick off 
             /if (${verbosity}>=2) /${channel} Switched to frontal sticking... 
           } 
         } else { 
           /if (!${isTanking}) { 
             /squelch /stick off 
             /if (${verbosity}>=2) /${channel} Maneuvering behind target again... 
           } 
         }  
       }
       /goto :DoneSticking 
     } 

     /if (${Target.ID}) /face ${If[${Me.Swimming},,nolook]} 

     |- If we're too far away to hit it, get 1 second closer, unless we can hit it in less time 
     /if (${Target.Distance}>${Math.Calc[${Target.MaxRangeTo}*${closeness}/100]}) { 

       |- Set current position first before potentially moving (in case we get stuck) 
       /varset X ${Me.X} 
       /varset Y ${Me.Y}  

       /if (!${Target.ID}) /goto :Foreverloop 

       |- Move 
       /keypress forward hold 
       /delay 1s ${Target.Distance}<${Math.Calc[${Target.MaxRangeTo}*${closeness}/100]} 
       /keypress forward 

       |- Check to see if we got stuck trying that 
       /if ((${Me.X}==${X}) && (${Me.Y}==${Y})) { 
         |- We're stuck, back off a second, move left or right (randomly) for .5 seconds 
         /if (${verbosity}>=2) /${channel} We're STUCK on something, backing up... 
         /keypress back hold 
         /delay 1s 
         /keypress back 
         /if (${Math.Rand[2]}) { 
           /varset strafedir STRAFE_LEFT 
         } else { 
           /varset strafedir STRAFE_RIGHT 
         } 
         /if (${verbosity}>=2) /${channel} Unsticking: Strafing ${strafedir} a half-second... 
         /keypress ${strafedir} hold 
         /delay 5 
         /keypress ${strafedir} 
       } 
     } 

     /if (!${Target.ID}) /goto :Foreverloop 

     |- If we are close enough to hit it (and don't have aggro), lets try to get behind it a little bit at a time 

     /if ((${Target.Distance}<=${Target.MaxRangeTo}) && !${aggrotimer.Value} && !${Me.TargetOfTarget.Name.Equal[${Me}]}) { 
        
       /call Check_Behind 
       /varset behindTarget ${Macro.Return}    

       |- If we're not behind it, strafe around it a little 
       /if (!${behindTarget}) { 
         |- SKHich way do we strafe? 
         /varcalc delta ${Me.Heading.Clock}-${Target.Heading.Clock} 
         /if (${delta}>6) /varcalc delta ${delta}-12 
         /if (${delta}<-6) /varcalc delta ${delta}+12 
         /if (${delta}<0) { 
           /varset strafedir STRAFE_LEFT 
         } else { 
           /varset strafedir STRAFE_RIGHT 
         } 
         |- Set current position first before moving (in case we get stuck) 
         /varset X ${Me.X} 
         /varset Y ${Me.Y}    
  
         /if (!${Target.ID}) /goto :Foreverloop  

         |- Execute a strafe in the correct direction 
         /keypress ${strafedir} hold 
         /delay 2 
         /keypress ${strafedir} 
         /if (${Target.ID}) /face fast ${If[${Me.Swimming},,nolook]} 
         |- Check if we're stuck and warn if so (go through target to fix it) 
         /if ((${Me.X}==${X}) && (${Me.Y}==${Y})) { 
           /if (${verbosity}>=2) /${channel} We're STUCK trying to get behind target! 
           /delay 1s 
         } 
       } 
     } 
   } else { 
     /if (${useMU} && ${Stick.Status.Equal[ON]}) /squelch /stick off 
   } 
   :DoneSticking 

   |- Check on switching weapons (assuming it's a buff-weapon and buff is down) 

   /if (${doSwitch} && ${wstype.Equal[Beneficial]}) { 
     /varset itemspellname ${FindItem[${weapon1}].Spell} 
     /if (${itemspellname.NotEqual[${Me.Buff[${itemspellname}]}]} && !${FindItem[${weapon1}].InvSlot.Name.Equal[mainhand]} && !${FindItem[${weapon1}].InvSlot.Name.Equal[offhand]}) { 
       /if (${verbosity}>=1) /${channel} ** Beneficial proc-weapon swapping... 
       /call Weapon_Swap "${weapon1}" "${weapon2}" 
     } 
   } 

    |- Are we fighting? 

    /if (${Me.Combat}) { 
     |- ** We are fighting ** 

     |- Respond to enraged targets 
     /if (${isEnraged} && ${Target.ID}) { 
       /call Check_Behind 
       /varset behindTarget ${Macro.Return} 
       /if (${Target.ID} && !${behindTarget}) { 
         /attack off 
         /if (${verbosity}>=1) /${channel} ** Attack ceased (Enrage Risk): ${Target.CleanName} 
       }  
     }  

     |- Check up on our autoassist targets if applicable, and switch if MA switches (1 second checks) 
     /if (${doTSwitch} && ${doAutoassist} && ${Target.ID} && !${assisttimer}) { 
       /varset oldtargetID ${Target.ID} 
       /assist ${mainassist} 
       /varset assisttimer 1s 
     } 

     |- Did we just switch targets?  If so, turn off attack and start the loop over! 
     /if (${doAutoassist} && ${Target.ID}!=${oldtargetID}) { 
       /if (${verbosity}>=1) /${channel} --> *SWITCH* target to: ${Target.CleanName} 
       /varset oldtargetID ${Target.ID} 
       /attack off 
       /delay 2 
       /varset assisttimer 1s 
       /goto :ForeverLoop 
     } 

     |- Check for leash tugging and move back to stake some if so 
     /if (${doLeash}) { 
       /if (${leashholder.Equal[Nobody]} && (${Math.Distance[${Me.Y},${Me.X}:${stakeY},${stakeX}]}>${leashlength})) { 
         /if (${verbosity}>=2) /${channel} CHOKE! We're at the leash's length! (${leashlength} ft.) 
         /if (${verbosity}>=1) /${channel} ** Autoassist is now OFF! 
         /varset doAutoassist FALSE 
         /attack off 
         /if (${useMU}) /squelch /stick off 
         /face ${If[${Me.Swimming},,nolook]} loc ${stakeY},${stakeX} 
         /keypress forward hold 
         /delay 1s ${Math.Distance[${Me.Y},${Me.X}:${stakeY},${stakeX}]}<${Math.Calc[${leashlength}*${leashflex}/100]} 
         /keypress forward          
         |- Slow 180degree turns take time, and we may have turned off attack, so... 
         /goto :ForeverLoop 
       } 
       /if (!${leashholder.Equal[Nobody]} && ${Spawn[${leashholder}].ID} && (${Spawn[${leashholder}].Distance}>${leashlength})) { 
         /if (${verbosity}>=2) /${channel} CHOKE! Tugging on ${leashholder}'s leash! (${leashlength} ft.) 
         /if (${verbosity}>=1) /${channel} ** Autoassist is now OFF! 
         /varset doAutoassist FALSE 
         /attack off 
         /if (${useMU}) /squelch /stick off 
         /squelch /face ${If[${Me.Swimming},,nolook]} id ${Spawn[${leashholder}].ID} 
         /keypress forward hold 
         /delay 1s ${Spawn[${leashholder}].Distance}<${Math.Calc[${leashlength}*${leashflex}/100]} 
         /keypress forward          
         |- Slow 180degree turns take time, and we may have turned off attack, so... 
         /goto :ForeverLoop 
       } 
       |- Broken leash check 
       /if (!${leashholder.Equal[Nobody]} && !${Spawn[${leashholder}].ID}) { 
         /if (${verbosity}>=1) /${channel} ** Master DEAD or ZONED! Leash is BROKEN! 
         /varset doLeash FALSE 
         /varset leashholder Nobody 
         /ini "SKHSettings.ini" "General" "Leashing" "${doLeash}" 
         /ini "SKHSettings.ini" "General" "LeashHolder" "${leashholder}" 
         /goto :ForeverLoop 
       } 
     } 

/call Debuff

     |- Are we standing, have a target, have Bash Ready? 

     /if (${Target.ID} && ${Me.Standing} && !${Me.Casting.ID} && (${Target.Distance}<${Math.Calc[${Target.MaxRangeTo}*${closeness}/100]})) { 
       /if (${Me.AbilityReady["Bash"]} && ${InvSlot[Offhand].Item.Type.Equal[Shield]}) { 
         /doability "Bash" 
         /if (${verbosity}>=2) /${channel} Bashing: ${Target.CleanName} 
       } 
     } 

     /if (${Target.ID} && ${Me.Standing} && !${Me.Casting.ID} && (${Target.Distance}<${Math.Calc[${Target.MaxRangeTo}*${closeness}/100]})) { 
       /if (${Me.AbilityReady["111"]} && ${InvSlot[Offhand].Item.Type.NotEqual[Shield]}) { 
         /doability "111" 
         /if (${verbosity}>=2) /${channel} Bashing: ${Target.CleanName} 
       } 
     } 

     |- Are we standing, have a target, have Taunt ready? 

     /if (${doTaunt} && ${Target.ID} && ${Me.Standing} && !${Me.Casting.ID} && (${Target.Distance}<${Math.Calc[${Target.MaxRangeTo}*${closeness}/100]})) { 
       /if (${Me.AbilityReady["Taunt"]}) { 
         /doability "Taunt" 
         /if (${verbosity}>=2) /${channel} Taunting: ${Target.CleanName} 
       } 
     } 
     


     |- Are we so hurt we should stop fighting for a bit? 

     /if (${Me.PctHPs}<=${StopFightingHealth}) { 
       /attack off 
       /if (${verbosity}>=1) /${channel} Getting my ass kicked, ceasing combat! 
     } 

     |- Shall we do our optional discs? 

     /if (${doDisc1} && !${disc1reusetimer} && !${discactive} && !${strikeTimer} && ${Target.ID} && ${Target.PctHPs}>=50 && ${Me.PctEndurance}>=${disc1end}) { 
       /disc ${disc1} 
       /if (${verbosity}>=1) /${channel} Disc #1: ${disc1} activated 
       /delay 1s 
       /varset discactive 1m 
       /varset disc1reusetimer ${disc1reuse}m 
     } 

     /if (${doDisc2} && !${disc2reusetimer} && !${discactive} && !${strikeTimer} && ${Target.ID} && ${Target.PctHPs}>=50 && ${Me.PctEndurance}>=${disc2end}) { 
       /disc ${disc2} 
       /if (${verbosity}>=1) /${channel} Disc #2: ${disc2} activated 
       /delay 1s 

       /varset discactive 1m 
       /varset disc2reusetimer ${disc2reuse}m 
     } 

    } else { 
     |- ** We are not fighting 

/call Buff

     |- If we're not hiding or moving, check clicky maintained spells 
     /if (${Me.Invis} || ${Me.Moving} || ${clicktimer} || ${Me.State.Equal[BIND]}) /goto :DoneItemChecks 
     /varset i 1 
     :ItemCheckLoop 
     /varset ialias ${Ini[SKHItems.ini].Arg[${i},|]} 
     /if (${ialias.NotEqual[NULL]}) { 
       |- Obtained an itemalias from the SKHItems.ini file 
       |- We supposed to keep this spell up? 
       /if (${Ini[SKHItems.ini,${ialias},KeepUp].Equal[FALSE]}) /goto :NextItem 
       |- Scan the item's bounce list for the active bouncers 
       /varset bouncenum 1 
       /varset doIclick TRUE 
       :BounceCheckLoop 
       /varset ibounce ${Ini[SKHItems.ini,${ialias},BounceOff${bouncenum}]} 
       /if (${ibounce.NotEqual[NULL]}) { 
         /if (${ibounce.Equal[${Me.Buff[${ibounce}]}]}) /varset doIclick FALSE 
       } else /goto :DoneBounceChecks 
       /varcalc bouncenum ${bouncenum}+1 
       /goto :BounceCheckLoop 
       :DoneBounceChecks 
       |- By now we won't click the item if a bouncer spell is on us 
       |- Just have to check to see if the existing buff is on too 
       /varset itemspellname ${FindItem[${Ini[SKHItems.ini,${ialias},FullName]}].Spell} 
       /if (${itemspellname.Equal[${Me.Buff[${itemspellname}]}]}) /varset doIclick FALSE 
       |- Finally, do it if we should 
       /if (${doIclick}) /docommand /iclick ${ialias} 
       |- Did we fail to find that previous item? (i.e. Dead and naked at bind point!) 
       /if (${clicktimer}) /goto :DoneItemChecks 
       :NextItem 
       /varcalc i ${i}+1 
     } else /goto :DoneItemChecks 
     /goto :ItemCheckLoop 
     :DoneItemChecks 

     |- Put the closeness value back to the user's desired setting... 
     /varset closeness ${closenessdesired} 

    
     |- If we're set to autoassist, lets find a target 
     /if (${doAutoassist} && !${isEnraged} && !${Me.Casting.ID} && ${Me.State.NotEqual[BIND]}) { 
       |- Is main assist alive/in-zone? 
       /if (!${assisttimer} && !${strikeReady}) { 
         |- Lets try all the assists in priority order until we get an NPC to SKHack on 
         /if (!${Me.Casting.ID}) /assist ${firstassist} 
         /delay 1 
         /if (${Target.ID} && ${Target.Type.Equal[NPC]}) /goto :EngageCheck 
         /if (!${Me.Casting.ID}) /assist ${secondassist} 
         /delay 1 
         /if (${Target.ID} && ${Target.Type.Equal[NPC]}) /goto :EngageCheck 
         /if (!${Me.Casting.ID}) /assist ${thirdassist} 
         /delay 1 
         /if (${Target.ID} && ${Target.Type.Equal[NPC]}) /goto :EngageCheck 
         |- If we got here and don't have a target, tanks are invalid or no fighting is going on 
         /goto :EndAutoassist 
         :EngageCheck 
         /varset oldtargetID ${Target.ID} 
         /varset assisttimer ${Math.Calc[10+${Math.Rand[5]}].Int} 
         |- SKHo is the valid tank? 
         /if (${firstassist.Equal[Main]} || (${Math.Distance[${Target.Y},${Target.X}:${Spawn[pc ${firstassist}].Y},${Spawn[pc ${firstassist}].X}]}<${Target.MaxRangeTo})) { 
           /varset mainassist ${firstassist} 
           /goto :LastAttackCheck 
         } 
         /if (${secondassist.Equal[Main]} || (${Math.Distance[${Target.Y},${Target.X}:${Spawn[pc ${secondassist}].Y},${Spawn[pc ${secondassist}].X}]}<${Target.MaxRangeTo})) { 
           /varset mainassist ${secondassist} 
           /goto :LastAttackCheck 
         } 
         /if (${thirdassist.Equal[Main]} || (${Math.Distance[${Target.Y},${Target.X}:${Spawn[pc ${thirdassist}].Y},${Spawn[pc ${thirdassist}].X}]}<${Target.MaxRangeTo})) { 
           /varset mainassist ${thirdassist} 
           /goto :LastAttackCheck 
         } 
         /goto :EndAutoassist 
         :LastAttackCheck 
         |- Do we have an NPC targeted and is it hurt enough to attack? 
         /if (${Target.PctHPs}<=${assistpct} && ${Target.Animation}!=32 && ${Target.Animation}!=110) { 
           /if (${verbosity}>=1) /${channel} --> Assisting ${mainassist} on ${Target.CleanName} @ (${Target.PctHPs}%) HPs 
           /echo Seeking a Victim... 
           /goto :Foreverloop      
         } 
       } 
     } 
     :EndAutoassist 


     |- We could be on a leash, if so move 1s closer to our stake point (or master)\\ 

     /if (${doLeash} && !${strikeReady}) { 
       /varset lastevent Event_Leashing 
       :LeashStart 
       |- Look for new events 
       /doevents 
       /if (!${lastevent.Equal[Event_Leashing]}) /goto :ForeverLoop 
       /if (${Me.Combat}) /goto :ForeverLoop 
       /if (${leashholder.Equal[Nobody]} && (${Math.Distance[${Me.Y},${Me.X}:${stakeY},${stakeX}]}>${Math.Calc[${leashlength}*${leashflex}/100]})) { 
         /if (${verbosity}>=2) /${channel} Moving closer to the Stake... ${Math.Distance[${Me.Y},${Me.X}:${stakeY},${stakeX}]} ft. away 
         /face ${If[${Me.Swimming},,nolook]} loc ${stakeY},${stakeX} 
         /keypress forward hold 
         /delay 1s ${Math.Distance[${Me.Y},${Me.X}:${stakeY},${stakeX}]}<${Math.Calc[${leashlength}*${leashflex}/100]} 
         /keypress forward 
         /if (${Math.Distance[${Me.Y},${Me.X}:${stakeY},${stakeX}]}<${Math.Calc[${leashlength}*${leashflex}/100]}) { 
           /if (${verbosity}>=2) /${channel} Arrived near enough to the Stake. 
           /face fast ${If[${Me.Swimming},,nolook]} away loc ${stakeY},${stakeX} 
           /goto :LeashEnd 
         } 
         /goto :LeashStart 
       } 
       /if (!${leashholder.Equal[Nobody]} && ${Spawn[${leashholder}].ID} && (${Spawn[${leashholder}].Distance}>${Math.Calc[${leashlength}*${leashflex}/100]})) { 
         /if (${verbosity}>=2) /${channel} Moving closer to ${leashholder}... ${Spawn[${leashholder}].Distance} ft. away 
         /if (${Target.ID}!=${Spawn[${leashholder}].ID}) /target id ${Spawn[${leashholder}].ID} 
         /if (${Me.Combat}) /attack off 
         /face ${If[${Me.Swimming},,nolook]} 
         /keypress forward hold 
         /delay 1s ${Spawn[${leashholder}].Distance}<${Math.Calc[${leashlength}*${leashflex}/100]}  
         /keypress forward 
         /if (${Spawn[${leashholder}].Distance}<${Math.Calc[${leashlength}*${leashflex}/100]}) { 
           /if (${verbosity}>=2) /${channel} Arrived near enough to Master (${leashholder}). 
           /goto :LeashEnd 
         } 
         /goto :LeashStart 
       } 
       |- Broken leash check 
       /if (!${leashholder.Equal[Nobody]} && !${Spawn[${leashholder}].ID}) { 
         /if (${verbosity}>=1) /${channel} ** Master DEAD or ZONED! Leash is BROKEN! 
         /varset doLeash FALSE 
         /varset leashholder Nobody 
         /ini "SKHSettings.ini" "General" "Leashing" "${doLeash}" 
         /ini "SKHSettings.ini" "General" "LeashHolder" "${leashholder}" 
         /goto :LeashEnd 
       } 
       :LeashEnd 
     } 
   } 
  /goto :ForeverLoop 
/return 

|---- SUBROUTINES 

Sub Check_Behind 
  /declare behindIt FALSE 
  |- Are we behind our target? 
  /for i -1 to 1 
    /varcalc dir (${Target.Heading.Clock}+${i})%12 
    /if (${dir}<1) /varcalc dir ${dir}+12 
    /if (${dir}>12) /varcalc dir ${dir}-12 
    /if (${dir} == ${Me.Heading.Clock}) /varset behindIt TRUE 
  /next i    
/return ${behindIt} 

Sub Debuff


     |- cast ToHate?
:ToH
     /if (${doToH} && ${needToH} && ${Target.PctHPs}<95) { 
       /call cast ${Attackdebuff} gem{ToHgem} 5s 
       /if (${verbosity}>=2) /${channel} Stealing attack from: ${Target.CleanName}
       /varset needToH FALSE
       /if (${String[${Macro.Return}].Equal[CAST_RESISTED]}) /varset needToH TRUE 
      /goto :ToH
      }


     |- cast ToPain?
:ToP
     /if (${doToP} && ${needToP} && ${Target.PctHPs}<95) { 
       /call cast ${Acdebuff} gem${ToPgem} 5s 
       /if (${verbosity}>=2) /${channel} Stealing ac from: ${Target.CleanName} 
       /varset needToP FALSE 
       /if (${String[${Macro.Return}].Equal[CAST_RESISTED]}) /varset needToP TRUE  
    /goto :ToP
       }

     |- cast ToFatigue?
:ToF
     /if (${doToF} && ${needToF} && ${Target.PctHPs}<95) { 
       /call cast ${Strdebuff} gem${ToFgem} 5s 
       /if (${verbosity}>=2) /${channel} Stealing Str & Sta from: ${Target.CleanName} 
       /varset needToF FALSE 
       /if (${String[${Macro.Return}].Equal[CAST_RESISTED]}) /varset needToF TRUE  
    /goto :ToF
       }


     |- cast Dooming Darkness?
:DD
     /if (${doDD} && ${needDD} && ${Target.PctHPs}<30) { 
        /call cast ${Snare} gem${DDgem} 5s 
        /if (${verbosity}>=2) /${channel} casting ${Snare} on: ${Target.CleanName} 
        /varset needDD FALSE }
        /if (${String[${Macro.Return}].Equal[CAST_RESISTED]}) /varset needDD TRUE
        /if (${String[${Macro.Return}].Equal[CAST_IMMUNE]}) /varset needDD FALSE  
        /if (${String[${Macro.Return}].Equal[CAST_IMMUNE]} && ${verbosity}>=2) /${channel} ${Target.CleanName}: is Immune to Snare
    /goto :DD
    }



     |- cast Terror spell?
:ToD
     /if (${doToD} && ${Me.TargetOfTarget.Name.NotEqual[${Me}]} && ${Target.PctHPs}<95) { 
       /call cast ${Terror} gem${ToDgem} 5s 
       /if (${verbosity}>=2) /${channel} Trying to get agro: ${Target.CleanName}  
    /goto :ToD
       }

     |- cast Bite spell?
:Bite
     /if (${doBite} && ${Me.PctHPs}<${Bitehp} && ${Me.SpellReady[${Bite}]} && ${Target.PctHPs}<95) { 
       /call cast ${Bite} gem${Bitegem} 5s 
       /if (${verbosity}>=2) /${channel} Biteing: ${Target.CleanName}  
    /goto :Bite
       }

    
 |- cast Spear spell?
:Spear
     /if (${doSpear} && ${Me.SpellReady[${Spear}]} && ${Target.PctHPs}<95) {
       /call cast ${Spear} gem${Speargem} 3s
       /if (${verbosity}>=2) /${channel} ${Spear}: ${Target.CleanName}  
    /goto :Spear
       }
/return

 |- cast Lifetap spell?
:Lifetap
     /if (${doLifetap} && ${Me.SpellReady[${Lifetap}]} && ${Me.PctMana}>50 && ${Target.PctHPs}<95 && ${Me.PctHPs}<${Lifetaphp}) {
       /call cast ${Lifetap} gem${Lifetapgem} 3s
       /if (${verbosity}>=2) /${channel} ${Lifetap}: ${Target.CleanName}  
    /goto :Lifetap
       }
/return

Sub Buff

 |- cast Voice spell
:Voice
     /if (${doVoice} && ${Me.SpellReady[${Voice}]}) {
       /Target PC ${Voicereciever}
       /call cast ${Voice} gem${Voicegem} 5s
       /if (${verbosity}>=2) /${channel} Voice on: ${Target.CleanName}  
    /goto :Voice
       }
/return

 |- cast Voice spell
:Proc
     /if (${doProc} && !${Me.Buff[Mental Corruption].ID} && !${Me.Buff[Mental Horror].ID} && !${Me.Buff[Shroud of Death].ID} && !${Me.Buff[Shroud of Undeath].ID} && !${Me.Buff[Mental Corruption].ID} && !${Me.Buff[Vampric Embrace].ID} && !${Me.Buff[Scream of Death].ID} && !${Me.Buff[Shroud of Discord].ID}) {
        /call cast ${Proc} gem${Procgem} 5s
       /if (${verbosity}>=2) /${channel} buffing with ${Proc}: ${Target.CleanName}  
    /goto :Proc
       }
/return




Sub Weapon_Swap(string weapon, string wieldedweapon) 
  |- Is it in a Bag? 
  /declare camefrom ${FindItem[${weapon}].InvSlot} 
  /declare goingto ${FindItem[${wieldedweapon}].InvSlot} 
  /if (${verbosity}>=2) /${channel} ** Looking for weapon: ${weapon} 
  /if (${FindItem[${weapon}].InvSlot.Pack}) { 
    :OpenPack 
    /if (!${Window[${FindItem[${weapon}].InvSlot.Pack.Name}].Open}) { 
      /itemnotify ${FindItem[${weapon}].InvSlot.Pack.Name} rightmouseup 
      /delay 2 
      /goto :OpenPack 
    } 
    :GrabItem 
    /if (!${Cursor.ID}) { 
      /itemnotify ${InvSlot[${camefrom}]} leftmouseup 
      /delay 2 
      /goto :GrabItem 
    } 
    /declare weaponID int local ${Cursor.ID} 
    :SwapIt 
    /if (${Cursor.ID}==${weaponID}) { 
      /itemnotify ${InvSlot[${goingto}]} leftmouseup 
      /delay 2 
      /goto :SwapIt 
    } 
    /delay 2 
    /if (${verbosity}>=2) /${channel} ** Swapping out: ${weapon} 
    /itemnotify ${InvSlot[${camefrom}]} leftmouseup 
    /delay 2 
    /if (${Cursor.ID}) { 
      /if (${verbosity}>=1) /${channel} ** Failed to use existing slot, dropping to inventory! 
      /autoinv 
    } 
    :ClosePack 
    /if (${Window[${InvSlot[${camefrom}].Pack.Name}].Open}) { 
      /itemnotify ${InvSlot[${camefrom}].Pack.Name} rightmouseup 
      /delay 2 
      /goto :ClosePack 
    } 
  } else { 
    |- It's in the main inventory 
    /if (${FindItem[${weapon}].InvSlot}) { 
      /itemnotify ${FindItem[${weapon}].InvSlot} leftmouseup 
      /delay 2 
      /itemnotify ${InvSlot[${goingto}]} leftmouseup 
      /delay 2 
      /if (${verbosity}>=2) /${channel} ** Swapping out: ${weapon} 
      /itemnotify ${InvSlot[${camefrom}]} leftmouseup 
      /delay 2 
      /if (${Cursor.ID}) { 
        /if (${verbosity}>=1) /${channel} ** Failed to use existing slot, dropping to inventory! 
        /autoinv 
      } 
    } else { 
      /if (${verbosity}>=1) /${channel} ** "${weapon}" not found! 
    } 
  } 
/return
Last edited by majic on Tue Feb 22, 2005 4:37 pm, edited 3 times in total.

majic
orc pawn
orc pawn
Posts: 20
Joined: Fri Dec 03, 2004 10:08 pm

skh.mac part 2 of 2

Post by majic » Tue Feb 22, 2005 4:09 pm

Code: Select all

Sub NinjaLoot 
  |- Ninja the corpse's loot, if applicable 
  /if (${ninjamode.NotEqual[OFF]}) { 
    /declare LootTotal int local -1 
    /declare LootSlot int local 
    |- Get NPC corpse on target and continue if possible 

    /squelch /target npc corpse radius ${ninjadist} 
    /if (${Target.Type.NotEqual[CORPSE]} || !${Target.ID}) { 
      /if (${verbosity}>=1) /${channel} ** NPC corpse out of range or already looted! 
      /return 
    }    
    |- Get 5 seconds (max) closer; warning, no detecting being stuck! 
    /face ${If[${Me.Swimming},,nolook]} fast 
    /keypress forward hold 
    /delay 5s ${Target.Distance}<5 
    /keypress forward 
    |- Open up the loot window 
    /loot 
    /delay 1s 
    /if (${Me.State.NotEqual[BIND]}) { 
      /if (${verbosity}>=1) /${channel} ** Massive lag or error getting to corpse.  Aborting! 
      /return 
    } 
    /if (${verbosity}>=1) /${channel} ** Looting ${Target.CleanName}  
    |- Get item count accurately  
    :LootLag 
    /if (${LootTotal}!=${Corpse.Items}) { 
      /varset LootTotal ${Corpse.Items} 
      /delay 5 
      /goto :LootLag 
    } 
    /if (!${LootTotal}) { 
      /if (${verbosity}>=1) /${channel} ** Empty corpse! 
      /goto :DoneLooting 
    } 
    |- Loot Loop 
    /for LootSlot 1 to ${LootTotal} 
      |- Check for full inventory 
      /if (!${Me.FreeInventory}) { 
        /beep 
        /if (${verbosity}>=1) /${channel} ** INVENTORY FULL ! 
        /varset ninjamode OFF 
        /if (${verbosity}>=1) /${channel} ** AutoNinja is now OFF! 
        /goto :DoneLooting 
      } 
      |- Loot item if we should, skip it if not 
      /if (${Corpse.Item[${LootSlot}].ID}) { 
        /if (!${Corpse.Item[${LootSlot}].NoDrop}) /goto :LootItem 
        /if (${Corpse.Item[${LootSlot}].NoDrop} && ${ninjamode.Equal[ALL]}) { 
          /if (${verbosity}>=1) /${channel} ** Looting NODROP Item: ${Corpse.Item[${LootSlot}].Name} 
          /goto :LootItem 
        } 
      } 
      /if (${verbosity}>=1) /${channel} ** Skipping Item: ${Corpse.Item[${LootSlot}].Name} 
      /goto :SkipIt 
      :LootItem 
      /itemnotify loot${LootSlot} rightmouseup 
      /delay 3 
      /if (${Corpse.Item[${LootSlot}].ID}) { 
        /delay 2 
        /goto :LootItem 
      } 
      :SkipIt 
    /next LootSlot 
    /if (${verbosity}>=1) /${channel} ** Done looting ${Target.CleanName} 
    :DoneLooting 
    /delay 5 
    /notify LootWnd DoneButton leftmouseup 
    /delay 5 
  } 

/return
|---- EVENTS 

Sub Event_AttackOn 
  /varset lastevent Event_AttackOn 
  /if (${verbosity}>=1) /${channel} Autoattack activated! Target: ${Target.CleanName} 
  /varset acquiretimer 2s 
/return 

Sub Event_AttackOff 
  /varset lastevent Event_AttackOff 
  /if (${verbosity}>=1) /${channel} Autoattack turned off! Target: ${Target.CleanName} 
/return 

Sub Event_Enraged 
  /varset lastevent Event_Enraged 
  /if (${verbosity}>=1) /${channel} Enrage detected! Target: ${Target.CleanName} 
  /varset isEnraged TRUE 
/return 

Sub Event_NLEnraged 
  /varset lastevent Event_NLEnraged 
  /if (${verbosity}>=1) /${channel} Enrage done! Target: ${Target.CleanName} 
  /varset isEnraged FALSE 
  /if (${Target.ID} && ${doAutoassist}) /attack on 
/return 

Sub Event_Exp(string Line) 
  /varset lastevent Event_Exp 
  |- Ignore leadership experience event triggers (redundant trigger) 
  /if (${Line.Find[leadership]}) /return 

  |- Manage aggro control here optionally 
  /if (${doDynaggro} && ${doAutoassist}) { 
    /if (${gotHit}) { 
      |- Got hurt that fight, drop it 1% 
      /if (${assistpct}>1) /varcalc assistpct ${assistpct}-1 
      /varset gotHit FALSE 
      /if (${verbosity}>=1) /${channel} ** Had Aggro! Reducing assist% to ${assistpct}% 
    } else { 
      |- Did not get hurt that fight, raise it 1% 
      /if (${assistpct}<99) /varcalc assistpct ${assistpct}+1 
      /if (${verbosity}>=1) /${channel} ** No Aggro! Raising assist% to ${assistpct}% 
    } 
  } 

  |- Experience calculation and reporting 
  /if (${verbosity}>=1) /${channel} ** XP-Delta: REG (${Math.Calc[${Me.PctExp}-${Exp2}]}%), AA (${Math.Calc[${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[${Me.PctGroupLeaderExp}-${LDExp}]}%) 
  /varset LDExp ${Me.PctGroupLeaderExp} 
  /varset AAExp ${Me.PctAAExp} 
  /varset Exp2 ${Me.PctExp} 

  |- If target died SKHile enraged, reset it so autoassist isn't broken... 
  /varset isEnraged FALSE 

  |- Do weapon swapping (back to weapon1), if applicable 
  /if (${doSwitch} && ${wstype.Equal[Detrimental]}) { 
    /call Weapon_Swap "${weapon1}" "${weapon2}" 
  } 
/return 

Sub Event_Slain 
  /varset lastevent Event_Slain 
  /call NinjaLoot 
  /varset needToP TRUE
  /Varset needToH TRUE
  /Varset needDD TRUE
/return 

Sub Event_Zoned 
  /varset lastevent Event_Zoned 
  /if (${verbosity}>=1) /${channel} ** Zoned... Setting Leash and Autoassist to OFF! 
  /varset doLeash FALSE 
  /varset doAutoassist FALSE 
  /ini "SKHSettings.ini" "General" "AutoAssist" "${doAutoassist}" 
  /ini "SKHSettings.ini" "General" "Leashing" "${doLeash}" 
/return 

Sub Event_TooFarAway 
  /varset lastevent Event_TooFarAway 
  /if (${doDynclose} && !${acquiretimer}) { 
    /if (${verbosity}>=1) /${channel} ** Too far away - Getting 20% closer now! 
    /varset closeness ${Math.Calc[${closeness}*0.8].Int} 
    /if (${closeness}<20) /varset closeness 20 
    /varset acquiretimer 2s 
    /varset snuggleup TRUE 
  } 
/return 


Sub Event_SetStopFighting(string Line) 
  /varset lastevent Event_SetStopFighting 
  /if (${Line.Arg[3].Length}) /varset StopFightingHealth ${Line.Arg[3]} 
  /if ((${StopFightingHealth}<0) || (${StopFightingHealth}>100)) { 
    /if (${verbosity}>=0) /${channel} SKHacko stopfighting percentage input! Defaulting... 
  } 
  /if (${verbosity}>=0) /${channel} ** Cease Combat SKHen at: ${StopFightingHealth}% HP 
  /ini "SKHSettings.ini" "General" "StopFightingHealth" "${StopFightingHealth}" 
/return 

Sub Event_TogStick 
  /varset lastevent Event_TogStick 
  /if (${doStick}) { 
    /varset doStick FALSE 
    /if (${verbosity}>=0) /${channel} ** Auto-Sticking target is now OFF! 
  } else { 
    /varset doStick TRUE 
    /if (${verbosity}>=0) /${channel} ** Auto-Sticking target is now ON! 
  } 
  /ini "SKHSettings.ini" "General" "AutoStick" "${doStick}" 
/return 

Sub Event_TogLeash(string Line) 
  /varset lastevent Event_TogLeash 
  /if (${Line.Arg[3].Equal[ON]}) { 
    /varset doLeash TRUE 
    /if (${verbosity}>=0) /${channel} ** Leashing is now ON! 
    /ini "SKHSettings.ini" "General" "Leashing" "${doLeash}" 
  } else /if (${Line.Arg[3].Equal[OFF]} || (${Int[${Line.Arg[3]}]}<=0)) { 
    /varset doLeash FALSE 
    /varset leashholder Nobody 
    /if (${verbosity}>=0) /${channel} ** Leashing is now OFF! 
    /ini "SKHSettings.ini" "General" "Leashing" "${doLeash}" 
  } else { 
    /if (${Line.Arg[4].Length}) { 
      /varset leashholder ${Line.Arg[4]} 
      /if (${Spawn[${leashholder}].ID}) { 
        /varset doLeash TRUE 
        /varset leashlength ${Int[${Line.Arg[3]}]} 
        /if (${verbosity}>=0) /${channel} ** Leashing is now ON! Leashlength: ${leashlength} ft. 
        /if (${verbosity}>=0) /${channel} ** Leash-holding master is: ${leashholder} 
        /ini "SKHSettings.ini" "General" "Leashing" "${doLeash}" 
      } else { 
        |- This spawn/thing/target doesn't exist 
        /if (${verbosity}>=0) /${channel} ** Can't find "${leashholder}" -- SKHo is that?! 
        /if (${verbosity}>=0) /${channel} ** Leashing is now OFF! 
        /varset doLeash FALSE 
        /varset leashholder Nobody 
      } 
    } else { 
      /varset doLeash TRUE 
      /varset leashholder Nobody 
      /varset leashlength ${Int[${Line.Arg[3]}]} 
      /varset stakeX ${Me.X} 
      /varset stakeY ${Me.Y} 
      /if (${verbosity}>=0) /${channel} ** Leashing is now ON! Leashlength: ${leashlength} ft. 
      /if (${verbosity}>=0) /${channel} ** Stake planted at X:${stakeX}, Y:${stakeY} 
    } 
  } 
  /ini "SKHSettings.ini" "General" "LeashHolder" "${leashholder}" 
  /ini "SKHSettings.ini" "General" "LeashLength" "${leashlength}" 
/return 

Sub Event_SetLeashFlex(string Line) 
  /varset lastevent Event_SetLeashFlex 
  /if (${Line.Arg[3].Length}) /varset leashflex ${Line.Arg[3]} 
  /if ((${leashflex}<10) || (${leashflex}>101)) { 
    /if (${verbosity}>=0) /${channel} Leash flexibility must be between 10 and 100! Defaulting to 10... 
    /varset leashflex 10 
  } 
  /if (${verbosity}>=0) /${channel} ** Leash Flexibility: ${leashflex}% 
  /ini "SKHSettings.ini" "General" "LeashFlex" "${leashflex}" 
/return 

Sub Event_TogAuto(string Line) 
  /varset lastevent Event_TogAuto 
  /if (${Line.Arg[3].Equal[OFF]}) { 
    /varset doAutoassist FALSE 
    /if (${verbosity}>=0) /${channel} ** Autoassist is now OFF! 
  } else /if (${Line.Arg[3].Equal[ON]}) { 
    /varset doAutoassist TRUE 
    /if (${verbosity}>=0) /${channel} ** Autoassist is now ON! 
  } else { 
    /varset doAutoassist TRUE 
    /if (${Line.Arg[3].Length}) /varset firstassist ${Line.Arg[3]} 
    /varset mainassist ${firstassist} 
    /if (${Line.Arg[4]} > 0) /varset assistpct ${Line.Arg[4]} 
    /if (${verbosity}>=0) /${channel} ** Autoassist is now ON! 
    /if (${verbosity}>=0) /${channel} ** Assisting: ${mainassist} @${assistpct}% target health 
    /if (${verbosity}>=0) /${channel} ** SA is ${secondassist} & TA is ${thirdassist} 
  } 
  /ini "SKHSettings.ini" "General" "AutoAssist" "${doAutoassist}" 
  /ini "SKHSettings.ini" "General" "MainAssist" "${firstassist}" 
  /ini "SKHSettings.ini" "General" "AssistPercentage" "${assistpct}" 
/return 

Sub Event_TogPause 
  /varset lastevent Event_TogPause 
  /beep 
  /if (${isPaused}) { 
    /varset isPaused FALSE 
    /if (${verbosity}>=0) /${channel} ** Shadow Knight Helper is now RESUMING! 
  } else { 
    /varset isPaused TRUE 
    /if (${verbosity}>=0) /${channel} ** Shadow Knight Helper is now PAUSED! 
  } 
/return 

Sub Event_TogDynaggro 
  /varset lastevent Event_TogDynaggro 
  /if (${doDynaggro}) { 
    /varset doDynaggro FALSE 
    /if (${verbosity}>=0) /${channel} ** Dynamic Aggro Control is now OFF! 
  } else { 
    /varset doDynaggro TRUE 
    /if (${verbosity}>=0) /${channel} ** Dynamic Aggro Control is now ON! 
  } 
  /ini "SKHSettings.ini" "General" "DynamicAggro" "${doDynaggro}" 
/return 

Sub Event_TogDynclose 
  /varset lastevent Event_TogDynclose 
  /if (${doDynclose}) { 
    /varset doDynclose FALSE 
    /if (${verbosity}>=0) /${channel} ** Dynamic Closeness Control is now OFF! 
  } else { 
    /varset doDynclose TRUE 
    /if (${verbosity}>=0) /${channel} ** Dynamic Closeness Control is now ON! 
  } 
  /ini "SKHSettings.ini" "General" "DynamicCloseness" "${doDynclose}" 
/return 

Sub Event_TogTaunt 
  /varset lastevent Event_TogTaunt 
  /if (${doTaunt}) { 
    /varset doTaunt FALSE 
    /if (${verbosity}>=0) /${channel} ** Auto-Taunting is now OFF! 
  } else { 
    /varset doTaunt TRUE 
    /if (${verbosity}>=0) /${channel} ** Auto-Taunting is now ON! 
  } 
  /ini "SKHSettings.ini" "General" "AutoTaunt" "${doTaunt}" 
/return 

Sub Event_TogTank 
  /varset lastevent Event_TogTank 
  /if (${isTanking}) { 
    /varset isTanking FALSE 
    /if (${verbosity}>=0) /${channel} ** Tanking is now OFF! 
  } else { 
    /varset isTanking TRUE 
    /if (${verbosity}>=0) /${channel} ** Auto-Tanking is now ON! 
  } 
  /ini "SKHSettings.ini" "General" "Tanking" "${isTanking}" 
/return 

Sub Event_TogTSwitch 
  /varset lastevent Event_TogTSwitch 
  /if (${doTSwitch}) { 
    /varset doTSwitch FALSE 
    /if (${verbosity}>=0) /${channel} ** Auto-Target Switching is now OFF! 
  } else { 
    /varset doTSwitch TRUE 
    /if (${verbosity}>=0) /${channel} ** Auto-Target Switching is now ON! 
  } 
  /ini "SKHSettings.ini" "General" "TargetSwitching" "${doTSwitch}" 
/return 

Sub Event_SetCloseness(string Line) 
  /varset lastevent Event_SetCloseness 
  /if (${Line.Arg[3].Length}) /varset closeness ${Line.Arg[3]} 
  /if ((${closeness}<1) || (${closeness}>100)) { 
    /if (${verbosity}>=0) /${channel} SKHacko closeness percentage input! Defaulting... 
    /varset closeness 70 
  } 
  /varset closenessdesired ${closeness} 
  /if (${verbosity}>=0) /${channel} ** AutoStick: ${doStick}, Closeness: ${closeness} 
  /ini "SKHSettings.ini" "General" "Closeness" "${closeness}" 
/return 

Sub Event_SetFirstassist(string Line) 
  /varset lastevent Event_SetFirstassist 
  /if (${Line.Arg[3].Length}) /varset firstassist ${Line.Arg[3]} 
  /varset mainassist ${firstassist} 
  /if (${verbosity}>=0) /${channel} ** Assisting: ${mainassist} @${assistpct}% target health 
  /if (${verbosity}>=0) /${channel} ** SA is ${secondassist} & TA is ${thirdassist} 
  /ini "SKHSettings.ini" "General" "MainAssist" "${firstassist}" 
/return 

Sub Event_SetSecondassist(string Line) 
  /varset lastevent Event_SetSecondassist 
  /if (${Line.Arg[3].Length}) /varset secondassist ${Line.Arg[3]} 
  /if (${verbosity}>=0) /${channel} ** Assisting: ${mainassist} @${assistpct}% target health 
  /if (${verbosity}>=0) /${channel} ** SA is ${secondassist} & TA is ${thirdassist} 
  /ini "SKHSettings.ini" "General" "SecondAssist" "${secondassist}" 
/return 

Sub Event_SetThirdassist(string Line) 
  /varset lastevent Event_SetThirdassist 
  /if (${Line.Arg[3].Length}) /varset thirdassist ${Line.Arg[3]} 
  /if (${verbosity}>=0) /${channel} ** Assisting: ${mainassist} @${assistpct}% target health 
  /if (${verbosity}>=0) /${channel} ** SA is ${secondassist} & TA is ${thirdassist} 
  /ini "SKHSettings.ini" "General" "ThirdAssist" "${thirdassist}" 
/return 

Sub Event_SetAutoNinja(string Line) 
  /varset lastevent Event_SetAutoNinja 
  |- Set the new ninja distance, if supplied 
  /if (${Line.Arg[4].Length}) /varset ninjadist ${Line.Arg[4]} 
  |- Set the mode, toggle off if unknown 
  /if (${Line.Arg[3].Equal[ALL]}) { 
    /varset ninjamode ALL 
    /if (${verbosity}>=0) /${channel} ** AutoNinja ON - Will loot ALL items 
    /docommand /lootnodrop never 
  } else /if ((${Line.Arg[3].Equal[DROP]}) || (${Line.Arg[3].Equal[DROPABLE]})) { 
    /varset ninjamode DROPABLE 
    /if (${verbosity}>=0) /${channel} ** AutoNinja ON - Will loot only DROPABLE items 
    /docommand /lootnodrop never 
  } else { 
    /varset ninjamode OFF 
    /if (${verbosity}>=0) /${channel} ** AutoNinja is now OFF! 
  } 
  /if (${verbosity}>=0) /${channel} ** AutoNinja distance is ${ninjadist} ft. 
  /ini "SKHSettings.ini" "General" "AutoNinjaMode" "${ninjamode}" 
  /ini "SKHSettings.ini" "General" "AutoNinjaDistance" "${ninjadist}" 
/return 

Sub Event_SetWeaponSwitch(string Line) 
  /varset lastevent Event_SetWeaponSwitch 
  |- Sanity Check 
  /if (${Line.Arg[3].Equal[OFF]} || !${Line.Arg[5].Length} || ${Line.Arg[6].Length}) { 
    /varset doSwitch FALSE 
    /if (${verbosity}>=0) /${channel} ** Auto Weapon Switching is OFF 
    /goto :SaveSwitchSettings 
  } 
  |- Set the weaponswitching information 
  /if (${Line.Arg[3].Length}) /varset weapon1 ${Line.Arg[3]} 
  /if (${Line.Arg[4].Length}) /varset switchtext ${Line.Arg[4]} 
  /if (${Line.Arg[5].Length}) /varset weapon2 ${Line.Arg[5]} 
  /varset doSwitch TRUE  
  /if (${verbosity}>=0) /${channel} ** Auto Weapon Switching is ON 
  /if (${verbosity}>=0) /${channel} ** ${weapon1} will be swapped out for ${weapon2} 
  /if (${verbosity}>=0) /${channel} ** if the text "${switchtext}" is encountered. 

  :SaveSwitchSettings 
  /doevents flush 
  /ini "SKHSettings.ini" "General" "WeaponSwitching" "${doSwitch}" 
  /ini "SKHSettings.ini" "Weapons" "Weapon1" "${weapon1}" 
  /ini "SKHSettings.ini" "Weapons" "Weapon2" "${weapon2}" 
  /ini "SKHSettings.ini" "Weapons" "SwitchText" "${switchtext}" 
  /varset wstype ${FindItem[${weapon1}].Spell.SpellType} 
/return 

Sub Event_SetStickDist(string Line) 
  /varset lastevent Event_SetStickDist 
  |- Sanity Check 
  /if (!${Line.Arg[3].Length} || !${Line.Arg[4].Length}) { 
    /if (${verbosity}>=0) /${channel} ** SKHat? Bad Syntax. 
    /if (${verbosity}>=0) /${channel} Syntax: 
    /if (${verbosity}>=0) /${channel} /stickdist <range_to_target> <range_to_tank> 
    /return 
  } 
  |- Set the weaponswitching information 
  /varset rngtarget ${Line.Arg[3]} 
  /varset rngtank ${Line.Arg[4]} 
  /if (${verbosity}>=0) /${channel} ** Auto Stick: ${doStick}, Closeness: ${closeness}% MaxRange 
  /if (${verbosity}>=0) /${channel} ** -- Range to Target: ${rngtarget} -- Range to Tank: ${rngtank} 
  /ini "SKHSettings.ini" "General" "StickRangeToTarget" "${rngtarget}" 
  /ini "SKHSettings.ini" "General" "StickRangeToTank" "${rngtank}" 
/return 

Sub Event_SetDD(string Line) 
  /varset lastevent Event_SetDD 
  /if (${Line.Arg[3].Equal[OFF]}) { 
    /varset doDD FALSE 
    /if (${verbosity}>=0) /${channel} ** Auto-${Snare} is now OFF!
  } else /if (${Line.Arg[3].Equal[ON]}) { 
    /varset doDD TRUE 
    /if (${verbosity}>=0) /${channel} ** Auto-${Snare}  is now ON!  
  } else { 
    /varset doDD TRUE 
    /if (${Line.Arg[3].Length}) /varset Snare ${Line.Arg[3]} 
    /if (${verbosity}>=0) /${channel} ** Auto ${Snare}: ${doDD}
  } 
  /ini "SKHSettings.ini" "Spells" "AutoSnare" "${doDD}"
  /ini "SKHSettings.ini" "Spells" "Darkness" "${Snare}"  
/return 

Sub Event_SetToH(string Line) 
  /varset lastevent Event_SetToH
  /if (${Line.Arg[3].Equal[OFF]}) { 
    /varset doToH FALSE 
    /if (${verbosity}>=0) /${channel} ** Auto-${Attackdebuff} is now OFF!
  } else /if (${Line.Arg[3].Equal[ON]}) { 
    /varset doToH TRUE 
    /if (${verbosity}>=0) /${channel} ** Auto-${Attackdebuff}  is now ON!  
  } else { 
    /varset doToH TRUE 
    /if (${Line.Arg[3].Length}) /varset Attackdebuff ${Line.Arg[3]} 
    /if (${verbosity}>=0) /${channel} ** Auto ${Attackdebuff}: ${doToH}
  } 
  /ini "SKHSettings.ini" "Spells" "AutoToH" "${doToH}"
  /ini "SKHSettings.ini" "Spells" "Attackdebuff" "${Attackdebuff}"  
/return 

Sub Event_SetToF(string Line) 
  /varset lastevent Event_SetToH
  /if (${Line.Arg[3].Equal[OFF]}) { 
    /varset doToF FALSE 
    /if (${verbosity}>=0) /${channel} ** Auto-${Strdebuff} is now OFF!
  } else /if (${Line.Arg[3].Equal[ON]}) { 
    /varset doToF TRUE 
    /if (${verbosity}>=0) /${channel} ** Auto-${Strdebuff}  is now ON!  
  } else { 
    /varset doToF TRUE 
    /if (${Line.Arg[3].Length}) /varset Strdebuff ${Line.Arg[3]} 
    /if (${verbosity}>=0) /${channel} ** Auto ${Strdebuff}: ${doToH}
  } 
  /ini "SKHSettings.ini" "Spells" "AutoToP" "${doToP}"
  /ini "SKHSettings.ini" "Spells" "Strdebuff" "${Strdebuff}"  
/return 

Sub Event_SetToP(string Line) 
  /varset lastevent Event_SetToD
  /if (${Line.Arg[3].Equal[OFF]}) { 
    /varset doToP FALSE 
    /if (${verbosity}>=0) /${channel} ** Auto-${Acdebuff} is now OFF!
  } else /if (${Line.Arg[3].Equal[ON]}) { 
    /varset doToP TRUE 
    /if (${verbosity}>=0) /${channel} ** Auto-${Acdebuff}  is now ON!  
  } else { 
    /varset doToP TRUE 
    /if (${Line.Arg[3].Length}) /varset Acdebuff ${Line.Arg[3]} 
    /if (${verbosity}>=0) /${channel} ** Auto ${Acdebuff}: ${doToP}
  } 
  /ini "SKHSettings.ini" "Spells" "AutoToP" "${doToP}"
  /ini "SKHSettings.ini" "Spells" "Acdebuff" "${Acdebuff}"  
/return 

Sub Event_SetToD(string Line) 
  /varset lastevent Event_SetToD
  /if (${Line.Arg[3].Equal[OFF]}) { 
    /varset doToD FALSE 
    /if (${verbosity}>=0) /${channel} ** Auto-${Terror} is now OFF!
  } else /if (${Line.Arg[3].Equal[ON]}) { 
    /varset doToD TRUE 
    /if (${verbosity}>=0) /${channel} ** Auto-${Terror}  is now ON!  
  } else { 
    /varset doToP TRUE 
    /if (${Line.Arg[3].Length}) /varset Terror ${Line.Arg[3]} 
    /if (${verbosity}>=0) /${channel} ** Auto ${Terror}: ${doToD}
  } 
  /ini "SKHSettings.ini" "Spells" "AutoToD" "${doToD}"
  /ini "SKHSettings.ini" "Spells" "Terror" "${Terror}"  
/return

Sub Event_SetSpear(string Line) 
  /varset lastevent Event_SetSpear
  /if (${Line.Arg[3].Equal[OFF]}) { 
    /varset doSpear FALSE 
    /if (${verbosity}>=0) /${channel} ** Auto-${Spear} is now OFF!
  } else /if (${Line.Arg[3].Equal[ON]}) { 
    /varset doSpear TRUE 
    /if (${verbosity}>=0) /${channel} ** Auto-${Spear}  is now ON!  
  } else { 
    /varset doSpear TRUE 
    /if (${Line.Arg[3].Length}) /varset Spear ${Line.Arg[3]} 
    /if (${verbosity}>=0) /${channel} ** Auto ${Spear}: ${doSpear}
  } 
  /ini "SKHSettings.ini" "Spells" "AutoSpear" "${doSpear}"
  /ini "SKHSettings.ini" "Spells" "Spear" "${Spear}"  
/return

Sub Event_SetVoice(string Line) 
  /varset lastevent Event_SetVoice
  /if (${Line.Arg[3].Equal[OFF]}) { 
    /varset doVoice FALSE 
    /if (${verbosity}>=0) /${channel} ** AutoVoice is now OFF! 
  } else /if (${Line.Arg[3].Equal[ON]}) { 
    /varset doVoice TRUE 
    /if (${verbosity}>=0) /${channel} ** AutoVoice is now ON! 
  } else { 
    /varset doVoice TRUE 
    /if (${Line.Arg[3].Length}) /varset Voicereciever ${Line.Arg[3]} 
    /if (${Line.Arg[4].Length}) /varset Voice ${Line.Arg[4]} 
    /if (${verbosity}>=0) /${channel} ** ${Voice}: ${doVoice} is on: ${Voicereciever}
  }
  /ini "SKHSettings.ini" "Spells" "AutoVoice" "${doVoice}" 
  /ini "SKHSettings.ini" "Spells" "Voicereciever" "${Voicereciever}"
  /ini "SKHSettings.ini" "Spells" "Voice" "${Voice}"  
/return 

Sub Event_SetProc(string Line) 
  /varset lastevent Event_SetProc
  /if (${Line.Arg[3].Equal[OFF]}) { 
    /varset doProc FALSE 
    /if (${verbosity}>=0) /${channel} ** Auto-${Proc} is now OFF! 
  } else /if (${Line.Arg[3].Equal[ON]}) { 
    /varset doProc TRUE 
    /if (${verbosity}>=0) /${channel} ** Auto-${Proc} is now ON! 
  } else { 
    /varset doProc TRUE  
    /if (${Line.Arg[3].Length}) /varset Proc ${Line.Arg[3]} 
    /if (${verbosity}>=0) /${channel} ** ${Proc}: ${doProc}
  }
  /ini "SKHSettings.ini" "Spells" "AutoProc" "${doProc}" 
  /ini "SKHSettings.ini" "Spells" "Proc" "${Proc}"  
/return 

Sub Event_SetLifetap(string Line) 
  /varset lastevent Event_SetLifetap
  /if (${Line.Arg[3].Equal[OFF]}) { 
    /varset doLifetap FALSE 
    /if (${verbosity}>=0) /${channel} ** Auto-${Lifetap} is now OFF! 
  } else /if (${Line.Arg[3].Equal[ON]}) { 
    /varset doLifetap TRUE 
    /if (${verbosity}>=0) /${channel} ** Auto-${Lifetap} is now ON! 
  } else { 
    /varset doLifetap TRUE  
    /if (${Line.Arg[3].Length}) /varset Lifetap ${Line.Arg[3]} 
    /if (${Line.Arg[4].Length}) /varset Lifetaphp ${Line.Arg[4]} 
    /if (${verbosity}>=0) /${channel} ** ${Lifetap}: ${doLifetap}
  }
  /ini "SKHSettings.ini" "Spells" "AutoLifetap" "${doLifetap}"
  /ini "SKHSettings.ini" "Spells" "Lifetaphp" "${Lifetaphp}"   
  /ini "SKHSettings.ini" "Spells" "Lifetap" "${Lifetap}"  
/return 

Sub Event_SetBite(string Line) 
  /varset lastevent Event_SetLifetap
  /if (${Line.Arg[3].Equal[OFF]}) { 
    /varset doBite FALSE 
    /if (${verbosity}>=0) /${channel} ** Auto-${Bite} is now OFF! 
  } else /if (${Line.Arg[3].Equal[ON]}) { 
    /varset doBite TRUE 
    /if (${verbosity}>=0) /${channel} ** Auto-${Bite} is now ON! 
  } else { 
    /varset doBite TRUE  
    /if (${Line.Arg[3].Length}) /varset Bite ${Line.Arg[3]} 
    /if (${Line.Arg[4].Length}) /varset Bitehp ${Line.Arg[4]} 
    /if (${verbosity}>=0) /${channel} ** ${Lifetap}: ${doLifetap}
  }
  /ini "SKHSettings.ini" "Spells" "AutoBite" "${doBite}"
  /ini "SKHSettings.ini" "Spells" "Bitehp" "${Bitehp}"   
  /ini "SKHSettings.ini" "Spells" "Bite" "${Bite}"  
/return 

Sub Event_SetDisc1(string Line) 
  /varset lastevent Event_SetDisc1 
  /if (${Line.Arg[3].Equal[OFF]}) { 
    /varset doDisc1 FALSE 
    /if (${verbosity}>=0) /${channel} ** Autodisc #1 is now OFF! 
  } else /if (${Line.Arg[3].Equal[ON]}) { 
    /varset doDisc1 TRUE 
    /if (${verbosity}>=0) /${channel} ** Autodisc #1 is now ON! 
  } else { 
    /varset doDisc1 TRUE 
    /if (${Line.Arg[3].Length}) /varset disc1 ${Line.Arg[3]} 
    /if (${Line.Arg[4]} > 0) /varset disc1end ${Line.Arg[4]} 
    /if (${Line.Arg[5]} > 0) /varset disc1reuse ${Line.Arg[5]} 
    /if (${verbosity}>=0) /${channel} ** Auto Disc #1: ${doDisc1} -> ${disc1}/${disc1reuse} mins - End: ${disc1end} 
  } 
  /ini "SKHSettings.ini" "General" "AutoDisc1" "${doDisc1}" 
  /ini "SKHSettings.ini" "General" "Disc1" "${disc1}" 
  /ini "SKHSettings.ini" "General" "Disc1Endurance" "${disc1end}" 
  /ini "SKHSettings.ini" "General" "Disc1Reuse" "${disc1reuse}" 
/return 

Sub Event_SetDisc2(string Line) 
  /varset lastevent Event_SetDisc2 
  /if (${Line.Arg[3].Equal[OFF]}) { 
    /varset doDisc2 FALSE 
    /if (${verbosity}>=0) /${channel} ** Autodisc #2 is now OFF! 
  } else /if (${Line.Arg[3].Equal[ON]}) { 
    /varset doDisc2 TRUE 
    /if (${verbosity}>=0) /${channel} ** Autodisc #2 is now ON! 
  } else { 
    /varset doDisc2 TRUE 
    /if (${Line.Arg[3].Length}) /varset disc2 ${Line.Arg[3]} 
    /if (${Line.Arg[4]} > 0) /varset disc2end ${Line.Arg[4]} 
    /if (${Line.Arg[5]} > 0) /varset disc2reuse ${Line.Arg[5]} 
    /if (${verbosity}>=0) /${channel} ** Auto Disc #2: ${doDisc2} -> ${disc2}/${disc2reuse} mins - End: ${disc2end} 
  } 
  /ini "SKHSettings.ini" "General" "AutoDisc2" "${doDisc2}" 
  /ini "SKHSettings.ini" "General" "Disc2" "${disc2}" 
  /ini "SKHSettings.ini" "General" "Disc2Endurance" "${disc2end}" 
  /ini "SKHSettings.ini" "General" "Disc2Reuse" "${disc2reuse}" 
/return 

Sub Event_SetVerbosity(string Line) 
  /varset lastevent Event_SetVerbosity 
  /if (${Line.Arg[3].Length}) /varset verbosity ${Line.Arg[3]} 
  /if ((${verbosity}<0) || (${verbosity}>2)) { 
    /if (${verbosity}>=0) /${channel} Verbosity must be between 0 and 2! Defaulting to 2... 
    /varset verbosity 2 
  } 
  /if (${verbosity}>=0) /${channel} ** Verbosity Level: ${verbosity} 
  /ini "SKHSettings.ini" "General" "Verbosity" "${verbosity}" 
/return 

Sub Event_SetChannel(string Line) 
  /varset lastevent Event_SetChannel 
  /if (${Line.Arg[3].Length}) /varset channel ${Line.Arg[3]} 
  /if (${verbosity}>=0) /${channel} ** SKH Output Channel: ${channel} 
  /ini "SKHSettings.ini" "General" "Channel" "${channel}" 
/return 

Sub Event_SwitchWeapon 
  /varset lastevent Event_SwitchWeapon 
  /if (${doSwitch}) { 
    /call Weapon_Swap "${weapon2}" "${weapon1}" 
  } 
/return 

Sub Event_GotHit 
  /varset lastevent Event_GotHit 
  /if (!${aggrotimer}) /if (${verbosity}>=1) /${channel} ** AGGRO Detected (struck) ** 
  /varset gotHit TRUE 
  /attack on
  /varset aggrotimer 5s 
/return 

Sub Event_GotMissed 
  /varset lastevent Event_GotMissed 
  /if (!${aggrotimer}) /if (${verbosity}>=1) /${channel} ** AGGRO Detected (Whiff) ** 
  /varset gotHit TRUE 
  /attack on
  /varset aggrotimer 5s 
/return 

Sub Event_SpellBounced 
  /varset lastevent Event_SpellBounced 
  /varset clicktimer 60s 
  /beep 
  /beep 
  /beep 
  /if (${verbosity}>=1) /${channel} ** Just detected a BOUNCED spell! 
  /if (${verbosity}>=1) /${channel} ** Use /ibounce to update click-item info! 
/return 

Sub Event_DragBodies(string Line) 
  /varset lastevent Event_DragBodies 
  /declare ArgNum int local 3 
  /declare bodycount int local 

  :CountCorpses 
  /if (${Line.Arg[${ArgNum}].Length}) { 
    |- There's a body name for this argument 
    /varcalc ArgNum ${ArgNum}+1 
    /goto :CountCorpses 
  }  
  /varcalc ArgNum ${ArgNum}-1 

  /if (${ArgNum}==2) { 
    /if (${verbosity}>=0) /${channel} ** No corpse names supplied! 
    /return 
  } else { 
    /if (${verbosity}>=0) /${channel} ** Target self (F1) to stop dragging! 
  } 
  :DragLoop 
  /for bodycount 3 to ${ArgNum} 
    /if (${Target.CleanName.Equal[${Me.Name}]}) { 
      /if (${verbosity}>=0) /${channel} ** Body dragging ceased. 
      /goto :CeaseDragging 
    } 
    /target ${Line.Arg[${bodycount}]}'s 
    /corpse 
    |- Lower this delay at your own risk; too many /corpse commands too fast = cheater! 
    /delay 4 
  /next bodycount 
  /goto :DragLoop 
  :CeaseDragging 
/return 

Sub Event_LootMyCorpse 
  /varset lastevent Event_LootMyCorpse 
  |- Logic ripped off from Loot.mac and simplified someSKHat 
  /declare LootTotal int local 0 
  /declare LootSlot int local 
  |- Get corpse on target and continue looting if possible 
  /squelch /target mycorpse 
  /if (${Target.Type.NotEqual[CORPSE]} || !${Target.ID}) { 
    /if (${verbosity}>=0) /${channel} ** Can't target my corpse. 
    /return 
  }    
  /corpse 
  /delay 1s 
  /loot 
  /delay 1s 
  /if (${Me.State.NotEqual[BIND]}) { 
    /if (${verbosity}>=0) /${channel} ** Massive lag right now... Aborting looting. 
    /return 
  } 
  |- Get item count accurately 
  :LootLag 
  /if (${LootTotal}!=${Corpse.Items}) { 
    /varset LootTotal ${Corpse.Items} 
    /delay 5 
    /goto :LootLag 
  } 
  |- Loot Loop 
  /for LootSlot 1 to ${LootTotal} 
    :LootItem 
    /itemnotify loot${LootSlot} rightmouseup 
    /delay 3 
    /if (${Corpse.Item[${LootSlot}].ID}) { 
      /delay 2 
      /goto :LootItem 
    } 
  /next LootSlot 
  /delay 5 
  /if (${verbosity}>=0) /${channel} ** Done looting my corpse. 
  /notify LootWnd DoneButton leftmouseup 
/return 

Sub Event_AutoFollow(string Line) 
  /varset lastevent Event_AutoFollow 
  /declare distance int local 30 
  /if (${Ini[SKHSettings.ini,General,FollowDistance].NotEqual[NULL]}) /varset distance ${Ini[SKHSettings.ini,General,FollowDistance]} 
  /if (${Line.Arg[3].Length}) /target ${Line.Arg[3]} 
  /if (${Line.Arg[4].Length}) /varset distance ${Line.Arg[4]} 
  /if (${distance}<10) /varset distance 10 
  /ini "SKHSettings.ini" "General" "FollowDistance" "${distance}" 
  /if (${Target.ID}) { 
    /if (${verbosity}>=0) /${channel} ** Autofollow on: ${Target.CleanName} (${distance} ft.) 
    /if (${verbosity}>=0) /${channel} ** Change targets to stop autofollowing. 
  } else { 
    /if (${verbosity}>=0) /${channel} ** Can't activate Autofollow -- no valid target! 
    /return 
  } 
  /declare followID int local ${Target.ID} 
  :FollowingLoop 
  |- Look for new events 
  /doevents 
  /if (!${lastevent.Equal[Event_AutoFollow]}) { 
    /if (${verbosity}>=0) /${channel} ** Autofollow blocked by: ${lastevent} 
    /goto :StopFollowing 
  } 
  /if (${Target.ID}==${followID}) { 
    /if (${Target.ID}) /face fast 
    /if (${Target.Distance}>${distance}) { 
      /keypress forward hold 
      /delay 1s ${Target.Distance}<=${distance} 
      /keypress forward 
    } 
    /goto :FollowingLoop 
  } 
  :StopFollowing 
  /if (${verbosity}>=0) /${channel} ** Autofollow ended. 
/return 

Sub Event_ItemSet(string Line) 
  /varset lastevent Event_ItemSet 
  |- Sanity check parameters 
  /if (!${Line.Arg[5].Length} || ${Line.Arg[6].Length}) { 
    /if (${verbosity}>=0) /${channel} ** Improper use of /iset 
    /if (${verbosity}>=0) /${channel} -- /iset <itemalias> keepup|nokeepup <"Item Name"> 
    /if (${verbosity}>=0) /${channel} -- For example: 
    /if (${verbosity}>=0) /${channel} -- /iset gobby keepup "Shrunken Goblin Skull Earring" 
    /return 
  } 
  /ini "SKHItems.ini" "${Line.Arg[3]}" "FullName" "${Line.Arg[5]}"  
  /ini "SKHItems.ini" "${Line.Arg[3]}" "KeepUp" "${If[${Line.Arg[4].Equal[keepup]},TRUE,FALSE]}" 
  /if (${verbosity}>=0) /${channel} ** ${Line.Arg[5]} (KeepUp=${If[${Line.Arg[4].Equal[keepup]},TRUE,FALSE]}) updated in INI! 
/return 

Sub Event_ItemBounce(string Line) 
  /varset lastevent Event_ItemBounce 
  |- Sanity check parameters 
  /if (!${Line.Arg[4].Length}) { 
    /if (${verbosity}>=0) /${channel} ** Improper use of /ibounce 
    /if (${verbosity}>=0) /${channel} -- /ibounce <itemalias> "Some Spell Name" 
    /if (${verbosity}>=0) /${channel} -- For example: 
    /if (${verbosity}>=0) /${channel} -- /ibounce gobby "Strength of Tunare" 
    /return 
  } 
  |- Look for that item's section, return if non-existent 
  /if (!${Ini[SKHItems.ini,${Line.Arg[3]}].Length}) { 
    /if (${verbosity}>=0) /${channel} ** [${Line.Arg[3]}] not in INI file! 
    /return 
  } 
  |- Find the next available BounceOff key number and store the spell 
  /declare bindex int local 1 
  :CheckNextKey 
  /if (${Ini[SKHItems.ini,${Line.Arg[3]},BounceOff${bindex}].Length}) { 
    |- This one is in use... 
    /varcalc bindex ${bindex}+1 
    /goto :CheckNextKey 
  } else { 
    |- This one not defined (yet).  Good. 
    /ini "SKHItems.ini" "${Line.Arg[3]}" "BounceOff${bindex}" "${Line.Arg[4]}"  
    /if (${verbosity}>=0) /${channel} ** Added "${Line.Arg[4]}" to [${Line.Arg[3]}]'s bounce list 
  } 
/return 

Sub Event_ItemCast(string Line) 
  /varset lastevent Event_ItemCast 
  |- Sanity check parameter 
  /if (!${Line.Arg[3].Length}) { 
    /if (${verbosity}>=0) /${channel} ** Improper use of /icast 
    /if (${verbosity}>=0) /${channel} -- /icast <itemalias> 
    /if (${verbosity}>=0) /${channel} -- For example: 
    /if (${verbosity}>=0) /${channel} -- /icast gobby 
    /return 
  } 
  |- Look for that item's section, return if non-existent 
  /if (!${Ini[SKHItems.ini,${Line.Arg[3]}].Length}) { 
    /if (${verbosity}>=0) /${channel} ** [${Line.Arg[3]}] not in INI file! 
    /return 
  } 
  /declare fullname string local ${Ini[SKHItems.ini,${Line.Arg[3]},FullName]} 
  |- Is it in a Bag? 
  /if (${verbosity}>=1) /${channel} ** Attempting to use: ${fullname} 
  /if (${FindItem[${fullname}].InvSlot.Pack}) { 
    :OpenPack 
    /if (!${Window[${FindItem[${fullname}].InvSlot.Pack.Name}].Open}) { 
      /itemnotify ${FindItem[${fullname}].InvSlot.Pack.Name} rightmouseup 
      /delay 2 
      /goto :OpenPack 
    } 
    /declare camefrom ${FindItem[${fullname}].InvSlot} 
    :GrabItem 
    /if (!${Cursor.ID}) { 
      /itemnotify ${InvSlot[${camefrom}]} leftmouseup 
      /delay 2 
      /goto :GrabItem 
    } 
    /declare clickyID int local ${Cursor.ID} 
    /declare wornat int local ${Cursor.WornSlot[1]} 
    :SwapFirst 
    /if (${Cursor.ID}==${clickyID}) { 
      /itemnotify ${InvSlot[${wornat}]} leftmouseup 
      /delay 2 
      /goto :SwapFirst 
    } 
    |- Click it 
    /delay 2 
    /if (${verbosity}>=1) /${channel} ** Clicking: ${fullname} 
    /declare previousID ${Cursor.ID} 
    /itemnotify ${InvSlot[${wornat}]} rightmouseup 
    :SwapAgain 
    /if (${Cursor.ID}==${previousID}) { 
      /itemnotify ${InvSlot[${wornat}]} leftmouseup 
      /delay 2 
      /goto :SwapAgain 
    } 
    |- Put it back 
    :PutItBack 
    /if (${Cursor.ID}==${clickyID}) { 
      /itemnotify ${InvSlot[${camefrom}]} leftmouseup 
      /delay 2 
      /goto :PutItBack 
    } 
    :SummonedCheck 
    /if (${Cursor.ID}) { 
      |- Something was summoned 
      /autoinv 
      /delay 2 
      /goto :SummonedCheck 
    }    

    :ClosePack 
    /if (${Window[${InvSlot[${camefrom}].Pack.Name}].Open}) { 
      /itemnotify ${InvSlot[${camefrom}].Pack.Name} rightmouseup 
      /delay 2 
      /goto :ClosePack 
    } 
  } else { 
    |- Just click it 
    /if (${FindItem[${fullname}].InvSlot}) { 
      /if (${verbosity}>=1) /${channel} ** Clicking: ${fullname} 
      /itemnotify ${FindItem[${fullname}].InvSlot} rightmouseup 
      /delay 2 
    } else { 
      /if (${verbosity}>=0) /${channel} ** "${fullname}" not found! 
    } 
  } 
  :CastLoop 
  /delay 1 
  /if (${Me.Casting.ID}) /goto :CastLoop 
/return 

Sub Event_LinkParse(string Line) 
  /varset lastevent Event_LinkParse 
  /if (${Line.Arg[3].Length}) { 
    /declare comtext string ${Line.Right[-16]} 

    /declare linksub ${comtext.Token[1,*]}0013895-00001-00001-00001-00001-00001A04D01F5${comtext.Token[2,*]}${comtext.Token[3,*]} 
    /docommand ${linksub} 
  } 
/return 

Sub Event_AddMaster(string Line) 
  /varset lastevent Event_AddMaster 
  /declare index int local 
  /if (${Line.Arg[3].Length}) { 
    /for index 1 to 20 
      /if (${Ini[SKHSettings.ini,Masters,Controller${index}].Equal[Nobody]}) { 
        /ini "SKHSettings.ini" "Masters" "Controller${index}" "${Line.Arg[3]}" 
        /if (${verbosity}>=0) /${channel} ** ${Line.Arg[3]} added as a controller... 
        /goto :FallOut 
      } 
    /next index 
    /if (${verbosity}>=0) /${channel} ** Master controller slots all filled! Get rid of some! 
  } else { 
    /if (${verbosity}>=0) /${channel} ** Huh? 
  } 
  :FallOut 
/return 

Sub Event_RemMaster(string Line) 
  /varset lastevent Event_RemMaster 
  /declare index int local 
  /if (${Line.Arg[3].Length}) { 
    /for index 1 to 20 
      /if (${Ini[SKHSettings.ini,Masters,Controller${index}].Equal[${Line.Arg[3]}]}) { 
        /ini "SKHSettings.ini" "Masters" "Controller${index}" "Nobody" 
        /if (${verbosity}>=0) /${channel} ** ${Line.Arg[3]} removed from controller list... 
        /goto :FallOut 
      } 
    /next index 
    /if (${verbosity}>=0) /${channel} ** Can't find ${Line.Arg[3]} in access list! 
  } else { 
    /if (${verbosity}>=0) /${channel} ** Huh? 
  } 
  :FallOut 
/return 

Sub Event_Chat(ChatType, Sender, ChatText) 
  /varset lastevent Event_Chat 
  |- Authenticate if valid controller 
  /declare authorized bool local FALSE 
  /for i 1 to 20 
    /if (${Ini[SKHSettings.ini,Masters,Controller${i}].Equal[${Sender}]}) /varset authorized TRUE 
  /next i 
  /if (${authorized} && ${ChatText.Left[1].Equal[/]}) { 
    /if (${verbosity}>=1) /${channel} ** User ${Sender} Authenticated! 
    /if (${verbosity}>=0) /${channel} Action --> "${ChatText}" 
    /if (${Me.AFK}) /delay 2s 
    /tell ${Sender} Command received, performing: ${ChatText} 
    /docommand ${ChatText} 
  } 
/return 

Sub Event_HelpInfo 
  /varset lastevent Event_HelpInfo 
  /if (${verbosity}>=0) /${channel} --------=========(SKH Help)=========---------- 
  /if (${verbosity}>=0) /${channel} /SKHhelp - Display this information! 
  /if (${verbosity}>=0) /${channel} /status - Display status of all SKH modes 
  /if (${verbosity}>=0) /${channel} /pause - Suspends the operations of SKH 
  /if (${verbosity}>=0) /${channel} /stopfight <%> - Set % of your health to stop attacking 
  /if (${verbosity}>=0) /${channel} /autostick - Toggle autosticking to NPCs SKHile attacking 
  /if (${verbosity}>=0) /${channel} /stickdist <range_target> <range_tank> - Set stick thresholds  
  /if (${verbosity}>=0) /${channel} /closeness <%> - Set % of max hit range SKHile autosticking 
  /if (${verbosity}>=0) /${channel} /dynclose - Toggle automatic real time closeness adjustments 
  /if (${verbosity}>=0) /${channel} /autoassist <main_assist> <%health> - Activate autoassist 
  /if (${verbosity}>=0) /${channel} /autoassist off - Disable autoassisting 
  /if (${verbosity}>=0) /${channel} /autoassist on - Turn on autoassist w/existing tank info 
  /if (${verbosity}>=0) /${channel} /mainassist <player> - Sets main assist to <player> 
  /if (${verbosity}>=0) /${channel} /secondassist <player> - Sets secondary assist to <player> 
  /if (${verbosity}>=0) /${channel} /thirdassist <player> - Sets third assist to <player> 
  /if (${verbosity}>=0) /${channel} /autosnare - Sets casting of ${Snare} ON|OFF|spell name
  /if (${verbosity}>=0) /${channel} /autoToH - Sets casting ${Attackdebuff} ON|OFF|spell name
  /if (${verbosity}>=0) /${channel} /autoToP - Setss casting ${AcDebuff} ON|OFF|spell name
  /if (${verbosity}>=0) /${channel} /autoToD - Sets casting ${Terrorspell} ON|OFF|spell name
  /if (${verbosity}>=0) /${channel} /autoSpear - Sets casting ${Spearspell} ON|OFF|spell name
  /if (${verbosity}>=0) /${channel} /autoBIte - Sets casting ${Bite} ON|OFF|spell name hp 
  /if (${verbosity}>=0) /${channel} /dynaggro - Toggle dynamic management of assist health % 
  /if (${verbosity}>=0) /${channel} /leash <distance> - Activate leash with <distance> ft. 
  /if (${verbosity}>=0) /${channel} /leash <distance> <master> - Activate leash w/a master 
  /if (${verbosity}>=0) /${channel} /leash off - Disable leashing 
  /if (${verbosity}>=0) /${channel} /leashflex <%length> - Set leash flexibility 
  /if (${verbosity}>=0) /${channel} /drag <body1> <body2> ... <bodyN> - Drag corpses 
  /if (${verbosity}>=0) /${channel} /lootmycorpse - Loot your own corpse completely 
  /if (${verbosity}>=0) /${channel} /iset <itemalias> keepup|nokeepup <"Item Name"> - Item settings 
  /if (${verbosity}>=0) /${channel} /ibounce <itemalias> <"Spell Name"> - Add bounce-off spell 
  /if (${verbosity}>=0) /${channel} /iclick <itemalias> - Click cast item defined in <itemalias> 
  /if (${verbosity}>=0) /${channel} /autoninja <mode> [<range>] - Automatic NPC corpse looting 
  /if (${verbosity}>=0) /${channel} /autofollow [<name>] [<distance>] - Follow <name> at <distance> 
  /if (${verbosity}>=0) /${channel} /weaponswitch <weapon1> <"switch text"> <weapon2> - weapon swap 
  /if (${verbosity}>=0) /${channel} /targetswitch - Toggle autoswitching of targets in autoassist  
  /if (${verbosity}>=0) /${channel} /autodisc1 "Discipline Name"|ON|OFF <end%> <reuse> - Auto disc 1 
  /if (${verbosity}>=0) /${channel} /autodisc2 "Discipline Name"|ON|OFF <end%> <reuse> - Auto disc 2 
  /if (${verbosity}>=0) /${channel} /addmaster <name> - Add a master to remote control users 
  /if (${verbosity}>=0) /${channel} /remmaster <name> - Remove a master from remote control users 
/return 

Sub Event_StatInfo 
  /varset lastevent Event_StatInfo 
  /if (${verbosity}>=0) /${channel} -------=======(Current Status)=======-------- 
  |- Check for the presense of MQ2MoveUtils plugin 
  /if (${Stick.Status.Length}) { 
    /varset useMU TRUE 
    /if (${verbosity}>=0) /${channel} ** MQ2MoveUtils ENABLED (Enhanced Movement ON) 
  } else { 
    /varset useMU FALSE 
    /if (${verbosity}>=0) /${channel} ** MQ2MoveUtils NOT FOUND (Enhanced Movement OFF) 
  } 
  /if (${verbosity}>=0) /${channel} ** Cease Combat: ${StopFightingHealth}% HP 
  /if (${verbosity}>=0) /${channel} ** Auto Stick: ${doStick}, Closeness${If[${doDynclose},[DYN],]}: ${closeness}% MaxRange 
  /if (${verbosity}>=0) /${channel} ** -- Range to Target: ${rngtarget} -- Range to Tank: ${rngtank} 
  /if (${verbosity}>=0) /${channel} ** Auto ${Snare}: ${doDD}, Auto ${Spear}: ${doSpear}
  /if (${verbosity}>=0) /${channel} ** Auto ${Bite}: ${doBite}
  /if (${verbosity}>=0) /${channel} ** Auto ${Acdebuff}: ${doToP}, Auto ${Attackdebuff}: ${doToH}
  /if (${verbosity}>=0) /${channel} ** Auto ${Terror}: ${doToD}, Auto ${Voice}: ${doVoice} on ${Voicereciever}
  /if (${verbosity}>=0) /${channel} ** Auto Taunt: ${doTaunt}
  /if (${verbosity}>=0) /${channel} ** Auto Ninja: ${ninjamode}, Distance: ${ninjadist} ft. 
  /if (${verbosity}>=0) /${channel} ** Auto TargetSwitching: ${doTSwitch}
  /if (${verbosity}>=0) /${channel} ** Auto Assist: ${doAutoassist}, Assist at ${assistpct}% HP 
  /if (${verbosity}>=0) /${channel} ** MA: ${firstassist}, SA: ${secondassist}, TA: ${thirdassist} 
  /if (${verbosity}>=0) /${channel} ** Leashing: ${doLeash} (${leashlength} ft.), Master: ${leashholder}, Flex: ${leashflex} 
  /if (${verbosity}>=0) /${channel} ** Auto Disc #1: ${doDisc1} -> ${disc1} / ${disc1reuse} mins - End: ${disc1end}% 
  /if (${verbosity}>=0) /${channel} ** Auto Disc #2: ${doDisc2} -> ${disc2} / ${disc2reuse} mins - End: ${disc2end}% 
  /if (${verbosity}>=0) /${channel} ** Dynamic Aggro Control: ${doDynaggro} 
  /if (${verbosity}>=0) /${channel} ** WeaponSwitching: ${doSwitch}, ${weapon1}->${weapon2} (${switchtext}) 
  /if (${verbosity}>=0) /${channel} ** Authorized remote controllers: 
  /for i 1 to 20 
    /if (${Ini[SKHSettings.ini,Masters,Controller${i}].NotEqual[Nobody]}) /if (${verbosity}>=0) /${channel} ---- ${Ini[SKHSettings.ini,Masters,Controller${i}]} allowed... 
  /next i 
  /doevents flush 
/return
Last edited by majic on Tue Feb 22, 2005 4:37 pm, edited 2 times in total.

majic
orc pawn
orc pawn
Posts: 20
Joined: Fri Dec 03, 2004 10:08 pm

SKHsettings.ini

Post by majic » Tue Feb 22, 2005 4:11 pm

Code: Select all

|---- SUBROUTINES

Sub Check_Behind
  /declare behindIt FALSE
  |- Are we behind our target?
  /for i -1 to 1
    /varcalc dir (${Target.Heading.Clock}+${i})%12
    /if (${dir}<1) /varcalc dir ${dir}+12
    /if (${dir}>12) /varcalc dir ${dir}-12
    /if (${dir} == ${Me.Heading.Clock}) /varset behindIt TRUE
  /next i   
/return ${behindIt}

Sub Debuff

     |- cast ToHate?
:ToH
     /if (${doToH} && ${needToH} && ${Target.PctHPs}<95) {
       /call cast ${Attackdebuff} gem{ToHgem} 5s
       /if (${verbosity}>=2) /${channel} Stealing attack from: ${Target.CleanName}
       /varset needToH FALSE
       /if (${String[${Macro.Return}].Equal[CAST_RESISTED]}) /varset needToH TRUE
      /goto :ToH
      }


     |- cast ToPain?
:ToP
     /if (${doToP} && ${needToP} && ${Target.PctHPs}<95) {
       /call cast ${Acdebuff} gem${ToPgem} 5s
       /if (${verbosity}>=2) /${channel} Stealing ac from: ${Target.CleanName}
       /varset needToP FALSE
       /if (${String[${Macro.Return}].Equal[CAST_RESISTED]}) /varset needToP TRUE 
    /goto :ToP
       }

     |- cast ToFatigue?
:ToF
     /if (${doToF} && ${needToF} && ${Target.PctHPs}<95) {
       /call cast ${Strdebuff} gem${ToFgem} 5s
       /if (${verbosity}>=2) /${channel} Stealing Str & Sta from: ${Target.CleanName}
       /varset needToF FALSE
       /if (${String[${Macro.Return}].Equal[CAST_RESISTED]}) /varset needToF TRUE 
    /goto :ToF
       }


     |- cast Dooming Darkness?
:DD
     /if (${doDD} && ${needDD} && ${Target.PctHPs}<30) {
        /call cast ${Snare} gem${DDgem} 5s
        /if (${verbosity}>=2) /${channel} casting ${Snare} on: ${Target.CleanName}
        /varset needDD FALSE }
        /if (${String[${Macro.Return}].Equal[CAST_RESISTED]}) /varset needDD TRUE
        /if (${String[${Macro.Return}].Equal[CAST_IMMUNE]}) /varset needDD FALSE 
        /if (${String[${Macro.Return}].Equal[CAST_IMMUNE]} && ${verbosity}>=2) /${channel} ${Target.CleanName}: is Immune to Snare
    /goto :DD
    }



     |- cast Terror spell?
:ToD
     /if (${doToD} && ${Me.TargetOfTarget.Name.Equal[${Me}]} && ${Target.PctHPs}<95) {
       /call cast ${Terror} gem${ToDgem} 5s
       /if (${verbosity}>=2) /${channel} Trying to get agro: ${Target.CleanName} 
    /goto :ToD
       }
   
 |- cast Spear spell?
:Spear
     /if (${doSpear} && ${Me.SpellReady[${Spear}]} && ${Target.PctHPs}<95) {
       /call cast ${Spear} gem${Speargem} 3s
       /if (${verbosity}>=2) /${channel} ${Spear}: ${Target.CleanName} 
    /goto :Spear
       }
/return

 |- cast Lifetap spell?
:Lifetap
     /if (${doLifetap} && ${Me.SpellReady[${Lifetap}]} && ${Me.PctMana}>50 && ${Target.PctHPs}<95 && ${Me.PctHPs}<${Lifetaphp}) {
       /call cast ${Lifetap} gem${Lifetapgem} 3s
       /if (${verbosity}>=2) /${channel} ${Lifetap}: ${Target.CleanName} 
    /goto :Lifetap
       }
/return

Sub Buff

 |- cast Voice spell
:Voice
     /if (${doVoice} && ${Me.SpellReady[${Voice}]}) {
       /Target PC ${Voicereciever}
       /call cast ${Voice} gem${Voicegem} 5s
       /if (${verbosity}>=2) /${channel} Voice on: ${Target.CleanName} 
    /goto :Voice
       }
/return

 |- cast Voice spell
:Proc
     /if (${doProc} && !${Me.Buff[Mental Corruption].ID} && !${Me.Buff[Mental Horror].ID} && !${Me.Buff[Shroud of Death].ID} && !${Me.Buff[Shroud of Undeath].ID} && !${Me.Buff[Mental Corruption].ID} && !${Me.Buff[Vampric Embrace].ID} && !${Me.Buff[Scream of Death].ID} && !${Me.Buff[Shroud of Discord].ID}) {
        /call cast ${Proc} gem${Procgem} 5s
       /if (${verbosity}>=2) /${channel} buffing with ${Proc}: ${Target.CleanName} 
    /goto :Proc
       }
/return




Sub Weapon_Swap(string weapon, string wieldedweapon)
  |- Is it in a Bag?
  /declare camefrom ${FindItem[${weapon}].InvSlot}
  /declare goingto ${FindItem[${wieldedweapon}].InvSlot}
  /if (${verbosity}>=2) /${channel} ** Looking for weapon: ${weapon}
  /if (${FindItem[${weapon}].InvSlot.Pack}) {
    :OpenPack
    /if (!${Window[${FindItem[${weapon}].InvSlot.Pack.Name}].Open}) {
      /itemnotify ${FindItem[${weapon}].InvSlot.Pack.Name} rightmouseup
      /delay 2
      /goto :OpenPack
    }
    :GrabItem
    /if (!${Cursor.ID}) {
      /itemnotify ${InvSlot[${camefrom}]} leftmouseup
      /delay 2
      /goto :GrabItem
    }
    /declare weaponID int local ${Cursor.ID}
    :SwapIt
    /if (${Cursor.ID}==${weaponID}) {
      /itemnotify ${InvSlot[${goingto}]} leftmouseup
      /delay 2
      /goto :SwapIt
    }
    /delay 2
    /if (${verbosity}>=2) /${channel} ** Swapping out: ${weapon}
    /itemnotify ${InvSlot[${camefrom}]} leftmouseup
    /delay 2
    /if (${Cursor.ID}) {
      /if (${verbosity}>=1) /${channel} ** Failed to use existing slot, dropping to inventory!
      /autoinv
    }
    :ClosePack
    /if (${Window[${InvSlot[${camefrom}].Pack.Name}].Open}) {
      /itemnotify ${InvSlot[${camefrom}].Pack.Name} rightmouseup
      /delay 2
      /goto :ClosePack
    }
  } else {
    |- It's in the main inventory
    /if (${FindItem[${weapon}].InvSlot}) {
      /itemnotify ${FindItem[${weapon}].InvSlot} leftmouseup
      /delay 2
      /itemnotify ${InvSlot[${goingto}]} leftmouseup
      /delay 2
      /if (${verbosity}>=2) /${channel} ** Swapping out: ${weapon}
      /itemnotify ${InvSlot[${camefrom}]} leftmouseup
      /delay 2
      /if (${Cursor.ID}) {
        /if (${verbosity}>=1) /${channel} ** Failed to use existing slot, dropping to inventory!
        /autoinv
      }
    } else {
      /if (${verbosity}>=1) /${channel} ** "${weapon}" not found!
    }
  }
/return

Sub NinjaLoot
  |- Ninja the corpse's loot, if applicable
  /if (${ninjamode.NotEqual[OFF]}) {
    /declare LootTotal int local -1
    /declare LootSlot int local
    |- Get NPC corpse on target and continue if possible

    /squelch /target npc corpse radius ${ninjadist}
    /if (${Target.Type.NotEqual[CORPSE]} || !${Target.ID}) {
      /if (${verbosity}>=1) /${channel} ** NPC corpse out of range or already looted!
      /return
    }   
    |- Get 5 seconds (max) closer; warning, no detecting being stuck!
    /face ${If[${Me.Swimming},,nolook]} fast
    /keypress forward hold
    /delay 5s ${Target.Distance}<5
    /keypress forward
    |- Open up the loot window
    /loot
    /delay 1s
    /if (${Me.State.NotEqual[BIND]}) {
      /if (${verbosity}>=1) /${channel} ** Massive lag or error getting to corpse.  Aborting!
      /return
    }
    /if (${verbosity}>=1) /${channel} ** Looting ${Target.CleanName} 
    |- Get item count accurately 
    :LootLag
    /if (${LootTotal}!=${Corpse.Items}) {
      /varset LootTotal ${Corpse.Items}
      /delay 5
      /goto :LootLag
    }
    /if (!${LootTotal}) {
      /if (${verbosity}>=1) /${channel} ** Empty corpse!
      /goto :DoneLooting
    }
    |- Loot Loop
    /for LootSlot 1 to ${LootTotal}
      |- Check for full inventory
      /if (!${Me.FreeInventory}) {
        /beep
        /if (${verbosity}>=1) /${channel} ** INVENTORY FULL !
        /varset ninjamode OFF
        /if (${verbosity}>=1) /${channel} ** AutoNinja is now OFF!
        /goto :DoneLooting
      }
      |- Loot item if we should, skip it if not
      /if (${Corpse.Item[${LootSlot}].ID}) {
        /if (!${Corpse.Item[${LootSlot}].NoDrop}) /goto :LootItem
        /if (${Corpse.Item[${LootSlot}].NoDrop} && ${ninjamode.Equal[ALL]}) {
          /if (${verbosity}>=1) /${channel} ** Looting NODROP Item: ${Corpse.Item[${LootSlot}].Name}
          /goto :LootItem
        }
      }
      /if (${verbosity}>=1) /${channel} ** Skipping Item: ${Corpse.Item[${LootSlot}].Name}
      /goto :SkipIt
      :LootItem
      /itemnotify loot${LootSlot} rightmouseup
      /delay 3
      /if (${Corpse.Item[${LootSlot}].ID}) {
        /delay 2
        /goto :LootItem
      }
      :SkipIt
    /next LootSlot
    /if (${verbosity}>=1) /${channel} ** Done looting ${Target.CleanName}
    :DoneLooting
    /delay 5
    /notify LootWnd DoneButton leftmouseup
    /delay 5
  }

/return
|---- EVENTS

Sub Event_AttackOn
  /varset lastevent Event_AttackOn
  /if (${verbosity}>=1) /${channel} Autoattack activated! Target: ${Target.CleanName}
  /varset acquiretimer 2s
/return

Sub Event_AttackOff
  /varset lastevent Event_AttackOff
  /if (${verbosity}>=1) /${channel} Autoattack turned off! Target: ${Target.CleanName}
/return

Sub Event_Enraged
  /varset lastevent Event_Enraged
  /if (${verbosity}>=1) /${channel} Enrage detected! Target: ${Target.CleanName}
  /varset isEnraged TRUE
/return

Sub Event_NLEnraged
  /varset lastevent Event_NLEnraged
  /if (${verbosity}>=1) /${channel} Enrage done! Target: ${Target.CleanName}
  /varset isEnraged FALSE
  /if (${Target.ID} && ${doAutoassist}) /attack on
/return

Sub Event_Exp(string Line)
  /varset lastevent Event_Exp
  |- Ignore leadership experience event triggers (redundant trigger)
  /if (${Line.Find[leadership]}) /return

  |- Manage aggro control here optionally
  /if (${doDynaggro} && ${doAutoassist}) {
    /if (${gotHit}) {
      |- Got hurt that fight, drop it 1%
      /if (${assistpct}>1) /varcalc assistpct ${assistpct}-1
      /varset gotHit FALSE
      /if (${verbosity}>=1) /${channel} ** Had Aggro! Reducing assist% to ${assistpct}%
    } else {
      |- Did not get hurt that fight, raise it 1%
      /if (${assistpct}<99) /varcalc assistpct ${assistpct}+1
      /if (${verbosity}>=1) /${channel} ** No Aggro! Raising assist% to ${assistpct}%
    }
  }

  |- Experience calculation and reporting
  /if (${verbosity}>=1) /${channel} ** XP-Delta: REG (${Math.Calc[${Me.PctExp}-${Exp2}]}%), AA (${Math.Calc[${Me.PctAAExp}-${AAExp}]}%), LDR (${Math.Calc[${Me.PctGroupLeaderExp}-${LDExp}]}%)
  /varset LDExp ${Me.PctGroupLeaderExp}
  /varset AAExp ${Me.PctAAExp}
  /varset Exp2 ${Me.PctExp}

  |- If target died SKHile enraged, reset it so autoassist isn't broken...
  /varset isEnraged FALSE

  |- Do weapon swapping (back to weapon1), if applicable
  /if (${doSwitch} && ${wstype.Equal[Detrimental]}) {
    /call Weapon_Swap "${weapon1}" "${weapon2}"
  }
/return

Sub Event_Slain
  /varset lastevent Event_Slain
  /call NinjaLoot
  /varset needToP TRUE
  /Varset needToH TRUE
  /Varset needDD TRUE
/return

Sub Event_Zoned
  /varset lastevent Event_Zoned
  /if (${verbosity}>=1) /${channel} ** Zoned... Setting Leash and Autoassist to OFF!
  /varset doLeash FALSE
  /varset doAutoassist FALSE
  /ini "SKHSettings.ini" "General" "AutoAssist" "${doAutoassist}"
  /ini "SKHSettings.ini" "General" "Leashing" "${doLeash}"
/return

Sub Event_TooFarAway
  /varset lastevent Event_TooFarAway
  /if (${doDynclose} && !${acquiretimer}) {
    /if (${verbosity}>=1) /${channel} ** Too far away - Getting 20% closer now!
    /varset closeness ${Math.Calc[${closeness}*0.8].Int}
    /if (${closeness}<20) /varset closeness 20
    /varset acquiretimer 2s
    /varset snuggleup TRUE
  }
/return


Sub Event_SetStopFighting(string Line)
  /varset lastevent Event_SetStopFighting
  /if (${Line.Arg[3].Length}) /varset StopFightingHealth ${Line.Arg[3]}
  /if ((${StopFightingHealth}<0) || (${StopFightingHealth}>100)) {
    /if (${verbosity}>=0) /${channel} SKHacko stopfighting percentage input! Defaulting...
  }
  /if (${verbosity}>=0) /${channel} ** Cease Combat SKHen at: ${StopFightingHealth}% HP
  /ini "SKHSettings.ini" "General" "StopFightingHealth" "${StopFightingHealth}"
/return

Sub Event_TogStick
  /varset lastevent Event_TogStick
  /if (${doStick}) {
    /varset doStick FALSE
    /if (${verbosity}>=0) /${channel} ** Auto-Sticking target is now OFF!
  } else {
    /varset doStick TRUE
    /if (${verbosity}>=0) /${channel} ** Auto-Sticking target is now ON!
  }
  /ini "SKHSettings.ini" "General" "AutoStick" "${doStick}"
/return

Sub Event_TogLeash(string Line)
  /varset lastevent Event_TogLeash
  /if (${Line.Arg[3].Equal[ON]}) {
    /varset doLeash TRUE
    /if (${verbosity}>=0) /${channel} ** Leashing is now ON!
    /ini "SKHSettings.ini" "General" "Leashing" "${doLeash}"
  } else /if (${Line.Arg[3].Equal[OFF]} || (${Int[${Line.Arg[3]}]}<=0)) {
    /varset doLeash FALSE
    /varset leashholder Nobody
    /if (${verbosity}>=0) /${channel} ** Leashing is now OFF!
    /ini "SKHSettings.ini" "General" "Leashing" "${doLeash}"
  } else {
    /if (${Line.Arg[4].Length}) {
      /varset leashholder ${Line.Arg[4]}
      /if (${Spawn[${leashholder}].ID}) {
        /varset doLeash TRUE
        /varset leashlength ${Int[${Line.Arg[3]}]}
        /if (${verbosity}>=0) /${channel} ** Leashing is now ON! Leashlength: ${leashlength} ft.
        /if (${verbosity}>=0) /${channel} ** Leash-holding master is: ${leashholder}
        /ini "SKHSettings.ini" "General" "Leashing" "${doLeash}"
      } else {
        |- This spawn/thing/target doesn't exist
        /if (${verbosity}>=0) /${channel} ** Can't find "${leashholder}" -- SKHo is that?!
        /if (${verbosity}>=0) /${channel} ** Leashing is now OFF!
        /varset doLeash FALSE
        /varset leashholder Nobody
      }
    } else {
      /varset doLeash TRUE
      /varset leashholder Nobody
      /varset leashlength ${Int[${Line.Arg[3]}]}
      /varset stakeX ${Me.X}
      /varset stakeY ${Me.Y}
      /if (${verbosity}>=0) /${channel} ** Leashing is now ON! Leashlength: ${leashlength} ft.
      /if (${verbosity}>=0) /${channel} ** Stake planted at X:${stakeX}, Y:${stakeY}
    }
  }
  /ini "SKHSettings.ini" "General" "LeashHolder" "${leashholder}"
  /ini "SKHSettings.ini" "General" "LeashLength" "${leashlength}"
/return

Sub Event_SetLeashFlex(string Line)
  /varset lastevent Event_SetLeashFlex
  /if (${Line.Arg[3].Length}) /varset leashflex ${Line.Arg[3]}
  /if ((${leashflex}<10) || (${leashflex}>101)) {
    /if (${verbosity}>=0) /${channel} Leash flexibility must be between 10 and 100! Defaulting to 10...
    /varset leashflex 10
  }
  /if (${verbosity}>=0) /${channel} ** Leash Flexibility: ${leashflex}%
  /ini "SKHSettings.ini" "General" "LeashFlex" "${leashflex}"
/return

Sub Event_TogAuto(string Line)
  /varset lastevent Event_TogAuto
  /if (${Line.Arg[3].Equal[OFF]}) {
    /varset doAutoassist FALSE
    /if (${verbosity}>=0) /${channel} ** Autoassist is now OFF!
  } else /if (${Line.Arg[3].Equal[ON]}) {
    /varset doAutoassist TRUE
    /if (${verbosity}>=0) /${channel} ** Autoassist is now ON!
  } else {
    /varset doAutoassist TRUE
    /if (${Line.Arg[3].Length}) /varset firstassist ${Line.Arg[3]}
    /varset mainassist ${firstassist}
    /if (${Line.Arg[4]} > 0) /varset assistpct ${Line.Arg[4]}
    /if (${verbosity}>=0) /${channel} ** Autoassist is now ON!
    /if (${verbosity}>=0) /${channel} ** Assisting: ${mainassist} @${assistpct}% target health
    /if (${verbosity}>=0) /${channel} ** SA is ${secondassist} & TA is ${thirdassist}
  }
  /ini "SKHSettings.ini" "General" "AutoAssist" "${doAutoassist}"
  /ini "SKHSettings.ini" "General" "MainAssist" "${firstassist}"
  /ini "SKHSettings.ini" "General" "AssistPercentage" "${assistpct}"
/return

Sub Event_TogPause
  /varset lastevent Event_TogPause
  /beep
  /if (${isPaused}) {
    /varset isPaused FALSE
    /if (${verbosity}>=0) /${channel} ** Shadow Knight Helper is now RESUMING!
  } else {
    /varset isPaused TRUE
    /if (${verbosity}>=0) /${channel} ** Shadow Knight Helper is now PAUSED!
  }
/return

Sub Event_TogDynaggro
  /varset lastevent Event_TogDynaggro
  /if (${doDynaggro}) {
    /varset doDynaggro FALSE
    /if (${verbosity}>=0) /${channel} ** Dynamic Aggro Control is now OFF!
  } else {
    /varset doDynaggro TRUE
    /if (${verbosity}>=0) /${channel} ** Dynamic Aggro Control is now ON!
  }
  /ini "SKHSettings.ini" "General" "DynamicAggro" "${doDynaggro}"
/return

Sub Event_TogDynclose
  /varset lastevent Event_TogDynclose
  /if (${doDynclose}) {
    /varset doDynclose FALSE
    /if (${verbosity}>=0) /${channel} ** Dynamic Closeness Control is now OFF!
  } else {
    /varset doDynclose TRUE
    /if (${verbosity}>=0) /${channel} ** Dynamic Closeness Control is now ON!
  }
  /ini "SKHSettings.ini" "General" "DynamicCloseness" "${doDynclose}"
/return

Sub Event_TogTaunt
  /varset lastevent Event_TogTaunt
  /if (${doTaunt}) {
    /varset doTaunt FALSE
    /if (${verbosity}>=0) /${channel} ** Auto-Taunting is now OFF!
  } else {
    /varset doTaunt TRUE
    /if (${verbosity}>=0) /${channel} ** Auto-Taunting is now ON!
  }
  /ini "SKHSettings.ini" "General" "AutoTaunt" "${doTaunt}"
/return

Sub Event_TogTank
  /varset lastevent Event_TogTank
  /if (${isTanking}) {
    /varset istanking FALSE
    /if (${verbosity}>=0) /${channel} ** Tanking is now OFF!
  } else {
    /varset isTanking TRUE
    /if (${verbosity}>=0) /${channel} ** Auto-Tanking is now ON!
  }
  /ini "SKHSettings.ini" "General" "Tanking" "${isTanking}"
/return

Sub Event_TogTSwitch
  /varset lastevent Event_TogTSwitch
  /if (${doTSwitch}) {
    /varset doTSwitch FALSE
    /if (${verbosity}>=0) /${channel} ** Auto-Target Switching is now OFF!
  } else {
    /varset doTSwitch TRUE
    /if (${verbosity}>=0) /${channel} ** Auto-Target Switching is now ON!
  }
  /ini "SKHSettings.ini" "General" "TargetSwitching" "${doTSwitch}"
/return

Sub Event_SetCloseness(string Line)
  /varset lastevent Event_SetCloseness
  /if (${Line.Arg[3].Length}) /varset closeness ${Line.Arg[3]}
  /if ((${closeness}<1) || (${closeness}>100)) {
    /if (${verbosity}>=0) /${channel} SKHacko closeness percentage input! Defaulting...
    /varset closeness 70
  }
  /varset closenessdesired ${closeness}
  /if (${verbosity}>=0) /${channel} ** AutoStick: ${doStick}, Closeness: ${closeness}
  /ini "SKHSettings.ini" "General" "Closeness" "${closeness}"
/return

Sub Event_SetFirstassist(string Line)
  /varset lastevent Event_SetFirstassist
  /if (${Line.Arg[3].Length}) /varset firstassist ${Line.Arg[3]}
  /varset mainassist ${firstassist}
  /if (${verbosity}>=0) /${channel} ** Assisting: ${mainassist} @${assistpct}% target health
  /if (${verbosity}>=0) /${channel} ** SA is ${secondassist} & TA is ${thirdassist}
  /ini "SKHSettings.ini" "General" "MainAssist" "${firstassist}"
/return

Sub Event_SetSecondassist(string Line)
  /varset lastevent Event_SetSecondassist
  /if (${Line.Arg[3].Length}) /varset secondassist ${Line.Arg[3]}
  /if (${verbosity}>=0) /${channel} ** Assisting: ${mainassist} @${assistpct}% target health
  /if (${verbosity}>=0) /${channel} ** SA is ${secondassist} & TA is ${thirdassist}
  /ini "SKHSettings.ini" "General" "SecondAssist" "${secondassist}"
/return

Sub Event_SetThirdassist(string Line)
  /varset lastevent Event_SetThirdassist
  /if (${Line.Arg[3].Length}) /varset thirdassist ${Line.Arg[3]}
  /if (${verbosity}>=0) /${channel} ** Assisting: ${mainassist} @${assistpct}% target health
  /if (${verbosity}>=0) /${channel} ** SA is ${secondassist} & TA is ${thirdassist}
  /ini "SKHSettings.ini" "General" "ThirdAssist" "${thirdassist}"
/return

Sub Event_SetAutoNinja(string Line)
  /varset lastevent Event_SetAutoNinja
  |- Set the new ninja distance, if supplied
  /if (${Line.Arg[4].Length}) /varset ninjadist ${Line.Arg[4]}
  |- Set the mode, toggle off if unknown
  /if (${Line.Arg[3].Equal[ALL]}) {
    /varset ninjamode ALL
    /if (${verbosity}>=0) /${channel} ** AutoNinja ON - Will loot ALL items
    /docommand /lootnodrop never
  } else /if ((${Line.Arg[3].Equal[DROP]}) || (${Line.Arg[3].Equal[DROPABLE]})) {
    /varset ninjamode DROPABLE
    /if (${verbosity}>=0) /${channel} ** AutoNinja ON - Will loot only DROPABLE items
    /docommand /lootnodrop never
  } else {
    /varset ninjamode OFF
    /if (${verbosity}>=0) /${channel} ** AutoNinja is now OFF!
  }
  /if (${verbosity}>=0) /${channel} ** AutoNinja distance is ${ninjadist} ft.
  /ini "SKHSettings.ini" "General" "AutoNinjaMode" "${ninjamode}"
  /ini "SKHSettings.ini" "General" "AutoNinjaDistance" "${ninjadist}"
/return

Sub Event_SetWeaponSwitch(string Line)
  /varset lastevent Event_SetWeaponSwitch
  |- Sanity Check
  /if (${Line.Arg[3].Equal[OFF]} || !${Line.Arg[5].Length} || ${Line.Arg[6].Length}) {
    /varset doSwitch FALSE
    /if (${verbosity}>=0) /${channel} ** Auto Weapon Switching is OFF
    /goto :SaveSwitchSettings
  }
  |- Set the weaponswitching information
  /if (${Line.Arg[3].Length}) /varset weapon1 ${Line.Arg[3]}
  /if (${Line.Arg[4].Length}) /varset switchtext ${Line.Arg[4]}
  /if (${Line.Arg[5].Length}) /varset weapon2 ${Line.Arg[5]}
  /varset doSwitch TRUE 
  /if (${verbosity}>=0) /${channel} ** Auto Weapon Switching is ON
  /if (${verbosity}>=0) /${channel} ** ${weapon1} will be swapped out for ${weapon2}
  /if (${verbosity}>=0) /${channel} ** if the text "${switchtext}" is encountered.

  :SaveSwitchSettings
  /doevents flush
  /ini "SKHSettings.ini" "General" "WeaponSwitching" "${doSwitch}"
  /ini "SKHSettings.ini" "Weapons" "Weapon1" "${weapon1}"
  /ini "SKHSettings.ini" "Weapons" "Weapon2" "${weapon2}"
  /ini "SKHSettings.ini" "Weapons" "SwitchText" "${switchtext}"
  /varset wstype ${FindItem[${weapon1}].Spell.SpellType}
/return

Sub Event_SetStickDist(string Line)
  /varset lastevent Event_SetStickDist
  |- Sanity Check
  /if (!${Line.Arg[3].Length} || !${Line.Arg[4].Length}) {
    /if (${verbosity}>=0) /${channel} ** SKHat? Bad Syntax.
    /if (${verbosity}>=0) /${channel} Syntax:
    /if (${verbosity}>=0) /${channel} /stickdist <range_to_target> <range_to_tank>
    /return
  }
  |- Set the weaponswitching information
  /varset rngtarget ${Line.Arg[3]}
  /varset rngtank ${Line.Arg[4]}
  /if (${verbosity}>=0) /${channel} ** Auto Stick: ${doStick}, Closeness: ${closeness}% MaxRange
  /if (${verbosity}>=0) /${channel} ** -- Range to Target: ${rngtarget} -- Range to Tank: ${rngtank}
  /ini "SKHSettings.ini" "General" "StickRangeToTarget" "${rngtarget}"
  /ini "SKHSettings.ini" "General" "StickRangeToTank" "${rngtank}"
/return

Sub Event_SetDD(string Line)
  /varset lastevent Event_SetDD
  /if (${Line.Arg[3].Equal[OFF]}) {
    /varset doDD FALSE
    /if (${verbosity}>=0) /${channel} ** Auto-${Snare} is now OFF!
  } else /if (${Line.Arg[3].Equal[ON]}) {
    /varset doDD TRUE
    /if (${verbosity}>=0) /${channel} ** Auto-${Snare}  is now ON! 
  } else {
    /varset doDD TRUE
    /if (${Line.Arg[3].Length}) /varset Snare ${Line.Arg[3]}
    /if (${verbosity}>=0) /${channel} ** Auto ${Snare}: ${doDD}
  }
  /ini "SKHSettings.ini" "Spells" "AutoSnare" "${doDD}"
  /ini "SKHSettings.ini" "Spells" "Darkness" "${Snare}" 
/return

Sub Event_SetToH(string Line)
  /varset lastevent Event_SetToH
  /if (${Line.Arg[3].Equal[OFF]}) {
    /varset doToH FALSE
    /if (${verbosity}>=0) /${channel} ** Auto-${Attackdebuff} is now OFF!
  } else /if (${Line.Arg[3].Equal[ON]}) {
    /varset doToH TRUE
    /if (${verbosity}>=0) /${channel} ** Auto-${Attackdebuff}  is now ON! 
  } else {
    /varset doToH TRUE
    /if (${Line.Arg[3].Length}) /varset Attackdebuff ${Line.Arg[3]}
    /if (${verbosity}>=0) /${channel} ** Auto ${Attackdebuff}: ${doToH}
  }
  /ini "SKHSettings.ini" "Spells" "AutoToH" "${doToH}"
  /ini "SKHSettings.ini" "Spells" "Attackdebuff" "${Attackdebuff}" 
/return

Sub Event_SetToF(string Line)
  /varset lastevent Event_SetToH
  /if (${Line.Arg[3].Equal[OFF]}) {
    /varset doToF FALSE
    /if (${verbosity}>=0) /${channel} ** Auto-${Strdebuff} is now OFF!
  } else /if (${Line.Arg[3].Equal[ON]}) {
    /varset doToF TRUE
    /if (${verbosity}>=0) /${channel} ** Auto-${Strdebuff}  is now ON! 
  } else {
    /varset doToF TRUE
    /if (${Line.Arg[3].Length}) /varset Strdebuff ${Line.Arg[3]}
    /if (${verbosity}>=0) /${channel} ** Auto ${Strdebuff}: ${doToH}
  }
  /ini "SKHSettings.ini" "Spells" "AutoToP" "${doToP}"
  /ini "SKHSettings.ini" "Spells" "Strdebuff" "${Strdebuff}" 
/return

Sub Event_SetToP(string Line)
  /varset lastevent Event_SetToD
  /if (${Line.Arg[3].Equal[OFF]}) {
    /varset doToP FALSE
    /if (${verbosity}>=0) /${channel} ** Auto-${Acdebuff} is now OFF!
  } else /if (${Line.Arg[3].Equal[ON]}) {
    /varset doToP TRUE
    /if (${verbosity}>=0) /${channel} ** Auto-${Acdebuff}  is now ON! 
  } else {
    /varset doToP TRUE
    /if (${Line.Arg[3].Length}) /varset Acdebuff ${Line.Arg[3]}
    /if (${verbosity}>=0) /${channel} ** Auto ${Acdebuff}: ${doToP}
  }
  /ini "SKHSettings.ini" "Spells" "AutoToP" "${doToP}"
  /ini "SKHSettings.ini" "Spells" "Acdebuff" "${Acdebuff}" 
/return

Sub Event_SetToD(string Line)
  /varset lastevent Event_SetToD
  /if (${Line.Arg[3].Equal[OFF]}) {
    /varset doToD FALSE
    /if (${verbosity}>=0) /${channel} ** Auto-${Terror} is now OFF!
  } else /if (${Line.Arg[3].Equal[ON]}) {
    /varset doToD TRUE
    /if (${verbosity}>=0) /${channel} ** Auto-${Terror}  is now ON! 
  } else {
    /varset doToP TRUE
    /if (${Line.Arg[3].Length}) /varset Terror ${Line.Arg[3]}
    /if (${verbosity}>=0) /${channel} ** Auto ${Terror}: ${doToD}
  }
  /ini "SKHSettings.ini" "Spells" "AutoToD" "${doToD}"
  /ini "SKHSettings.ini" "Spells" "Terror" "${Terror}" 
/return

Sub Event_SetSpear(string Line)
  /varset lastevent Event_SetSpear
  /if (${Line.Arg[3].Equal[OFF]}) {
    /varset doSpear FALSE
    /if (${verbosity}>=0) /${channel} ** Auto-${Spear} is now OFF!
  } else /if (${Line.Arg[3].Equal[ON]}) {
    /varset doSpear TRUE
    /if (${verbosity}>=0) /${channel} ** Auto-${Spear}  is now ON! 
  } else {
    /varset doSpear TRUE
    /if (${Line.Arg[3].Length}) /varset Spear ${Line.Arg[3]}
    /if (${verbosity}>=0) /${channel} ** Auto ${Spear}: ${doSpear}
  }
  /ini "SKHSettings.ini" "Spells" "AutoSpear" "${doSpear}"
  /ini "SKHSettings.ini" "Spells" "Spear" "${Spear}" 
/return

Sub Event_SetVoice(string Line)
  /varset lastevent Event_SetVoice
  /if (${Line.Arg[3].Equal[OFF]}) {
    /varset doVoice FALSE
    /if (${verbosity}>=0) /${channel} ** AutoVoice is now OFF!
  } else /if (${Line.Arg[3].Equal[ON]}) {
    /varset doVoice TRUE
    /if (${verbosity}>=0) /${channel} ** AutoVoice is now ON!
  } else {
    /varset doVoice TRUE
    /if (${Line.Arg[3].Length}) /varset Voicereciever ${Line.Arg[3]}
    /if (${Line.Arg[4].Length}) /varset Voice ${Line.Arg[4]}
    /if (${verbosity}>=0) /${channel} ** ${Voice}: ${doVoice} is on: ${Voicereciever}
  }
  /ini "SKHSettings.ini" "Spells" "AutoVoice" "${doVoice}"
  /ini "SKHSettings.ini" "Spells" "Voicereciever" "${Voicereciever}"
  /ini "SKHSettings.ini" "Spells" "Voice" "${Voice}" 
/return

Sub Event_SetProc(string Line)
  /varset lastevent Event_SetProc
  /if (${Line.Arg[3].Equal[OFF]}) {
    /varset doProc FALSE
    /if (${verbosity}>=0) /${channel} ** Auto-${Proc} is now OFF!
  } else /if (${Line.Arg[3].Equal[ON]}) {
    /varset doProc TRUE
    /if (${verbosity}>=0) /${channel} ** Auto-${Proc} is now ON!
  } else {
    /varset doProc TRUE 
    /if (${Line.Arg[3].Length}) /varset Proc ${Line.Arg[3]}
    /if (${verbosity}>=0) /${channel} ** ${Proc}: ${doProc}
  }
  /ini "SKHSettings.ini" "Spells" "AutoProc" "${doProc}"
  /ini "SKHSettings.ini" "Spells" "Proc" "${Proc}" 
/return

Sub Event_SetLifetap(string Line)
  /varset lastevent Event_SetLifetap
  /if (${Line.Arg[3].Equal[OFF]}) {
    /varset doLifetap FALSE
    /if (${verbosity}>=0) /${channel} ** Auto-$Lifetap} is now OFF!
  } else /if (${Line.Arg[3].Equal[ON]}) {
    /varset doLifetap TRUE
    /if (${verbosity}>=0) /${channel} ** Auto-${Lifetap} is now ON!
  } else {
    /varset doLifetap TRUE 
    /if (${Line.Arg[3].Length}) /varset Lifetap ${Line.Arg[3]}
    /if (${Line.Arg[4].Length}) /varset Lifetaphp ${Line.Arg[4]}
    /if (${verbosity}>=0) /${channel} ** ${Lifetap}: ${doLifetap}
  }
  /ini "SKHSettings.ini" "Spells" "AutoLifetap" "${doLifetap}"
  /ini "SKHSettings.ini" "Spells" "Lifetaphp" "${Lifetaphp}"   
  /ini "SKHSettings.ini" "Spells" "Lifetap" "${Lifetap}" 
/return

Sub Event_SetDisc1(string Line)
  /varset lastevent Event_SetDisc1
  /if (${Line.Arg[3].Equal[OFF]}) {
    /varset doDisc1 FALSE
    /if (${verbosity}>=0) /${channel} ** Autodisc #1 is now OFF!
  } else /if (${Line.Arg[3].Equal[ON]}) {
    /varset doDisc1 TRUE
    /if (${verbosity}>=0) /${channel} ** Autodisc #1 is now ON!
  } else {
    /varset doDisc1 TRUE
    /if (${Line.Arg[3].Length}) /varset disc1 ${Line.Arg[3]}
    /if (${Line.Arg[4]} > 0) /varset disc1end ${Line.Arg[4]}
    /if (${Line.Arg[5]} > 0) /varset disc1reuse ${Line.Arg[5]}
    /if (${verbosity}>=0) /${channel} ** Auto Disc #1: ${doDisc1} -> ${disc1}/${disc1reuse} mins - End: ${disc1end}
  }
  /ini "SKHSettings.ini" "General" "AutoDisc1" "${doDisc1}"
  /ini "SKHSettings.ini" "General" "Disc1" "${disc1}"
  /ini "SKHSettings.ini" "General" "Disc1Endurance" "${disc1end}"
  /ini "SKHSettings.ini" "General" "Disc1Reuse" "${disc1reuse}"
/return

Sub Event_SetDisc2(string Line)
  /varset lastevent Event_SetDisc2
  /if (${Line.Arg[3].Equal[OFF]}) {
    /varset doDisc2 FALSE
    /if (${verbosity}>=0) /${channel} ** Autodisc #2 is now OFF!
  } else /if (${Line.Arg[3].Equal[ON]}) {
    /varset doDisc2 TRUE
    /if (${verbosity}>=0) /${channel} ** Autodisc #2 is now ON!
  } else {
    /varset doDisc2 TRUE
    /if (${Line.Arg[3].Length}) /varset disc2 ${Line.Arg[3]}
    /if (${Line.Arg[4]} > 0) /varset disc2end ${Line.Arg[4]}
    /if (${Line.Arg[5]} > 0) /varset disc2reuse ${Line.Arg[5]}
    /if (${verbosity}>=0) /${channel} ** Auto Disc #2: ${doDisc2} -> ${disc2}/${disc2reuse} mins - End: ${disc2end}
  }
  /ini "SKHSettings.ini" "General" "AutoDisc2" "${doDisc2}"
  /ini "SKHSettings.ini" "General" "Disc2" "${disc2}"
  /ini "SKHSettings.ini" "General" "Disc2Endurance" "${disc2end}"
  /ini "SKHSettings.ini" "General" "Disc2Reuse" "${disc2reuse}"
/return

Sub Event_SetVerbosity(string Line)
  /varset lastevent Event_SetVerbosity
  /if (${Line.Arg[3].Length}) /varset verbosity ${Line.Arg[3]}
  /if ((${verbosity}<0) || (${verbosity}>2)) {
    /if (${verbosity}>=0) /${channel} Verbosity must be between 0 and 2! Defaulting to 2...
    /varset verbosity 2
  }
  /if (${verbosity}>=0) /${channel} ** Verbosity Level: ${verbosity}
  /ini "SKHSettings.ini" "General" "Verbosity" "${verbosity}"
/return

Sub Event_SetChannel(string Line)
  /varset lastevent Event_SetChannel
  /if (${Line.Arg[3].Length}) /varset channel ${Line.Arg[3]}
  /if (${verbosity}>=0) /${channel} ** SKH Output Channel: ${channel}
  /ini "SKHSettings.ini" "General" "Channel" "${channel}"
/return

Sub Event_SwitchWeapon
  /varset lastevent Event_SwitchWeapon
  /if (${doSwitch}) {
    /call Weapon_Swap "${weapon2}" "${weapon1}"
  }
/return

Sub Event_GotHit
  /varset lastevent Event_GotHit
  /if (!${aggrotimer}) /if (${verbosity}>=1) /${channel} ** AGGRO Detected (struck) **
  /varset gotHit TRUE
  /attack on
  /varset aggrotimer 5s
/return

Sub Event_GotMissed
  /varset lastevent Event_GotMissed
  /if (!${aggrotimer}) /if (${verbosity}>=1) /${channel} ** AGGRO Detected (Whiff) **
  /varset gotHit TRUE
  /attack on
  /varset aggrotimer 5s
/return

Sub Event_SpellBounced
  /varset lastevent Event_SpellBounced
  /varset clicktimer 60s
  /beep
  /beep
  /beep
  /if (${verbosity}>=1) /${channel} ** Just detected a BOUNCED spell!
  /if (${verbosity}>=1) /${channel} ** Use /ibounce to update click-item info!
/return

Sub Event_DragBodies(string Line)
  /varset lastevent Event_DragBodies
  /declare ArgNum int local 3
  /declare bodycount int local

  :CountCorpses
  /if (${Line.Arg[${ArgNum}].Length}) {
    |- There's a body name for this argument
    /varcalc ArgNum ${ArgNum}+1
    /goto :CountCorpses
  } 
  /varcalc ArgNum ${ArgNum}-1

  /if (${ArgNum}==2) {
    /if (${verbosity}>=0) /${channel} ** No corpse names supplied!
    /return
  } else {
    /if (${verbosity}>=0) /${channel} ** Target self (F1) to stop dragging!
  }
  :DragLoop
  /for bodycount 3 to ${ArgNum}
    /if (${Target.CleanName.Equal[${Me.Name}]}) {
      /if (${verbosity}>=0) /${channel} ** Body dragging ceased.
      /goto :CeaseDragging
    }
    /target ${Line.Arg[${bodycount}]}'s
    /corpse
    |- Lower this delay at your own risk; too many /corpse commands too fast = cheater!
    /delay 4
  /next bodycount
  /goto :DragLoop
  :CeaseDragging
/return

Sub Event_LootMyCorpse
  /varset lastevent Event_LootMyCorpse
  |- Logic ripped off from Loot.mac and simplified someSKHat
  /declare LootTotal int local 0
  /declare LootSlot int local
  |- Get corpse on target and continue looting if possible
  /squelch /target mycorpse
  /if (${Target.Type.NotEqual[CORPSE]} || !${Target.ID}) {
    /if (${verbosity}>=0) /${channel} ** Can't target my corpse.
    /return
  }   
  /corpse
  /delay 1s
  /loot
  /delay 1s
  /if (${Me.State.NotEqual[BIND]}) {
    /if (${verbosity}>=0) /${channel} ** Massive lag right now... Aborting looting.
    /return
  }
  |- Get item count accurately
  :LootLag
  /if (${LootTotal}!=${Corpse.Items}) {
    /varset LootTotal ${Corpse.Items}
    /delay 5
    /goto :LootLag
  }
  |- Loot Loop
  /for LootSlot 1 to ${LootTotal}
    :LootItem
    /itemnotify loot${LootSlot} rightmouseup
    /delay 3
    /if (${Corpse.Item[${LootSlot}].ID}) {
      /delay 2
      /goto :LootItem
    }
  /next LootSlot
  /delay 5
  /if (${verbosity}>=0) /${channel} ** Done looting my corpse.
  /notify LootWnd DoneButton leftmouseup
/return

Sub Event_AutoFollow(string Line)
  /varset lastevent Event_AutoFollow
  /declare distance int local 30
  /if (${Ini[SKHSettings.ini,General,FollowDistance].NotEqual[NULL]}) /varset distance ${Ini[SKHSettings.ini,General,FollowDistance]}
  /if (${Line.Arg[3].Length}) /target ${Line.Arg[3]}
  /if (${Line.Arg[4].Length}) /varset distance ${Line.Arg[4]}
  /if (${distance}<10) /varset distance 10
  /ini "SKHSettings.ini" "General" "FollowDistance" "${distance}"
  /if (${Target.ID}) {
    /if (${verbosity}>=0) /${channel} ** Autofollow on: ${Target.CleanName} (${distance} ft.)
    /if (${verbosity}>=0) /${channel} ** Change targets to stop autofollowing.
  } else {
    /if (${verbosity}>=0) /${channel} ** Can't activate Autofollow -- no valid target!
    /return
  }
  /declare followID int local ${Target.ID}
  :FollowingLoop
  |- Look for new events
  /doevents
  /if (!${lastevent.Equal[Event_AutoFollow]}) {
    /if (${verbosity}>=0) /${channel} ** Autofollow blocked by: ${lastevent}
    /goto :StopFollowing
  }
  /if (${Target.ID}==${followID}) {
    /if (${Target.ID}) /face fast
    /if (${Target.Distance}>${distance}) {
      /keypress forward hold
      /delay 1s ${Target.Distance}<=${distance}
      /keypress forward
    }
    /goto :FollowingLoop
  }
  :StopFollowing
  /if (${verbosity}>=0) /${channel} ** Autofollow ended.
/return

Sub Event_ItemSet(string Line)
  /varset lastevent Event_ItemSet
  |- Sanity check parameters
  /if (!${Line.Arg[5].Length} || ${Line.Arg[6].Length}) {
    /if (${verbosity}>=0) /${channel} ** Improper use of /iset
    /if (${verbosity}>=0) /${channel} -- /iset <itemalias> keepup|nokeepup <"Item Name">
    /if (${verbosity}>=0) /${channel} -- For example:
    /if (${verbosity}>=0) /${channel} -- /iset gobby keepup "Shrunken Goblin Skull Earring"
    /return
  }
  /ini "SKHItems.ini" "${Line.Arg[3]}" "FullName" "${Line.Arg[5]}" 
  /ini "SKHItems.ini" "${Line.Arg[3]}" "KeepUp" "${If[${Line.Arg[4].Equal[keepup]},TRUE,FALSE]}"
  /if (${verbosity}>=0) /${channel} ** ${Line.Arg[5]} (KeepUp=${If[${Line.Arg[4].Equal[keepup]},TRUE,FALSE]}) updated in INI!
/return

Sub Event_ItemBounce(string Line)
  /varset lastevent Event_ItemBounce
  |- Sanity check parameters
  /if (!${Line.Arg[4].Length}) {
    /if (${verbosity}>=0) /${channel} ** Improper use of /ibounce
    /if (${verbosity}>=0) /${channel} -- /ibounce <itemalias> "Some Spell Name"
    /if (${verbosity}>=0) /${channel} -- For example:
    /if (${verbosity}>=0) /${channel} -- /ibounce gobby "Strength of Tunare"
    /return
  }
  |- Look for that item's section, return if non-existent
  /if (!${Ini[SKHItems.ini,${Line.Arg[3]}].Length}) {
    /if (${verbosity}>=0) /${channel} ** [${Line.Arg[3]}] not in INI file!
    /return
  }
  |- Find the next available BounceOff key number and store the spell
  /declare bindex int local 1
  :CheckNextKey
  /if (${Ini[SKHItems.ini,${Line.Arg[3]},BounceOff${bindex}].Length}) {
    |- This one is in use...
    /varcalc bindex ${bindex}+1
    /goto :CheckNextKey
  } else {
    |- This one not defined (yet).  Good.
    /ini "SKHItems.ini" "${Line.Arg[3]}" "BounceOff${bindex}" "${Line.Arg[4]}" 
    /if (${verbosity}>=0) /${channel} ** Added "${Line.Arg[4]}" to [${Line.Arg[3]}]'s bounce list
  }
/return

Sub Event_ItemCast(string Line)
  /varset lastevent Event_ItemCast
  |- Sanity check parameter
  /if (!${Line.Arg[3].Length}) {
    /if (${verbosity}>=0) /${channel} ** Improper use of /icast
    /if (${verbosity}>=0) /${channel} -- /icast <itemalias>
    /if (${verbosity}>=0) /${channel} -- For example:
    /if (${verbosity}>=0) /${channel} -- /icast gobby
    /return
  }
  |- Look for that item's section, return if non-existent
  /if (!${Ini[SKHItems.ini,${Line.Arg[3]}].Length}) {
    /if (${verbosity}>=0) /${channel} ** [${Line.Arg[3]}] not in INI file!
    /return
  }
  /declare fullname string local ${Ini[SKHItems.ini,${Line.Arg[3]},FullName]}
  |- Is it in a Bag?
  /if (${verbosity}>=1) /${channel} ** Attempting to use: ${fullname}
  /if (${FindItem[${fullname}].InvSlot.Pack}) {
    :OpenPack
    /if (!${Window[${FindItem[${fullname}].InvSlot.Pack.Name}].Open}) {
      /itemnotify ${FindItem[${fullname}].InvSlot.Pack.Name} rightmouseup
      /delay 2
      /goto :OpenPack
    }
    /declare camefrom ${FindItem[${fullname}].InvSlot}
    :GrabItem
    /if (!${Cursor.ID}) {
      /itemnotify ${InvSlot[${camefrom}]} leftmouseup
      /delay 2
      /goto :GrabItem
    }
    /declare clickyID int local ${Cursor.ID}
    /declare wornat int local ${Cursor.WornSlot[1]}
    :SwapFirst
    /if (${Cursor.ID}==${clickyID}) {
      /itemnotify ${InvSlot[${wornat}]} leftmouseup
      /delay 2
      /goto :SwapFirst
    }
    |- Click it
    /delay 2
    /if (${verbosity}>=1) /${channel} ** Clicking: ${fullname}
    /declare previousID ${Cursor.ID}
    /itemnotify ${InvSlot[${wornat}]} rightmouseup
    :SwapAgain
    /if (${Cursor.ID}==${previousID}) {
      /itemnotify ${InvSlot[${wornat}]} leftmouseup
      /delay 2
      /goto :SwapAgain
    }
    |- Put it back
    :PutItBack
    /if (${Cursor.ID}==${clickyID}) {
      /itemnotify ${InvSlot[${camefrom}]} leftmouseup
      /delay 2
      /goto :PutItBack
    }
    :SummonedCheck
    /if (${Cursor.ID}) {
      |- Something was summoned
      /autoinv
      /delay 2
      /goto :SummonedCheck
    }   

    :ClosePack
    /if (${Window[${InvSlot[${camefrom}].Pack.Name}].Open}) {
      /itemnotify ${InvSlot[${camefrom}].Pack.Name} rightmouseup
      /delay 2
      /goto :ClosePack
    }
  } else {
    |- Just click it
    /if (${FindItem[${fullname}].InvSlot}) {
      /if (${verbosity}>=1) /${channel} ** Clicking: ${fullname}
      /itemnotify ${FindItem[${fullname}].InvSlot} rightmouseup
      /delay 2
    } else {
      /if (${verbosity}>=0) /${channel} ** "${fullname}" not found!
    }
  }
  :CastLoop
  /delay 1
  /if (${Me.Casting.ID}) /goto :CastLoop
/return

Sub Event_LinkParse(string Line)
  /varset lastevent Event_LinkParse
  /if (${Line.Arg[3].Length}) {
    /declare comtext string ${Line.Right[-16]}

    /declare linksub ${comtext.Token[1,*]}0013895-00001-00001-00001-00001-00001A04D01F5${comtext.Token[2,*]}${comtext.Token[3,*]}
    /docommand ${linksub}
  }
/return

Sub Event_AddMaster(string Line)
  /varset lastevent Event_AddMaster
  /declare index int local
  /if (${Line.Arg[3].Length}) {
    /for index 1 to 20
      /if (${Ini[SKHSettings.ini,Masters,Controller${index}].Equal[Nobody]}) {
        /ini "SKHSettings.ini" "Masters" "Controller${index}" "${Line.Arg[3]}"
        /if (${verbosity}>=0) /${channel} ** ${Line.Arg[3]} added as a controller...
        /goto :FallOut
      }
    /next index
    /if (${verbosity}>=0) /${channel} ** Master controller slots all filled! Get rid of some!
  } else {
    /if (${verbosity}>=0) /${channel} ** Huh?
  }
  :FallOut
/return

Sub Event_RemMaster(string Line)
  /varset lastevent Event_RemMaster
  /declare index int local
  /if (${Line.Arg[3].Length}) {
    /for index 1 to 20
      /if (${Ini[SKHSettings.ini,Masters,Controller${index}].Equal[${Line.Arg[3]}]}) {
        /ini "SKHSettings.ini" "Masters" "Controller${index}" "Nobody"
        /if (${verbosity}>=0) /${channel} ** ${Line.Arg[3]} removed from controller list...
        /goto :FallOut
      }
    /next index
    /if (${verbosity}>=0) /${channel} ** Can't find ${Line.Arg[3]} in access list!
  } else {
    /if (${verbosity}>=0) /${channel} ** Huh?
  }
  :FallOut
/return

Sub Event_Chat(ChatType, Sender, ChatText)
  /varset lastevent Event_Chat
  |- Authenticate if valid controller
  /declare authorized bool local FALSE
  /for i 1 to 20
    /if (${Ini[SKHSettings.ini,Masters,Controller${i}].Equal[${Sender}]}) /varset authorized TRUE
  /next i
  /if (${authorized} && ${ChatText.Left[1].Equal[/]}) {
    /if (${verbosity}>=1) /${channel} ** User ${Sender} Authenticated!
    /if (${verbosity}>=0) /${channel} Action --> "${ChatText}"
    /if (${Me.AFK}) /delay 2s
    /tell ${Sender} Command received, performing: ${ChatText}
    /docommand ${ChatText}
  }
/return
[General]
Version=2.5
AutoAssist=FALSE
Leashing=FALSE
[Spells]
Speargem=5
DDgem=4
ToDgem=6
ToHgem=1
VoiceGem=7
ProcGem=NULL
StrdebuffGem=NULL
BiteGem=5
AutoToH=FALSE
Attackdebuff=Torrent
[Masters]
Controller1=Nobody
Controller2=Nobody
Controller3=Nobody
Controller4=Nobody
Controller5=Nobody
Controller6=Nobody
Controller7=Nobody
Controller8=Nobody
Controller9=Nobody
Controller10=Nobody
Controller11=Nobody
Controller12=Nobody
Controller13=Nobody
Controller14=Nobody
Controller15=Nobody
Controller16=Nobody
Controller17=Nobody
Controller18=Nobody
Controller19=Nobody
Controller20=Nobody
Last edited by majic on Tue Feb 22, 2005 4:38 pm, edited 2 times in total.

majic
orc pawn
orc pawn
Posts: 20
Joined: Fri Dec 03, 2004 10:08 pm

SKHHelp.txt

Post by majic » Tue Feb 22, 2005 4:13 pm

Code: Select all

Information on new features added by me

/Autotaunt ON or OFF
sets if you want the macro to taunt while in combat on or off

/Autotank On or OFF
sets if you want it to always have behind turned off or not

for all spell settings it is /<Command> <Spell name> to set the spell eg /AutoSnare "Dooming Darkness"

/Autosnare ON, OFF or <Spell Name>
sets if you want it to snare or not and sets what spell to use

/Autospear ON, OFF or <Spell Name>
sets if you want it to cast Spear spell or not and sets what spell to use

/AutoToH  ON, OFF or <Spell Name>
sets if you want it to cast Torrent of Hate line or not and sets what spell to use

/AutoToP  ON, OFF or <Spell Name>
sets if you want it to cast Torrent of Pain line or not and sets what spell to use

/AutoToD  ON, OFF or <Spell Name>
sets if you want it to cast Terror line or not and sets what spell to use

/AutoToF  ON, OFF or <Spell Name>
sets if you want it to cast Torrent of Fatigue line or not and sets what spell to use

/AutoProc  ON, OFF or <Spell Name>
sets if you want it to cast a Proc line or not and sets what spell to use

/AutoVoice  ON, OFF or <Reciever> then <Spell Name>
sets if you want it to cast Voice line or not and sets what spell to use as yet you must
specify who to cast Voice on to set the spell to use eg /AutoVoice ${Me} "Voice of Death"

/AutoLifetap  ON, OFF or <Spell Name> then <%HP>
sets if you want it to cast a Lifetap when you get below Cirtan % of hp or not and sets what spell to use\
eg /AutoLifetap "Spirit Tap" 25 would cast spirit tap when you got below 25%hp 

/AutoBite  ON, OFF or <Spell Name> then <%HP>
sets if you want it to cast a Bite when you get below Cirtan % of hp or not and sets what spell to use

Spell gems must be edited in the ini


if its Working Corretly if you have a shield it will bash and if you dont and have Slam it should use that
Last edited by majic on Tue Feb 22, 2005 4:38 pm, edited 2 times in total.

majic
orc pawn
orc pawn
Posts: 20
Joined: Fri Dec 03, 2004 10:08 pm

Finished

Post by majic » Tue Feb 22, 2005 4:16 pm

OK that is everything it works fine for me. Loads fast and works great. Only thing I would like to add to it would be some pathing and pulling but to this point works pretty good for most of the stuff I do with it.

You still need to grab spellcast.inc also will add if ppl cant use search to find it.

edit: one thing i did notice is it would hang up on snaring and just keep casting over and over but nothing big other then that
Last edited by majic on Tue Feb 22, 2005 4:41 pm, edited 1 time in total.

User avatar
fearless
Not a Psychic
Posts: 2684
Joined: Wed Mar 10, 2004 3:52 pm

Post by fearless » Tue Feb 22, 2005 4:27 pm

use code tags
Reading . . . it's not just for me.

[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]

majic
orc pawn
orc pawn
Posts: 20
Joined: Fri Dec 03, 2004 10:08 pm

Spellcast.inc

Post by majic » Tue Feb 22, 2005 4:39 pm

Code: Select all

|
| SpellCast.inc
|
| Last Modified: 5/14/2004 9:30pm
| This will cast a spell reliably for you...
|
| Usage:
|       /call Cast "spellname|itemname|AA#|AAskillname" [item|activate|gem#] [nocheck|dismount|nodismount]
|
| If no dismount or nodismount is provided it defaults to nodismount.
|
| This would essentially: /cast "Death Peace"
| example: /call Cast "Death Peace"
|
| This would essentially: Check for the spell in your spell slots, if not there mem it to spell
|                         gem slot 7 and then /cast "Death Peace"
| example: /call Cast "Death Peace" gem7
|
| This would essentially: /cast item "White Rope Bridle"
| example: /call Cast "White Rope Bridle" item
|
| This would essentially: /alt activate 169
| example: /call Cast "169" activate
|  or...
| example: /call Cast "Divine Arbitration" activate
|
| This would dismount if your target was lost or dies mid-cast, cast Burn and mem it to spell
| slot 3 if it wasn't already memmed:
| example: /call Cast "Burn" gem3 dismount
|
| This would not dismount but would move you back and forth if your target was lost or dies mid-cast, cast Burn and mem
| it to spell slot 3 if it wasn't already memmed:
| example: /call Cast "Burn" gem3 nodismount
|
| 'nocheck' is the default for the "loss of target/target dying" value.  If nocheck is specified (Or nothing was specified)
| no target checking will be performed and spellcast.inc should act like the spellcast.inc of the past.
|
| It will return the following values:
| CAST_SUCCESS
| CAST_UNKNOWNSPELL
| CAST_OUTOFMANA
| CAST_OUTOFRANGE
| CAST_CANNOTSEE
| CAST_STUNNED
| CAST_RESISTED
| CAST_TOOK2LONG
| CAST_ABILITYNOTREADY
| CAST_IMMUNESLOW
| CAST_LOSTTARGET
|
| New Vars Modification
| Plazmic's no globals needed version
|
| Oct 09, 2003 - Updated to work with new vars and $char(casting) -gf
| Oct 11, 2003 - switched some logic, removed defines -gf
| Oct 15, 2003 - Item support added by -EqMule
| XXX xx, xxxx - Modified to add automeming of spells. -Goofmester1
| Dec 26, 2003 - fd fail 1 added -m0nk
| Jan 01, 2004 - timeout(5s) added to stop "dead-time" -m0nk
| Jan 01, 2004 - switchd fdfail to a standing check. -m0nk
| Jan 01, 2004 - added silence checking as a stun check -m0nk
| Feb 17, 2004 - added AA activate capabilities -ml2517
| Apr 11, 2004 - Updated for new Parm system -ml2517
| Apr 12, 2004 - Will spit out a different message on immune to slows. -ml2517
| Apr 16, 2004 - Removed /sendkeys and replaced with /keypress. -ml2517
| Apr 17, 2004 - Various code enhancements. -Wassup
| Apr 20, 2004 - Updated all of the /if's to have parenthesis. -ml2517
| Apr 25, 2004 - Updated to new variable system. -ml2517
| Apr 29, 2004 - Fixed Item problem -ml2517
| Apr 29, 2004 - Changed the alt ability to use AltAbilityReady instead of an event. -ml2517
| May 02, 2004 - Added the ability to specify a gem slot to mem spells to. -ml2517
| May 10, 2004 - Updated for new event system.
| May 12, 2004 - Added suggestions for loss of target and stun handling change. -ml2517
| May 13, 2004 - Activate now accepts AA skill by name or number. -ml2517
| May 14, 2004 - Added the nocheck value, it is the default. This bypasses the target checking code. -ml2517
|

#event Fizzle "#*#Your spell fizzles#*#"
#event Interrupt "#*#Your casting has been interrupted#*#"
#event Interrupt "#*#Your spell is interrupted.#*#"
#event Recover "#*#You haven't recovered yet...#*#"
#event Recover "#*#Spell recovery time not yet met.#*#"
#event Resisted "#*#Your target resisted the #*#"
#event OutOfMana "#*#Insufficient Mana to cast this spell!#*#"
#event OutOfRange "#*#Your target is out of range, get closer!#*#"
#event NoLOS "#*#You cannot see your target.#*#"
#event Stunned "#*#You cannot cast while stunned#*#"
#event Stunned "#*#You *CANNOT* cast spells, you have been silenced!#*#"
#event Standing "#*#You must be standing to cast a spell#*#"
#event Standing "#*#has fallen to the ground.#*#"
#event Collapse "#*#Your gate is too unstable, and collapses.#*#"
#event ImmuneSlow "#*#Your target is immune to changes in its attack speed.#*#"


Sub Cast(SpellName,ItemFlag,DismountFlag)
   /declare HaveTarget int local 0
   /declare CastBarTime timer local
   /declare CastCurrLocY float local 0
   /declare CastCurrLocX float local 0
   /varset CastCurrLocY ${Me.Y}
   /varset CastCurrLocX ${Me.X}
   /if (${Target.ID}>0) /varset HaveTarget 1
   /if (!${Defined[CastGiveUpTime]}) /declare CastGiveUpTime timer local
   /if (!${Defined[ItemFlag]}) /declare ItemFlag string local
   /if (!${Defined[DismountFlag]}) {
       /declare DismountFlag string local nocheck
       /if (${ItemFlag.Find["dismount"]}) /varset DismountFlag ${ItemFlag}
   }
   /if (!${Me.Standing} && !${Me.Mount.ID}>0) /stand
   /if (${Me.Moving}) {
       /keypress forward
       /keypress back
       /delay 8
   } else {
       /delay 4
   }
   /if (${ItemFlag.Equal["Item"]} || ${ItemFlag.Equal["Activate"]}) /goto :StartCast

   /if (!${Me.Gem["${SpellName}"]}) {
       /if (${ItemFlag.Find[gem]}) {
           /if (${Int[${ItemFlag.Right[1]}]}>0 && ${Int[${ItemFlag.Right[1]}]}<9) {
               /memspell ${ItemFlag.Right[1]} "${SpellName}"
               /delay 5s
           } else {
               /goto :GenericMem
           }
       } else {       
           :GenericMem
           /memspell 5 "${SpellName}"
           /delay 5s
       }

   }
   :StartCast
      /varset CastGiveUpTime 5s
   :CastNow
      /if (${ItemFlag.Equal["Item"]}) {
         /call ClearReturnValue
         /cast item "${SpellName}"
      } else /if (${ItemFlag.Equal["Activate"]}) {
         /call ClearReturnValue
         /if (!${Me.AltAbilityReady[${SpellName}]}) /return CAST_ABILITYNOTREADY
         /alt activate ${AltAbility[${SpellName}].ID}
         /varset CastBarTime ${Me.Casting.CastTime}
      } else {
         /if (!${Me.Gem["${SpellName}"]}) /return CAST_UNKNOWNSPELL
         /call ClearReturnValue
         /if (!${Me.SpellReady["${SpellName}"]}) {
            /if (${CastGiveUpTime}==0) /return CAST_TOOK2LONG
            /delay 1
            /goto :CastNow
         }
         /cast "${SpellName}"
         /varset CastBarTime ${Math.Calc[${Me.Casting.CastTime}*10]}
      }
   :WaitCast
      /if (${Me.Casting.ID}) {
         /if ((!${Target.ID}>0 || ${Target.Type.Equal[CORPSE]}) && !${DismountFlag.Find[nocheck]} && ${HaveTarget}==1) {
             /if (${Me.Mount.ID}>0) {
                 /if (${DismountFlag.Equal[dismount]}) {
                     /dismount
                 } else {
                     /if (!${ItemFlag.Equal["Item"]}) {
                         /if (${CastBarTime}<7) {
                             :Interrupt
                             /keypress FORWARD hold
                             /delay 6
                             /keypress FORWARD
                             /keypress BACK hold
                             /delay 8
                             /keypress BACK
                         } else {
                             :HoldForSpell
                             /delay 1
                             /if (${CastBarTime}<7) /goto :Interrupt
                             /goto :HoldForSpell
                         }
                     } else {
                         /keypress FORWARD hold
                         :Forward
                         /delay 1
                         /if (${Math.Distance[${CastCurrLocY},${CastCurrLocX}]}<6) /goto :Forward
                         /keypress FORWARD
                         /keypress BACK hold
                         :Backward
                         /delay 1
                         /if (${Math.Distance[${CastCurrLocY},${CastCurrLocX}]}>4) /goto :Backward
                         /keypress BACK
                         /if (!${Me.Casting.ID}>0) /goto :DuckTime
                     }
                 }
             }
             :DuckTime
             /keypress FORWARD
             /keypress BACK
             /if (!${Me.Ducking}) /keypress DUCK
             /delay 1
             /if (${Me.Ducking}) /keypress DUCK
             /return CAST_LOSTTARGET
         }
         /delay 1
         /goto :WaitCast
      }
   /delay 4
   /doevents Fizzle
   /doevents Interrupt
   /doevents Interrupt
   /doevents Recover
   /doevents Standing
   /doevents OutOfRange
   /doevents OutOfMana
   /doevents NoLOS
   /doevents Resisted
   /doevents ImmuneSlow
   /doevents Stunned
   /doevents Collapse
   /delay 1
   /if (${Macro.Return.Equal["CAST_RESTART"]}) /goto :StartCast
   /if (!${Macro.Return.Equal["NULL"]}) /return ${Macro.Return}
/return CAST_SUCCESS

Sub ClearReturnValue
/return NULL

Sub Event_Fizzle
/return CAST_RESTART

Sub Event_Interrupt
/return CAST_RESTART

Sub Event_Recover
   /delay 5
/return CAST_RESTART

Sub Event_Standing
   /stand
/return CAST_RESTART

Sub Event_Collapse
/return CAST_RESTART

Sub Event_OutOfMana
/return CAST_OUTOFMANA

Sub Event_OutOfRange
/return CAST_OUTOFRANGE

Sub Event_NoLOS
/return CAST_CANNOTSEE

Sub Event_Stunned
   /delay 2s !${Me.Stunned}
/return CAST_RESTART

Sub Event_Resisted
/return CAST_RESISTED

Sub Event_ImmuneSlow
/return CAST_IMMUNESLOW
Last edited by majic on Wed Feb 23, 2005 12:53 am, edited 1 time in total.

r0tax
orc pawn
orc pawn
Posts: 10
Joined: Thu Feb 17, 2005 12:26 am

Post by r0tax » Tue Feb 22, 2005 11:21 pm

thanks much...will try again w/ this one..

i do have both spell_routines.inc and spellcast.inc but had issues using spellcast.inc . . . but routines.inc worked a bit better . . still got some error about "i" being declared twice (in both the .mac and the .inc????).

could you also post the spellcast.inc you are using if not too much trouble. just to make sure i have everything down right.

lazyshammy
orc pawn
orc pawn
Posts: 20
Joined: Sat Dec 11, 2004 2:49 pm

Post by lazyshammy » Sun Feb 27, 2005 3:14 am

been out of the game for a while so never got around to seeing what was wrong with the macro.

majic
orc pawn
orc pawn
Posts: 20
Joined: Fri Dec 03, 2004 10:08 pm

Post by majic » Sun Feb 27, 2005 4:22 am

hey lazyshammy
Nothing major i did to the orginal just minor tweaking for whenever it gave me an error. Still not 100% with little things like getting to far from the mob and not keeping in melee range. And sometimes trying to cast over and over agian with snare. But those are easy to forget really.

Somethings i would like to be able to add would be some pull stuff (like to a loc) and a loot routine and something that would help acuire targets that where on the cleric after current target is dead kind of thing like a proximty check i guess. I am not a programer by any means these are just pipe dreams that i would like to be able to add if I had the time to sit down and learn the code better. Till then i just try to tweak it best I can to make it work. Need to update some of the spells though might do that tomorrow if i get the time.

banderas
a hill giant
a hill giant
Posts: 225
Joined: Sun Mar 19, 2006 5:12 am

Post by banderas » Mon Jun 19, 2006 2:58 am

THIS MACRO IS AWSOME

i test it and its working great, i used /echo autoassist tankname

and it works fine in assisting the tank. i was wondergin if any one can help me if there is a command for auto attack after assisting the tank? and can i set it to mob % hp?

coz i dont want to attack unless th mob 98% hp or so. i hate to have to do attack manuly.

PLUS is there a way to make me move back to camp when the mob is died in case the mob made us have to go chase it if it ever resist snare?

somthign straneg also i faced it keep happening when it cast snare. it lag for like 1.5 sec then it give TOOT buz voice from the internal speaker. did it happen to any of you guys?