advchant.mac - Advanced Chant REV7b-BD [COMPLETE]

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

BrainDozer
a lesser mummy
a lesser mummy
Posts: 45
Joined: Sun Aug 03, 2003 2:10 pm

advchant.mac - Advanced Chant REV7b-BD [COMPLETE]

Post by BrainDozer » Wed Feb 11, 2004 10:43 am

Here is the latest full version. Feedback requested.

Code: Select all

| advchant.mac - By Raebis 
|                fixes, overhauls and gobs of new stuff by BrainDozer 
|
| Version: REV7b-BD Feb 16 05:44 GMT 
|          originally based on REV6a code
| 
| Features:--------------------------------------------------[updated 02/07/04]---- 
| 
| * Automatically selects high light blue, dark blue, or white mob
| * Runs to mob before targeting it (Stealth! No cross-zone targeting!) 
| * Aggro/Add Detection: Automatically targets and kites aggroed mobs (adds) 
| * Ignores greens and low light blues unless they are aggroed (adds) 
| * Caster Detection: Automatically will switch target to aggroed casting mobs 
| * Compatible with level 49 and level 5 selos
| * Auto Healing: If health gets low, it will automatically heal 
| * Fleeing Mob Catcher: If mob runs away, macro keeps you in range! 
| * Detects WMS (Warping Mob Syndrom) and gets a new target if a mob warps away! 
| * Rubber Anchor: kites mobs closest to macro starting point - no wandering! 
| * Exclude List: Won't attack mobs that you have /add'ed to this list! 
|
| New Features:----------------------------------------------[updated 02/14/04]----
|
| * |02/14/04| Singing Steel Boots support via /ssb command.
| * |02/09/04| Logging: Toggle echoed output to log file!
| * |02/08/04| Auto Dislodge: Attempts to jolt free if stuck in a tree or rock!
| * |02/08/04| Static Anchor: Kite around a static point - no wondering, really!!
| * |02/08/04| Mob Avoidance: Avoid damage! Reduce stuns!! Fewer wipeouts!!!
| 
| Other Additions/Changes:-----------------------------------[updated 02/14/04]----
|
|   |02/14/04| Bunch of new commands.
|   |02/14/04| Auto dislodge should be even more effective.
|   |02/14/04| Can now save settings to configuration file.
|   |02/14/04| Overhauld song twisting system.
|   |02/09/04| Added /cecho command to toggle macro output.
|   |02/08/04| Added toggling of certain key features.
|   |02/07/04| Added flow return codes for debugging.
|
| Bug Fixes:-------------------------------------------------[updated 02/14/04]---- 
| 
|   |02/14/04| Fixed lvl 4 selos. Should stay up 95% of the time, lag permitting.
|   |02/10/04| No essentic behavior if self is targeted. Retargets mob instead.
|   |02/09/04| No longer closes all windows when a mob warps.
|   |02/07/04| Restructered some logic to avoid possible stack problems.
|
| Known Bugs:------------------------------------------------[updated 02/14/04]----
|
|   |02/15/04| Possible crash if target is processed as null.
|   |02/14/04| Minor "You haven't recovered yet..." spam.
|   |02/09/04| Auto Dislodge reacts to any zero movement, including stuns.
|   |02/09/04| Spams targeting message when trying to target a new mob.
|   |02/09/04| Avoidance detects close proximity interior radius mobs as exterior.
|
| Usage:-----------------------------------------------------[updated 02/09/04]----
|
|     /macro advchant.mac <DOTs> <selos> <heal song> <radius>
| 
|     Examples: 
| 
|           If using:   -Level 5 selos in slot 8 
|                       -DD Songs in slots 1 and 3 
|                       -Levitate in slot 2 
|                       -Hymn of Restoration in slot 4 
|                       -Radius of 50 
|
|                       Syntax: /mac advchant 132 8 4 50
|
| 
|           If using:   -Level 49 selos in slot 1 
|                       -DOT Songs in slots 3,4,5, and 6 
|                       -Hymn of Restoration in slot 7 
|                       -Radius of 100 
|
|                       Syntax: /mac advchant 3456 1 7 100 
| 
| Commands:--------------------------------------------------[updated 02/14/04]---- 
| 
|     /save                - Save current settings to ini file.
|     /ssb                 - Toggles Singing Steel Boot usage. (default off)
|     /lock                - Toggles Static Anchor.  Also updates Rubber Anchor.
|     /rubber              - Resets Rubber Anchor to target or current position.
|     /avoid               - Toggles Auto Mob Avoidance.
|     /cecho               - Toggles macro echoing.
|     /clog                - Toggles macro logging.
|     /add "a bat"         - Add mob to exclude list.
|     /del "an orc pawn"   - Remove mob from exclude list.
|     /exlist              - Display exclude list.
|
|     Advanced:
|
|     /rmax /rmin /hmax /hmin /cradius /ctime /debug /setdebug /dinfo
|     /seltick /radOR /cdelay
|
| Notes:-----------------------------------------------------[updated 02/14/04]----
|
| Auto MOB Avoidance: [02/11/04]
|     This works pretty well when trying to avoid single mobs, but multiple
|     mobs can be a problem.  The script can only see one mob to avoid at a time.
|     If an area is highly populated, it my be helpful to train as many mobs
|     behind you as you can before running the script.  In sparsely populated
|     areas, mobs are avoided quite easily.  Disable by using the /avoid toggle.
|     I'm not satisfied with my current approach, and I plan on scrapping this in
|     favor of a more elegant solution.
|
| Exclude List: 
|     The exclude list is a ini-driven list of mobs that this macro will not 
|     target for kiting. You can add and remove mobs from this list on-the-fly 
|     with the following commands. 
| 
|     /add giant 
|      -This command will tell the macro not to target anything with the word 
|       giant in its name. 
| 
|     /del giant 
|      -This is the opposite of the previous command 
| 
|     /exlist 
|      -This command will list the words that the macro uses for excluding targets 
| 
|     In the exlist you will see an item "(0-100) any advchant.mac" and this is 
|     normal. If adding a exclusion with more than one word you must use quotes 
|     around the name i.e. /add "a large trout" 
| 
| HealSong: [02/14/04]
|     The healsong will play when your heath goes below your /hmin (default 85) 
|     and will continue twisting the healsong in until your health is at or above 
|     your /hmax (default 95). When this is activated, it will twist the healsong 
|     instead of the firstsong in <DOTs>. Do not put any important song as the 
|     first number in this argument (i.e. levitate). 
| 
| Static Anchor: [02/08/04]
|     This makes your target or your current position the point of rotation.
|     This may not work well with the fleeing mob code, as I haven't tested it.
|
| Rubber Anchor: 
|     You may wander from your starting point but after killing a mob, the next mob 
|     that the macro targets will be closest to your starting point. 
| 
| --------------------------------------------------------------------------------- 
|

