appreciated : feedback or ask questions, or tell me where else this macro will work (what zones it is safe in)
Code: Select all
| advchant.mac - By Raebis
| Version: REV7 Released Feb 18 2004 23:15
|
| This mac is used mostly for big open zones with not a lot of
| big hills (cause hills cause pain - unless you have levitate)
|
| Features:------------------------------------------------------------------------
|
| * 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!
| * NEW: Exclude List: Won't attack mobs that you have /add'ed to this list!
|
| ---------------------------------------------------------------------------------
|
| usage: /mac advchant.mac <DOTs> <Selos> <heal song> <radius>
|
| usage examples:
|
| If you are 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
| Then use the syntax:
| /mac advchant 132 8 4 50
|
| If you are 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
| Then use the syntax:
| /mac advchant 3456 1 7 100
|
| ---------------------------------------------------------------------------------
|
| Notes on 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"
|
| Notes on HealSong:
| The healsong will play when your heath goes below @HealthMin (default 75)
| and will continue twisting the healsong in until your health is at or above
| @HealthMax (default 85). 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).
|
| Warning:
| 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 (Rubber Anchor)
|
| ---------------------------------------------------------------------------------
|
| advchant.mac REV6 was tested in EW with both level 49 and level 5 selos for about
| an hour without problems. Exclusion list worked fine.
|
#event Exp "You gain "
#event Died "You have entered"
#event Caster " begins to cast a spell."
#turbo
Sub Main(DOTs,Selos,Health,CRadius)
/zapvars
/if $defined(CRadius)==false {
/echo usage: chant.mac <DOTs> <Selos> <heal song> <radius>
/return
}
/declare CirR global
/declare Songs array
/declare nSongs global
/declare CurSong global
/declare PrevSong global
/declare Exper global
/declare AAExp global
/declare RunTime global
/declare SongTimer timer
/declare SeloSong global
/declare SeloTicks global
/declare NoRewind global
/declare HealSong global
/declare OrigSong global
/declare HealthMin global
/declare HealthMax 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
/varset AddBuffer waiting
/varset DelBuffer waiting
/varset AlertList 10
/varset Exper $char(exp)
/varset AAExp $char(aa,exp)
/varset RunTime 1
/varset MinLevel $calc($char(level)-5)
/varset MaxLevel $calc($char(level)+2)
/varset HealthMin 70
/varset HealthMax 85
/alias /add /varset AddBuffer
/alias /del /varset DelBuffer
/alias /pause /varset PauseBuffer $not(@PauseBuffer)
/alias /exlist /alert list @AlertList
/call LoadExcludes
/varset nSongs $strlen(@DOTs)
/for EachSong 1 to @nSongs
/varset Songs(@EachSong) $mid($calc(@EachSong-1),1,@DOTs)
/echo Song @EachSong: $char(gem,@Songs(@EachSong))
/next EachSong
/if n @Selos!=0 {
/varset SeloSong @Selos
/echo Selo's: $char(gem,@SeloSong)
} else {
/varset SeloSong 0
/echo Not using Selos.
}
/varset SeloTicks 0
/if $char(level)>=49 /varset SeloTicks 2
/varset HealSong @Health
/echo Healsong: $char(gem,@HealSong)
/varset CirR @CRadius
/echo Radius: @CRadius
/varset PauseBuffer 0
/varset OrigSong @Songs(1)
/varset CurSong 1
/varset TargetUpNext 0
/varset RubberX $char(x)
/varset RubberY $char(y)
/echo Rubber Anchor dropped at @RubberX,@RubberY
/call Event_Timer SongTimer
:Loop
/if "@AddBuffer"!="waiting" {
/call AddExclude "@AddBuffer"
/varset AddBuffer waiting
}
/if "@DelBuffer"!="waiting" {
/call DelExclude "@DelBuffer"
/varset DelBuffer waiting
}
/if n @PauseBuffer==-1 {
/echo 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 30
/doevents
/goto :PauseLoop
:DonePause
/echo Continuing...
/varset TargetUpNext 0
}
/if n @TargetUpNext==0 /if n $target(id)==0 {
/doevents Event_Exp
/call gettarget
}
/if n @TargetUpNext!=0 /if n $target(id)!=0 {
/echo User Selected Target or Aggroed while running
/varset TargetUpNext 0
}
/if n @TargetUpNext==0 /if $target(type)!=NPC /call gettarget
/if n $target(distance)>1000 /if n $target(hp,pct)<=50 {
/cleanup
/echo Target Warped... Getting a new target
/call GetTarget
}
/if n @HealSong!=0 /if n $char(hp,pct)<@HealthMin {
/if n @Songs(1)!=@HealSong {
/echo 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 {
/echo Healing Off
/varset Songs(1) @OrigSong
}
}
/if $char(casting)==FALSE /if n @SongTimer>0 /if n @SongTimer<28 {
/if n @NoRewind==0 /varset CurSong @PrevSong
/varset NoRewind 0
/call Event_Timer SongTimer
}
/if @SeloSong!=0 /if $char(buff,"$char(gem,@SeloSong)")==0 /if n @NoRewind==0 /call Event_Timer SongTimer
/call Circ
/doevents
/delay 0
/goto :Loop
/return
Sub Event_Timer(TimerName)
/if @TimerName==SongTimer {
/stopsong
/call Circ
/delay 1
/call Circ
/delay 1
/if n @SeloSong!=0 {
/if $char(buff,"$char(gem,@SeloSong)")==0 {
/cast @SeloSong
/varset NoRewind -1
/varset SongTimer 31
/return
}
/if $char(buff,$char(buff,"$char(gem,@SeloSong)"),duration)<=@SeloTicks {
/cast @SeloSong
/varset NoRewind -1
/varset SongTimer 31
/return
}
}
/if $target()==FALSE /if $spell("$char(gem,@CurSong)",spelltype)==Detrimental /varset NoRewind -1
/if n @NoRewind==0 /if $char(state)==STAND /cast @Songs(@CurSong)
/varset PrevSong @CurSong
/varset SongTimer 31
/varadd CurSong 1
/if n @CurSong>@nSongs /varset CurSong 1
/call Circ
}
/return
Sub Circ
/declare CirX local
/declare CirY local
/if n @TargetUpNext!=0 {
/varset CirX $spawn(@TargetUpNext,y)
/varset CirY $spawn(@TargetUpNext,x)
/if n $spawn(@TargetUpNext,distance)<=$calc(@CirR*2) {
/varset TargetUpNext 0
/target id @TargetUpNext
}
}
/if n $target(id)!=0 {
/varset CirX $target(y)
/varset CirY $target(x)
}
/if n $distance(@CirX,@CirY)<$calc(@CirR/2) {
/face heading $calc($heading(@CirX,@CirY)+180)
} else {
/face heading $calc($heading(@CirX,@CirY)+$calc(90*$calc(@CirR/$distance(@CirX,@CirY))))
}
/return
Sub Event_Died
/delay 10
/sit
/delay 10
/camp desktop
/return
Sub Event_Exp
/varset AAExp $calc($char(aa,exp)-@AAExp)
/varset Exper $calc($char(exp)-@Exper)
/if n @Exper>0 {
/declare EXKills local
/varset EXKills $calc($calc(100-$char(exp))/@Exper)
/echo Exp Gain: @Exper Total: $char(exp) Kills: @EXKills
}
/if n @AAExp>0 {
/declare AAKills local
/varset AAKills $calc($calc(100-$char(aa,exp))/@AAExp)
/echo AA Gain: @AAExp Total: $char(aa,exp) Kills: @AAKills
}
/varset RunTime $running
/varset Exper $char(exp)
/varset AAExp $char(aa,exp)
/varset MinLevel $calc($char(level)-5)
/varset MaxLevel $calc($char(level)+2)
/return
Sub GetTarget
/if n @GettingTarget==-1 /return
/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
/varset TargetUpNext 0
/echo Kiting aggro'd mob: $target(name,clean)
/varset GettingTarget 0
/return
}
/varset MobID 0
/for SRadius 0 to 10000 step 100
/varset MobID $searchspawn(npc,loc:@RubberX:@RubberY,radius:@SRadius,noalert:@AlertList)
/if n @MobID!=0 {
/goto :Done
}
/next SRadius
/echo No mobs found, action required!
/beep
/echo Ending Macro
/beep
/endmac
:Done
/varset TargetUpNext @MobID
/echo Next: $spawn(@MobID,level) $spawn(@MobID,name,clean) - Distance: $spawn(@MobID,distance)
/varset GettingTarget 0
/return
Sub Event_Caster(CastText)
/return
/declare CasterID local
/varset CasterID $searchspawn(name,"$left($calc($strlen("@CastText")-24),"@CastText")")
/if $spawn(@CasterID,type)!=NPC /return
/if n $target(id)==@CasterID /return
/if n $spawn(@CasterID,distance)<=$calc(@CirR*2) {
/target id @CasterID
/echo Targeting Caster: $spawn(@CasterID,name,clean)
}
/return
Sub AddExclude(ExcludeName)
/declare Category local
/declare IniFile local
/declare EachExclude local
/declare Exclude local
/declare BlankExclude local
/varset BlankExclude 0
/varset Category "$zone"
/varset IniFile advchant_$char(name)_$servername
/varset EachExclude 0
:NextExclude
/varset Exclude "$ini(@IniFile,"@Category",exclude_$int(@EachExclude))"
/if "@Exclude"~~"NOTFOUND" {
/goto :IniParsed
}
/if "@Exclude"~~"NONE" {
/varset BlankExclude @EachExclude
|/echo Blank Exclude found at @EachExclude
}
/if "@Exclude"~~"@ExcludeName" {
/echo @ExcludeName already on Exclude List
/return
}
/varadd EachExclude 1
/goto :NextExclude
:IniParsed
/if n @BlankExclude==0 {
/ini @IniFile "@Category" exclude_$int(@EachExclude) "@ExcludeName"
|/echo Wrote to new exclude_@EachExclude=@ExcludeName
} else {
/ini @IniFile "@Category" exclude_$int(@BlankExclude) "@ExcludeName"
|/echo Wrote to blank exclude_@BlankExclude=@ExcludeName
}
/alert add @AlertList NPC "@ExcludeName"
/return
Sub LoadExcludes()
/declare Category local
/declare IniFile local
/declare EachExclude local
/declare Exclude local
/varset Category "$zone"
/varset IniFile advchant_$char(name)_$servername
/alert clear @AlertList
/alert add @AlertList AdvChant.mac
/if "$ini(@IniFile,"@Category")"~~"NOTFOUND" {
/echo No Exclude list for $zone
/return
}
/varset EachExclude 0
:NextExclude
/varset Exclude "$ini(@IniFile,"@Category",exclude_$int(@EachExclude))"
/if "@Exclude"~~"NOTFOUND" {
|/echo done loading
/return
}
/if "@Exclude"!~"NONE" {
/alert add @AlertList NPC "@Exclude"
|/echo added alert NPC @Exclude
}
/varadd EachExclude 1
/goto :NextExclude
/return
Sub DelExclude(ExcludeName)
/declare Category local
/declare IniFile local
/declare EachExclude local
/declare Exclude local
/varset Category "$zone"
/varset IniFile advchant_$char(name)_$servername
/if "$ini(@IniFile,"@Category")"~~"NOTFOUND" {
/echo No Exclude list for $zone
/return
}
/varset EachExclude 0
:NextExclude
/varset Exclude "$ini(@IniFile,"@Category",exclude_$int(@EachExclude))"
/if "@Exclude"~~"NOTFOUND" {
|/echo @EachExclude item(s) removed from INI
/call LoadExcludes
/return
}
/if "@Exclude"~~"@ExcludeName" {
/ini @IniFile "@Category" exclude_$int(@EachExclude) NONE
|/echo writing exclude_@EachExclude as NONE - previosly was @Exclude
}
/varadd EachExclude 1
/goto :NextExclude
/returnREV2 Posted Dec 12 07:00 - forgot a $calc... some other fixes
REV3 Posted Dec 12 12:30 - lots of updates, see post below
REV3a Posted Dec 13 18:00 - Fixes for autoheal, some other fixes
REV4nt Posted Dec 21 03:00 - Level 6 compatibility, other fixes and enhancements - NOT TESTED
REV4nt Posted Dec 22 08:00 - fixed fatal bug in previous release (still not tested - havn't updated my MQ2 with new structs or offsets yet)
REV4nt Posted Dec 22 11:30 - Fixed a typo in a variable, thanks to wilso132
REV4nt Posted Dec 22 22:45 - Fixed healsong to work without the need for a failsafe counter, much in thanks to ml2517
REV5 Posted Jan 02 07:00 - Rubber Anchor Implemented, others, see post
REV5a Posted Jan 03 03:00 - Rubber Anchor enchancements, fixed other issues check post for details
REV5b Posted Jan 03 04:00 - Fixed crash error in caster detection
REV5c Posted Jan 03 15:00 - Fixed error with song checking
REV6 Posted Jan 12 03:30 - Better Selo's support, Exclude List, see post
REV6a Posted Jan 13 11:15 - Couple of bug fixes, removed debug echos
REV7 Posted Feb 18 23:45 - sum stuff