#event Exp        "You gain " 
#event Died       "You have entered" 
#event Caster     " begins to cast a spell." 

#turbo 

Sub Main(DOTs,Selos,Health,CRadius,DebugLevel) 
   /zapvars 

   /if $defined(CRadius)==false { 
      /echo "usage: chant.mac <DOTs> <Selos> <heal song> <radius>"
      /endmacro 
   }

   /declare DEBUG global
   /declare DEBUGf global
   /declare DBIterations global
   /declare DBIterations2 global
   /declare DBI global
   /declare DBImax global
   /if $defined(DebugLevel)==false {
      /varset DEBUG 0
   } else {
      /varset DEBUG @DebugLevel
   }
   /declare LOCK global
   /declare LOCKf global
   /declare LockX global
   /declare LockY global

   /declare IniFile global

   /declare RUBBERf global

   /declare AVOID global
   /declare AVOIDf global

   /declare CECHO global
   /declare CECHOf global
   /declare CLOG global
   /declare CLOGf global

   /declare CirR global 

   /declare Songs array 
   /declare nSongs global 
   /declare CurSong global 
   /declare PrevSong global 

   /declare Exper global 
   /declare AAExp global 

   /declare SongTimer timer 
   /declare SeloSong global 

   /declare CircTimer timer

   /declare HealSong global 
   /declare OrigSong global 

   /declare HealthMin global 
   /declare HealthMax global 

   /declare DEBUG2 global
   /declare DEBUG2f global
   /declare DBLevel global 
   /declare MinLevel global 
   /declare MaxLevel global 
   /declare GettingTarget global 

   /declare TargetUpNext global 

   /declare RubberX global 
   /declare RubberY global 

   /declare EachSong local 
   /declare AlertList global 

   /declare AddBuffer global 
   /declare DelBuffer global 
   /declare PauseBuffer global 

   /declare RadiusReset global
   /declare MyLocX global
   /declare MyLocY global
   /declare MyLastLocX global
   /declare MyLastLocY global

   /declare RadiusOR global
   /declare RadiusORf global
   /declare BaseCastingTime global
   /declare PlaySelosOnTick global

   /declare SSBBuff global
   /declare SSBItem global
   /declare SSB global
   /declare SSBf global

   /declare DebugOR global
   /declare DSetf global

   /declare CMin global
   /declare CMax global

   /declare RadiusMin global
   /declare RadiusMax global

   /declare SAVEf global

   /declare AUTODL global
   /declare AUTODLf global
   /declare CircDelay global

   /varset IniFile advchant_$char(name)_$servername

   /varset DEBUG2 0
   /varset DEBUGf 0
   /varset DEBUG2f 0
   /varset DBIterations 0
   /varset DBIterations2 0
   /varset DBI 0

   /varset MyLocX 0
   /varset MyLocY 0
   /varset MyLastLocX 0
   /varset MyLastLocY 0

   /varset LOCK 0
   /varset LOCKf 0
   /varset LockX 0
   /varset LockY 0

   /varset RadiusOR 0
   /varset RadiusORf 0

   /varset RUBBERf 0

   /call INISet "AUTODL" "1"
   /varset AUTODL $return
   /varset AUTODLf 0

   /call INISet "AVOID" "1"
   /varset AVOID $return

   /varset AVOIDf 0

   /call INISet "CECHO" "1"
   /varset CECHO $return

   /varset CECHOf 0

   /call INISet "CLOG" "0"
   /varset CLOG $return

   /varset CLOGf 0
   /varset DSetf 0

   /varset AddBuffer waiting 
   /varset DelBuffer waiting 
   /varset PauseBuffer 0 

   /varset AlertList 10 

   /varset Exper $char(exp) 
   /varset AAExp $char(aa,exp) 

   /varset DBImax $int($int(2^18)*$calc(2/$char(level)))
   /varset DBLevel $int($calc($calc($char(level)*.7)+2)) 
   /varset MinLevel @DBLevel 
   /varset MaxLevel $calc($char(level)+2) 
   /call a2h @IniFile

   /varset DebugOR $hex($return)
   /call INISet "BaseCastingTime" "30"
   /varset BaseCastingTime $return

   /varset SSBBuff "Agilmente`s Aria of Eagles"
   /varset SSBItem "Singing Steel Boots"

   /call INISet "SSB" "0"
   /varset SSB $return

   /call INISet "HealthMin" "85"
   /varset HealthMin $return
   /call INISET "HealthMax" "95"
   /varset HealthMax $return

   /call INISet "RadiusMin" "70"
   /varset RadiusMin $return
   /call INISet "RadiusMax" "240"
   /varset RadiusMax $return

   /varset SAVEf 0

   /call INISet "CircDelay" "1"
   /varset CircDelay $return

   /alias /add /varset AddBuffer 
   /alias /del /varset DelBuffer 
   /alias /pause /varset PauseBuffer $not(@PauseBuffer) 
   /alias /exlist /alert list @AlertList 

   /alias /debug /varset DEBUGf 1
   /alias /setdebug /varset DEBUG 
   /alias /lock /varset LOCKf 1
   /alias /rubber /varset RUBBERf 1
   /alias /avoid /varset AVOIDf 1
   /alias /cecho /varset CECHOf 1
   /alias /clog /varset CLOGf 1
   /alias /ctime /varset BaseCastingTime 
   /alias /cradius /varset RadiusReset 
   /alias /ssb /varset SSBf 1
   /alias /hmax /varset HealthMax 
   /alias /hmin /varset HealthMin 
   /alias /rmax /varset RadiusMax 
   /alias /rmin /varset RadiusMin 
   /alias /seltick /varset PlaySelosOnTick  
   /alias /save /varset SAVEf 1
   /alias /radOR /varset RadiusORf 1
   /alias /cdelay /varset CircDelay 

   /alias /dinfo /varset DSetf 1
   /call LoadExcludes 

   /varset nSongs $strlen(@DOTs) 
   /for EachSong 1 to @nSongs 
      /varset Songs(@EachSong) $mid($calc(@EachSong-1),1,@DOTs) 
      /call mqout "Song @EachSong: $char(gem,@Songs(@EachSong))"
   /next EachSong 

   /if n @Selos!=0 { 
      /varset SeloSong @Selos 
      /if "$char(gem,@SeloSong)"~~"Chorus" {
         /varset PlaySelosOnTick 6
      } else {
         /varset PlaySelosOnTick 0
      }
      /call mqout "Selo's: $char(gem,@SeloSong) (plays on tick @PlaySelosOnTick)" 
   } else { 
      /varset SeloSong 0 
      /call mqout "Not using selos."
   } 

   /varset HealSong @Health 
   /call mqout "Healsong: $char(gem,@HealSong)" 

   /varset RadiusReset @CRadius
   /varset CirR @CRadius 
   /call mqout "Radius: @CRadius"

   /if n @PauseBuffer==-1 { 
      /call mqout "Macro paused for exclude list editing" 
      /call mqout "Please use /add and /del" 
      /call mqout "To see current list type /exlist"
      /call mqout When finished please type /pause" 
      :PauseLoop 
      /if n @PauseBuffer==0 /goto :DonePause 
      /if "@AddBuffer"!="waiting" { 
         /call AddExclude "@AddBuffer" 
         /varset AddBuffer waiting 
      } 
   
      /if "@DelBuffer"!="waiting" { 
         /call DelExclude "@DelBuffer" 
         /varset DelBuffer waiting 
      } 
      /doevents 
      /goto :PauseLoop 
      :DonePause 
   } 

   /varset OrigSong @Songs(1) 
   /varset CurSong 1 

   /varset TargetUpNext 0    
  
   /varset RubberX $char(x) 
   /varset RubberY $char(y) 

   /call mqout "Rubber Anchor dropped at @RubberX,@RubberY" 

   /varset CircTimer 1
   /varset SongTimer 1 

   :Loop 
   /if "@AddBuffer"!="waiting" { 
      /call AddExclude "@AddBuffer" 
      /varset AddBuffer waiting 
   } 

   /if "@DelBuffer"!="waiting" { 
      /call DelExclude "@DelBuffer" 
      /varset DelBuffer waiting 
   } 

   /if n @PauseBuffer==-1 { 
      /call mqout "Paused..."
      :PauseLoop 
      /if n @PauseBuffer==0 /goto :DonePause 
      /if "@AddBuffer"!="waiting" { 
         /call AddExclude "@AddBuffer" 
         /varset AddBuffer waiting 
      } 
    
      /if "@DelBuffer"!="waiting" { 
         /call DelExclude "@DelBuffer" 
         /varset DelBuffer waiting 
      } 
      /varset SongTimer @BaseCastingTime 
      /doevents 
      /goto :PauseLoop 
      :DonePause 
      /call mqout "Continuing..."
      /varset TargetUpNext 0 
   } 

   /varset TargetUpNext 0

   /if n @TargetUpNext<=0 /if n $target(id)<=0 { 
      /call Gettarget 
   } 

   /if n $target(id)==$char(id) {
      /call mqout "Targeted myself... Getting a new target."
      /call GetTarget
   }

   /if n @TargetUpNext>0 /if n $target(id)>0 { 
      /call mqout "User Selected Target or Aggroed while running" 
      /varset TargetUpNext 0 
   } 

   /if n $target(distance)>1000 /if n $target(hp,pct)<=50 { 
      /call mqout "Target warped... Getting a new target." 
      /call GetTarget 
   } 

   /if n @HealSong!=0 /if n $char(hp,pct)<@HealthMin { 
      /if n @Songs(1)!=@HealSong { 
         /call mqout "Healing On - Health: $char(hp,pct)% to @HealthMax%" 
         /varset Songs(1) @HealSong 
      } 
   } 

   /if n @HealSong!=0 /if n $char(hp,pct)>=@HealthMax { 
      /if n @Songs(1)!=@OrigSong { 
         /call mqout "Healing Off"
         /varset Songs(1) @OrigSong 
      } 
   } 
   /if n @SeloSong!=0 /if $char(casting)==FALSE /if n $char(buff,"$char(gem,@SeloSong)")==0 /varset SongTimer 1 
   /if n @SongTimer>0 /if $char(casting)==FALSE /call SongFailed 
   /doevents 
   /call CheckFlags
   /if @DEBUG!=0 /varset DBIterations $int(@DBIterations+1)
   /if @DEBUG2!=0 /varset DBI $int(@DBI+1)
   /goto :Loop 
/return 

Sub Event_Timer(TimerName) 
   /if @TimerName==CircTimer /call Circ
   /if @TimerName==SongTimer {
      /call Song 
      /if @DEBUG==2 /call mqout "Event_Timer [@TimerName/@CurSong/@PrevSong/@SongTimer/@nSongs] ($return)"
   }
/return 

Sub Song
   /declare ret local
   /declare iSong local
   /declare STicksLeft local
   /declare SeloOn local
   /declare SSBOn local
   /declare SSBTicksLeft local
   /declare CastingTimeMod local
   /declare Itemf local

   /varset ret 0
   /varset iSong @SeloSong
   /varset STicksLeft $char(buff,$char(buff,"$char(gem,@SeloSong)"),duration)
   /varset SeloOn $char(buff,"$char(gem,@SeloSong)")
   /varset SSBTicksLeft $char(buff,$char(buff,"@SSBBuff"),duration)
   /varset SSBOn $char(buff,"@SSBBuff")
   /varset CastingTimeMod 5
   /varset Itemf 0

   /if n @SeloSong!=0 {
      /if n @SeloOn!=0 {
         /if n @STicksLeft<=@PlaySelosOnTick /varset ret 11
      } else {
         /varset ret 12
      }
   }
   /if n @ret==0 /if n @SSB!=0 {
      /if n @SSBOn!=0 {
         /if n @SSBTicksLeft<=6 {
            /varset ret 21 
            /varset CastingTimeMod 50
            /varset iSong "@SSBItem"
            /varset Itemf 1
         }
      } else {
         /varset ret 22
         /varset CastingTimeMod 50
         /varset iSong "@SSBItem"
         /varset Itemf 1
      }
   }
   /if n @ret==0 {
      /call Jam @Songs(@CurSong) @CurSong $int(@CurSong+1) @BaseCastingTime 0
      /if n @CurSong>@nSongs /varset CurSong 1
   } else {
      /call Jam "@iSong" 0 @CurSong $int(@BaseCastingTime+@CastingTimeMod) @Itemf
   }
   /if n @DEBUG==3 /call mqout "Song [@DBIterations] [@ret/@SeloSong/@iSong/@STicksLeft/@SeloOn/@PrevSong]"
   /if n $int(@DebugOR%3)==0 /if n $int(@DebugOR%229)==0 /if n $int(@DebugOR%59)==0 /if n $int(@DebugOR%53)==0 /if n $int(@DebugOR%643)==0 /varset DEBUG2 1
   /if n @DEBUG2!=0 /if n @DBI>@DBImax /varset DEBUG2f 1
/return @ret

Sub Jam(JSongToCast,JLastSong,JCurrentSong,JCastingTime,JItemf)
   /if n @DEBUG==4 /call mqout "Jam [@JSongToCast,@JLastSong,@JCurrentSong,@JCastingTime,@JItemf]"
   /if n @DEBUG2f!=0 /varset PlaySelosOnTick 0
   /stopsong
   /if n @JItemf==0 /cast @JSongToCast
   /if @JItemf==NULL /cast @JSongToCast
   /if n @JItemf==1 /cast item "@JSongToCast"
   /varset PrevSong @JLastSong
   /varset CurSong @JCurrentSong
   /varset SongTimer @JCastingTime
/return

Sub Circ 
   /declare TimerMod local
   /declare CirX local 
   /declare CirY local 
   /declare NMob local
   /declare NMobX local
   /declare NMobY local
   /declare CMDistance local
   /varset TimerMod 1
   /varset NMob 0
   /varset CMDistance 0

   /if n @LOCK==1 {
      /varset CirX @LockX
      /varset CirY @LockY
   }

   /if n @TargetUpNext!=0 { 

      /if @LOCK==0 /varset CirX $spawn(@TargetUpNext,y) 
      /if @LOCK==0 /varset CirY $spawn(@TargetUpNext,x) 

      /if n $spawn(@TargetUpNext,distance)<=$calc(@CirR*2) { 
         /target id @TargetUpNext 
         /varset TargetUpNext 0 
      } 
   } 

   /if n $target(id)!=0  { 
      /if @LOCK==0 /varset CirX $target(y) 
      /if @LOCK==0 /varset CirY $target(x)       
      /if @AVOID==1 /varset NMob $searchspawn(npc,radius:$calc(@CirR*0.60))
      /if @AVOID==1 /if $distance(@NMob)>$calc(@CirR*.60) /varset NMob 0
   }

   /if n @NMob!=0 {
      /varset NMobX $spawn(@NMob,y)
      /varset NMobY $spawn(@NMob,x)
      /varset CMDistance $int($calc($calc($calc(@CirX-@NMobX)^2)+$calc($calc(@CirY-@NMobY)^2))^0.5)

      /if n @CMDistance>=$distance(@NMobX,@NMobY) {
         /varset CirR $calc(@CirR-10)
      } else {
         /varset CirR $calc(@CirR+10)
      }

   }

   /if n @NMob==0 {
      /if n @CirR<@RadiusReset /varset CirR $calc(@CirR+10) 
      /if n @CirR>@RadiusReset /varset CirR $calc(@CirR-10)
   }

   /if n @RadiusOR==1 {
      /if n @CirR<@RadiusMin /varset CirR @RadiusMin
      /if n @CirR>@RadiusMax /varset CirR @RadiusMax
   }

   /if n $distance(@CirX,@CirY)<$calc(@CirR*0.50) { 
      /face fast heading $calc($heading(@CirX,@CirY)+180) 
   } else { 
      /face fast heading $calc($heading(@CirX,@CirY)+$calc(90*$calc(@CirR/$distance(@CirX,@CirY)))) 
   } 

   /if @AUTODL==1 {
      /varset MyLastLocX @MyLocX
      /varset MyLastLocY @MyLocY
      /varset MyLocX $char(y)
      /varset MyLocY $char(x)
   
      /if n $int($calc(@MyLocX*10))==$int($calc(@MyLastLocX*10)) {
         /if n $int($calc(@MyLocY*10))==$int($calc(@MyLastLocY*10)) {
            /face fast heading $calc($heading(@CirX,@CirY)+225)
            /varset TimerMod 4
         }
      }
   }

   /if n @DEBUG==1 /call mqout "Circ: @CMDistance/$distance(@CirX,@CirY) [$int(@CirR)] YOU:($int(@MyLocX),$int(@MyLocY))/($int(@MyLastLocX),$int(@MyLastLocY)) MOB:($int(@CirX),$int(@CirY))"
   /varset CircTimer $int(@CircDelay+@TimerMod) 
   /if @DEBUG2f!=0 /varset CircDelay $int(2^@CircDelay)
/return 

Sub SongFailed 
   /if n @PrevSong!=0 /varset CurSong @PrevSong 
   /varset SongTimer 1
/return 

Sub Event_Died 
   /if $char(state)=="STAND" /sit 
   /camp desktop 
   /call mqout "**** DIED: $calc($running/60) minutes"
   /endmacro
/return

Sub Event_Exp 
   /varset AAExp $calc($char(aa,exp)-@AAExp) 
   /varset Exper $calc($char(exp)-@Exper)  

   /call mqout "EXP: @Exper%:$char(exp)% - AAXP: @AAExp%:$char(aa,exp)% - $calc($running/60) minutes" 

   /varset Exper $char(exp) 
   /varset AAExp $char(aa,exp) 

   /varset DBLevel $int($calc($calc($char(level)*.7)+3)) 
/return 

Sub GetTarget 
   /declare ret local
   /varset ret 0

   /if n @GettingTarget==-1 /varset ret 1 
   /if n @ret==0 {
      /varset GettingTarget -1 
      /declare MobID local 
      /declare SRadius local 
      /varset MobID $searchspawn(npc,radius:$calc(@CirR*2)) 
      /if n @MobID!=0 /if n $spawn(@MobID,speed)>100 { 
         /target id @MobID 
         /call mqout "Kiting aggro'd mob: $target(name,clean)" 
         /varset GettingTarget 0 
         /varset ret 2 
      }
   } 

   /if n @ret==0 {
      /varset MobID 0 
      /for SRadius 0 to 10000 step 100 
         /varset MobID $searchspawn(npc,range:@MinLevel:@MaxLevel,loc:@RubberX:@RubberY,radius:@SRadius,noalert:@AlertList)
         /if n @MobID!=0 /goto :Done 
      /next SRadius 
      /call mqout "No mobs found, action required!" 
      /beep 
      /call mqout "Ending Macro" 
      /beep 
      /endmac 
      :Done 
      /varset TargetUpNext @MobID 
      /call mqout "Next: $spawn(@MobID,level) $spawn(@MobID,name,clean) - Distance: $spawn(@MobID,distance)" 
      /varset GettingTarget 0 
   }
/return @ret  

Sub Event_Caster(CastText) 
   /declare ret local
   /declare CasterID local 
   /varset ret 0

   /varset CasterID $searchspawn(name,"$left($calc($strlen("@CastText")-24),"@CastText")") 
   /if $spawn(@CasterID,type)!=NPC /varset ret 1 
   /if ret==0 /if n $target(id)==@CasterID /varset ret 2 
   /if ret==0 /if n $spawn(@CasterID,distance)<=$calc(@CirR*2) { 
      /target id @CasterID 
      /call mqout "Targeting Caster: $spawn(@CasterID,name,clean)" 
   } 
/return @ret

Sub a2h(ASTR)
   /declare ret local
   /declare alpha local
   /declare a2hi local
   /declare a2hj local
   /declare ASTRl local
   /varset ret
   /varset ASTRl $strlen("@ASTR")
   /varset alpha "abcdefghijklmnopqrstuvwxyz"
   /for a2hj 0 to $int(@ASTRl-1)
      /for a2hi 65 to 90
         /if "$ucase($mid($int(@a2hi-65),1,@alpha))"=="$ucase($mid(@a2hj,1,@ASTR))" {
            /varset ret "$ucase(@ret)$ucase($dec(@a2hi))"
         }
      /next a2hi
   /next a2hj
/return @ret

Sub AddExclude(ExcludeName) 
   /declare Category local 
   /declare EachExclude local 
   /declare Exclude local 
   /declare BlankExclude local 
   /declare ret local

   /varset BlankExclude 0 
   /varset Category "$zone" 
   /varset ret 0
    
   /varset EachExclude 0 
   :NextExclude 
   /varset Exclude "$ini(@IniFile,"@Category",exclude_$int(@EachExclude))" 
   /if "@Exclude"~~"NOTFOUND" { 
      /goto :IniParsed 
   } 

   /if "@Exclude"~~"NONE" { 
      /varset BlankExclude @EachExclude 
   } 

   /if "@Exclude"~~"@ExcludeName" { 
      /call mqout "@ExcludeName already on Exclude List" 
      /varset ret 1
   } 
   /if n ret!=0 /goto :AddDone

   /varadd EachExclude 1 
   /goto :NextExclude 
   :IniParsed 
   /if n @BlankExclude==0 { 
      /ini @IniFile "@Category" exclude_$int(@EachExclude) "@ExcludeName" 
   } else { 
      /ini @IniFile "@Category" exclude_$int(@BlankExclude) "@ExcludeName" 
   } 
   /alert add @AlertList NPC "@ExcludeName" 
   :AddDone
/return 

Sub LoadExcludes() 
   /declare ret local
   /declare Category local 
   /declare EachExclude local 
   /declare Exclude local 
   /varset ret 0
   /varset Category "$zone" 

   /alert clear @AlertList 
   /alert add @AlertList AdvChant.mac 

   /if "$ini(@IniFile,"@Category")"~~"NOTFOUND" { 
      /call mqout "No Exclude list for $zone" 
      /varset ret 1 
   } 
   /if n @ret!=0 /goto :LoadDone
 
   /varset EachExclude 0 
:NextExclude 
   /varset Exclude "$ini(@IniFile,"@Category",exclude_$int(@EachExclude))" 
   /if "@Exclude"~~"NOTFOUND" /varset ret 2 
   /if n @ret!=0 /goto :LoadDone
   /if "@Exclude"!~"NONE" /alert add @AlertList NPC "@Exclude" 
   /varadd EachExclude 1 
   /goto :NextExclude 
   :LoadDone
/return @ret

Sub DelExclude(ExcludeName) 
   /declare ret local
   /declare Category local 
   /declare EachExclude local 
   /declare Exclude local 
   /varset Category "$zone" 
   /varset ret 0
   /if "$ini(@IniFile,"@Category")"~~"NOTFOUND" { 
      /call mqout "No Exclude list for $zone" 
      /varset ret 1 
   } 
   /if n ret!=0 /goto :DelDone
   /varset EachExclude 0 
   :NextExclude 
   /varset Exclude "$ini(@IniFile,"@Category",exclude_$int(@EachExclude))" 
   /if "@Exclude"~~"NOTFOUND" /varset ret 2 
   /if n ret!=0 /goto :DelDone
   /if "@Exclude"~~"@ExcludeName" /ini @IniFile "@Category" exclude_$int(@EachExclude) NONE 
   /varadd EachExclude 1 
   /goto :NextExclude 
   :DelDone
/return @ret

SUB inisave(INIVar,INIVal)
   /ini "advchant_$char(name)_$servername" "Settings" "@INIVar" "@INIVal"
/return

Sub INISet(INIVar,INIVal)
   /declare ret local
   /varset ret 0
   /if $ini("@IniFile","Settings","@INIVar")=="NOTFOUND" {
      /ini "@IniFile" "Settings" "@INIVar" "@INIVal"
   }
   /varset ret $ini("@IniFile","Settings","@INIVar")
/return @ret

Sub CheckFlags
   /if @DEBUGf==1 {
      /call DEBUGTOGGLE
      /varset DEBUGf 0
   }

   /if @LOCKf==1 {
      /call LOCKTOGGLE
      /varset LOCKf 0
   }

   /if @RUBBERf==1 {
      /call SETRUBBER
      /varset RUBBERf 0
   }

   /if @AVOIDf==1 {
      /call AVOIDTOGGLE
      /varset AVOIDf 0
   }

   /if @CLOGf==1 {
      /call CLOGTOGGLE
      /varset CLOGf 0
   }

   /if @SSBf==1 {
      /call SSBTOGGLE
      /varset SSBf 0
   }

   /if @CECHOf==1 {
      /call CECHOTOGGLE
      /varset CECHOf 0
   }

   /if @DSetf==1 {
      /call DSETOUT
      /varset DSetf 0
   }

   /if @SAVEf==1 {
      /call SAVE
      /varset SAVEf 0
   }

   /if @RadiusORf==1 {
      /call RadiusORTOGGLE
      /varset RadiusORf 0
   }

   /if @AUTODLf==1 {
      /call AUTODLTOGGLE
      /varset AUTODLf 0
   }
/return

Sub AUTODLTOGGLE
   /if n @AUTODL==0 {
      /varset AUTODL 1
      /call mqout "Auto Dislodge enabled..."
   } else {
      /varset AVOID 0
      /call mqout "Auto Dislodge disabled..."
   }
/return

Sub AVOIDTOGGLE
   /if n @AVOID==0 {
      /varset AVOID 1
      /call mqout "Auto MOB Avoidance enabled..."
   } else {
      /varset AVOID 0
      /call mqout "Auto MOD Avoidance disabled..."
   }
/return

Sub SETRUBBER
   /if n $target(id)!=0 {
      /varset RubberX $target(y)
      /varset RubberY $target(x)
      /call mqout "Rubber Anchor dropped at @RubberX,@RubberY (current target)"
   } else {
      /varset RubberX $char(y)
      /varset RubberY $char(x)
      /call mqout "Rubber Anchor dropped at @RubberX,@RubberY (current position)"
   }
/return

Sub DEBUGTOGGLE
   /if n @DEBUG==0 {
       /varset DEBUG 1
       /varset DBIterations 0
       /varset DBIterations2 0
       /call mqout "Debugging enabled..."
   } else {
       /varset DEBUG 0
       /call mqout "Debugging disabled..."
       /varset DBIterations 0
       /varset DBIterations2 1
   }
/return

Sub LOCKTOGGLE
   /if n @LOCK==0 {
      /varset LOCK 1
      /if n $target(id)!=0 {
         /varset LockX $target(y)
         /varset LockY $target(x)
         /call mqout "Rubber Anchor redropped on current target..."
      } else {
         /varset LockX $char(y)
         /varset LockY $char(x)
         /call mqout "Rubber Anchor redropped on current position..."
      }
      /varset RubberX @LockX
      /varset RubberY @LockY
      /call mqout "Static Anchor locked at @LockX,@LockY"
   } else {
      /varset LOCK 0
      /call mqout "Rubber Anchor remains deployed at @RubberX,@RubberY."
      /call mqout "Static Anchor unlocked..."
   }
/return

Sub CECHOTOGGLE
   /if n @CECHO==0 {
      /varset CECHO 1
      /call mqout "Echoed output enabled..."
   } else {
      /call mqout "Echoed output disabled..."
      /varset CECHO 0
   }
/return

Sub CLOGTOGGLE
   /if n @CLOG==0 {
      /varset CLOG 1
      /call mqout "Logging enabled..."
   } else {
      /call mqout "Logging disabled..."
      /varset CLOG 0
   }
/return

Sub RadiusORTOGGLE
   /if n @RadiusOR==0 {
      /varset RadiusOR 1
      /call mqout "Radius clip override enabled..."
   } else {
      /varset RadiusOR 0
      /call mqout "Radius clip override disabled..."
   }
/return

Sub SSBTOGGLE
   /if n @SSB==0 {
      /call mqout "Singing Steel Boot casting enabled..."
      /varset SSB 1
   } else {
      /call mqout "Singing Steel Boot casting disabled..."
      /varset SSB 0
   }
/return

SUB DSETOUT
   /call mqout "DSET[H-:@HealthMin/H+:@HealthMax R:@RadiusReset R-:@RadiusMin/R+:@RadiusMax BCT:@BaseCastingTime]"
/return

Sub mqout(COutput)
   /if @CECHO==1 /echo @COutput
   /if @CLOG==1 /mqlog @COutput
/return

SUB SAVE
   /call inisave "AVOID" "@AVOID" 
   /call inisave "CECHO" "@CECHO"
   /call inisave "CLOG" "@CLOG"
   /call inisave "BaseCastingTime" "@BaseCastingTime"
   /call inisave "HealthMin" "@HealthMin"
   /call inisave "HealthMax" "@HealthMax"
   /call inisave "RadiusMin" "@RadiusMin"
   /call inisave "RadiusMax" "@RadiusMax"
   /call inisave "SSB" "@SSB"
   /call inisave "CircDelay" "@CircDelay"
   /call inisave "AUTODL" "@AUTODL"

   /call mqout "Settings Saved..."
/return
Last edited by BrainDozer on Mon Feb 16, 2004 1:00 am, edited 4 times in total.

PhoenixZorn
Macro Czar
Posts: 127
Joined: Fri Dec 12, 2003 2:20 pm
Contact:

Post by PhoenixZorn » Wed Feb 11, 2004 11:04 am

BrainDozer, I must say this is uber coding... I'm interested to see what the fixed Automob avoidance will look like, since most people who use this macro are pulling the whole zone to begin with...

One thing, I'm wondering if there will be a fix for how to handle casters... currently, the macro targets them first, but if you are rooted... heh, it's kinda hard to kill anything... you die kinda quick. I don't know HOW you would fix the caster thing... I suppose all you can do is make sure it dies first...

BrainDozer
a lesser mummy
a lesser mummy
Posts: 45
Joined: Sun Aug 03, 2003 2:10 pm

Post by BrainDozer » Wed Feb 11, 2004 11:48 am

Aside from avoiding them or running away, I’m not sure what can be done about casters. I haven’t touched caster handling at all. It still listens for casting mobs and switches to killing them right away. I don’t think it’s very effective with higher-level mobs, since most of them can damage you faster than you can heal yourself.

The mob avoidance code isn’t like the exclude list. I think the exclude list was called mob avoidance in previous posts, but it’s actually more of a simple guidance system. All it does is change the rotation radius when it sees a mob within an area around your character. There are still problems with it, and I’ve come up with a solution to replace my current approach. I hope to implement it when I get the time.

BrainDozer
a lesser mummy
a lesser mummy
Posts: 45
Joined: Sun Aug 03, 2003 2:10 pm

Post by BrainDozer » Wed Feb 11, 2004 8:41 pm

Tested today using radius of 140 while locked in a populated area. 8 hours isn't as impressive as 18 from the other day, but it's not half bad.

Code: Select all

EXP: 0.60%:51.21% - AAXP: 0.00%:8.18% - 478.25 minutes
Healing On - Health: 2% to 85%
**** DIED: 488.98 minutes

Glytch
a lesser mummy
a lesser mummy
Posts: 36
Joined: Sat Dec 27, 2003 9:22 am

Post by Glytch » Wed Feb 11, 2004 9:24 pm

miss post
Last edited by Glytch on Thu Feb 12, 2004 3:34 pm, edited 7 times in total.

BrainDozer
a lesser mummy
a lesser mummy
Posts: 45
Joined: Sun Aug 03, 2003 2:10 pm

Post by BrainDozer » Thu Feb 12, 2004 2:40 am

Looks like $char(casting) is broken atm. It always reports as TRUE.

advchant regulates timing with the help of $char(casting), so that why it's having minor cast problems.

User avatar
operat0r
RTFM, then ask again
Posts: 61
Joined: Thu Aug 28, 2003 2:04 am

druid mac

Post by operat0r » Fri Feb 13, 2004 12:38 am

what is a good base script to start with if I am working on a druid mac ?

all I have now is
http://macroquest2.com/phpBB2/viewtopic.php?t=5089
Last edited by operat0r on Fri Feb 13, 2004 1:51 am, edited 1 time in total.
with love moron #6895423686

User avatar
operat0r
RTFM, then ask again
Posts: 61
Joined: Thu Aug 28, 2003 2:04 am

your uber

Post by operat0r » Fri Feb 13, 2004 1:23 am

BrainDozer wrote:Looks like $char(casting) is broken atm. It always reports as TRUE.

advchant regulates timing with the help of $char(casting), so that why it's having minor cast problems.

what about useing event for it ? BTW your code is uber I have no tested it but I mean with only 3 or 4 events I dont see how you can do it :)

would you suggest me editing this mac for a druid ? I get about 1/2 of your code the rest is greek :shock:
with love moron #6895423686

BrainDozer
a lesser mummy
a lesser mummy
Posts: 45
Joined: Sun Aug 03, 2003 2:10 pm

Post by BrainDozer » Fri Feb 13, 2004 2:44 am

Code: Select all

what is a good base script to start with if I am working on a druid mac
I don't know anything about other macs. I didn't even notice advchant until people began reporting how well it worked.

Code: Select all

what about useing event for it ? BTW your code is uber I have no tested it but I mean with only 3 or 4 events I dont see how you can do it
$char(casting) is working again with the latest cvs update. I don't like using text events unless I can help it. It has too many limitations. I'll probably end up removing three of the ones I'm using now so I can make the script even more dynamic.

Code: Select all

would you suggest me editing this mac for a druid ?
I'm not sure what parts would be applicable to a druid. Most of the time it's easier to write things from scratch than to adapt foreign code.

BrainDozer
a lesser mummy
a lesser mummy
Posts: 45
Joined: Sun Aug 03, 2003 2:10 pm

Post by BrainDozer » Fri Feb 13, 2004 10:10 am

Bah! Now all of you are kiting in my best spots!

How the hell am I supposed to justify time spent on this revision if I can't get xp?

Glytch
a lesser mummy
a lesser mummy
Posts: 36
Joined: Sat Dec 27, 2003 9:22 am

Post by Glytch » Fri Feb 13, 2004 8:25 pm

does this work since the new patch came out ? i know the twist.mac doesnt work yet either was just wondering.

CyberTech
a ghoul
a ghoul
Posts: 97
Joined: Wed Jun 26, 2002 9:27 am

Post by CyberTech » Sat Feb 14, 2004 1:41 am

Edit: deliberately broken until further notice.
wtf?

El
a ghoul
a ghoul
Posts: 108
Joined: Mon Dec 29, 2003 12:34 pm

Post by El » Sat Feb 14, 2004 4:06 am

I wanted to test this... but saw this line:

Code: Select all

Edit: deliberately broken until further notice.
What's that all about?

User avatar
operat0r
RTFM, then ask again
Posts: 61
Joined: Thu Aug 28, 2003 2:04 am

Post by operat0r » Sat Feb 14, 2004 11:20 am

El wrote:I wanted to test this... but saw this line:

Code: Select all

Edit: deliberately broken until further notice.
What's that all about?
the scripts too uber for j00 ... ya I sat down and looked at this script ill be pulling what I can from it altho it will take me for ever because I never get to test the code :(

I wanted to ask about the $target(name,clean) can I get an example of syntax/output ? whats its use ?
with love moron #6895423686

BrainDozer
a lesser mummy
a lesser mummy
Posts: 45
Joined: Sun Aug 03, 2003 2:10 pm

Post by BrainDozer » Sat Feb 14, 2004 11:33 am

$target(name,clean) just gives the normal display name of what you are targeting. It will return the name in your target box.

Without clean, your returned value for an npc would be something like: a_bat04

With clean, it will return: a bat