Moderator: MacroQuest Developers


Code: Select all
/declare SnareSong global
Sub Main(DOTs,Selos,CRadius,Snare,Health)
/if n @Snare!=0 {
/varset SnareSong @Snare
/echo Snare's: $char(gem,@SnareSong)
} else {
/varset SnareSong 0
/echo Not using Snare Song.
} Code: Select all
/if n @SnareSong!=0 /if n $target(id)>0 {
/if n $target(hp,pct)<=23 {
/if n @Songs(1)!=@SnareSong {
/echo Snare On - TargetHealth: $target(hp,pct)%
/varset Songs(1) @SnareSong
}
}
}
/if n @SnareSong!=0 /if $target(id)>0 {
/if n $target(hp,pct)>23 {
/if n @Songs(1)!=@OrigSong {
/echo Snare song off
/varset Songs(1) @OrigSong
}
}
}
/if n @HealSong!=0 /if n $char(hp,pct)<@HealthMin {
/if n @Songs(1)!=@HealSong /if n @Songs(1)!=@SnareSong {
/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
}
} 
I too have considered the amount of processing cycles to evalutate the extra if's, granted it's not very efficient, but it does accomplish what you were asking. It could be tweeked some, by maybe only looking at the mobs hit points if we're about to sing the first song in the twist (which will require an /if). Honestly, I wonder how much impact it really would have on todays computers.Only concern I have is the ability to return out of this kill loop, back to our main function/getnewtarget... I dont want it to return out every single time and back into this function, which is what would appear to happen with the snare. (it would be a check on mob hp-pct every time that i can tell for each song twisted)

Code: Select all
| - chant.mac - By Raebis
| Version: REV5c.ice Jan 06 20:30
| edited by: icehouse33
|
| This mac is used mostly for big open zones with not a lot of
| big hills (cause hills cause pain - unless you have levitate)
| Unless you have Singing Steel Boots! *See Below*
|
| 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 6 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!
| * NEW: Rubber Anchor: kites mobs closest to macro starting point - no wandering!
| * NEW: Support for Singing Steel Boots
| * NEW: Snare Song when Mob low on health
| ---------------------------------------------------------------------------------
|
| usage: chant.mac <DOTs/LVL6 Selos> <49selo> <radius> <snare song> [<heal song>]
|
|
| Usage Examples:
| -Scenario 1: If you are using...
| ...DOTs in Gems 4, 5, 6, and 7
| ...Level 49 Selo in Gem 2
| ...Snare Song in Gem 3
| ...Hymn of Restoration in Gem 1
| ...Radius of 55
| syntax: /mac chant 4567 2 55 3 1
|
| -Scenario 2: If you are using...
| ...DOTs in Gems 6 and 7
| ...Level 6 Selo in gem 3
| ...No Snare Song
| ...Hymn of Restoration in gem 8
| ...Radius of 80
| syntax: /mac chant 673 0 80 0 8
|
|
| If <heal song> is defined then when health goes below @HealthMin (default is 70%)
| it will replace the first song in <DOTs> with <heal song> until health is above
| @HealthMax (default is 85%)
|
| If <selos> is 0 then the macro will not try to cast selos every 150 seconds
|
| If <snare> is 0 then the macro will not try to snare the mob when it reaches a % hp
| User may change HP% to begin Snare. <SnarePerc> Defaulted to 23%
| User may Change if he wishes Snare to override Heal song Defaulted to yes.
| <SnareOverHeal> = 1 for Yes, 0 for No
|
| Note about the rubber anchor:
| The macro will target the mob closest to the RubberAnchor (your /loc when first
| starting the macro)
|
| REV5b was Tested in EW for bout an hour
|
| Note: If you don't have Singing Steel Boots, and you don't have a levitate buff
| then the function to click your boots won't be called.
|
| 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
|
| Note: Rev information moved to the top
|
#event NeedTarget "You must first select a target for this spell!"
#event Exp "You gain "
#event Died "You have entered"
#event Caster " begins to cast a spell."
#event Levitate "You feel as if you are about to fall"
#turbo
Sub Main(DOTs,Selos,CRadius,Snare,Health)
/zapvars
/if $defined(CRadius)==false {
/echo usage: chant.mac <DOTs, LVL6 Selos> <49selo> <radius> <snare song> [<heal song>]
/return
}
/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 HealSong global
/declare OrigSong global
/declare SnareSong global
/declare SnarePerc global
/declare SnareOverHeal global
/declare HealthMin global
/declare HealthMax global
/declare DBLevel global
/declare TargetUpNext global
/declare RubberX global
/declare RubberY global
/declare EachSong local
/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 level 49 Selos.
}
/if n @Snare!=0 {
/varset SnareSong @Snare
/echo Snare's: $char(gem,@SnareSong)
} else {
/varset SnareSong 0
/echo Not using a Snare Song. Welcome to warpville.
}
/if $defined(Health)!=false {
/varset HealSong @Health
/echo Healsong: $char(gem,@HealSong)
} else {
/echo No HealSong. Please watch your health.
/varset HealSong 0
}
/varset CirR @CRadius
/echo Radius: @CRadius
/varset OrigSong @Songs(1)
/varset CurSong 1
/varset Exper $char(exp)
/varset AAExp $char(aa,exp)
/varset SongTimer 1
/varset DBLevel $int($calc($calc($char(level)*.7)+1))
/varset HealthMin 70
/varset HealthMax 85
/varset SnarePerc 23
/varset SnareOverHeal 1
/varset TargetUpNext 0
/varset RubberX $char(x)
/varset RubberY $char(y)
/echo Rubber Anchor dropped at @RubberX,@RubberY
:Loop
/if n @CurSong>@nSongs /varset CurSong 1
/if n @TargetUpNext<=0 /if n $target(id)<=0 {
/call gettarget
}
/if n @TargetUpNext>0 /if n $target(id)>0 /if n $target(id)!=@TargetUpNext {
/echo User Selected Target or Aggroed while running
/varset TargetUpNext 0
}
/if n $target(distance)>1000 /if n $target(hp,pct)<=50 {
/echo Target Warped... Distance: $target(distance) HP: $target(hp,pct)
/echo getting new target
/cleanup
/call GetTarget
}
| Change - will only look to Set Snare or Heal song into twist when trying to cast 1st song
/if n @CurSong==1 {
/call Snareorheal
}
/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
/call Circ
/doevents
/delay 0
/goto :Loop
/return
Sub Event_Timer(TimerName)
/if @TimerName==SongTimer {
/if n @SeloSong!=0 /if n $char(buff,"$char(gem,@SeloSong)")==0 {
/delay 2
/stopsong
/cast @SeloSong
/varset PrevSong 0
/varset SongTimer 30
/call Circ
/doevents
/return
}
/if n @SeloSong!=0 /if n $char(buff,"$char(gem,@SeloSong)")!=0 /if n $char(buff,$char(buff,"$char(gem,@SeloSong)"),duration)<=6 {
/delay 2
/stopsong
/cast @SeloSong
/varset PrevSong 0
/varset SongTimer 30
/call Circ
/doevents
/return
}
/delay 2
/stopsong
| stop trying to dot while running to target but Heal if needed
/if n $target(id)>0 /if n $target(distance)<=200 {
/if n @CurSong>@nSongs /varset CurSong 1
/cast @Songs(@CurSong)
/varset PrevSong @CurSong
/varadd CurSong 1
} else {
/if n @Songs(@Cursong)==@HealSong /cast @Songs(@CurSong)
}
/varset SongTimer 30
/call Circ
/doevents
}
/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) {
/target id @TargetUpNext
/varset TargetUpNext 0
}
}
/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 Snareorheal
/if n @SnareSong!=0 /if n $target(id)>0 {
/if n $target(hp,pct)<=@SnarePerc {
/if n @Songs(1)!=@SnareSong {
/if n @SnareOverHeal!=1 /if n @Songs(1)==@HealSong {
/echo Snare NOT set to override Heal ..
/return
}
/if n @Songs(1)==@HealSong {
/echo Snare on, but Heal Song overridden *Caution*
/varset Songs(1) @SnareSong
} else {
/echo Snare On - TargetHealth: $target(hp,pct)%
/varset Songs(1) @SnareSong
}
/return
}
}
}
/if n @SnareSong!=0 /if $target(id)>0 {
/if n $target(hp,pct)>@SnarePerc {
/if n @Songs(1)==@SnareSong {
/echo Snare song off
/varset Songs(1) @OrigSong
/return
}
}
}
/if n @HealSong!=0 /if n $char(hp,pct)<@HealthMin {
/if n @Songs(1)!=@HealSong {
/if n @SnareOverHeal==1 /if n Songs(1)==@SnareSong {
/echo Heal can NOT override Snare *Caution*
/return
}
/if n @Songs(1)==@SnareSong {
/echo Healing On - Snare Off - Health: $char(hp,pct)% to @HealthMax%
/varset Songs(1) @HealSong
} else {
/echo Healing On - Health: $char(hp,pct)% to @HealthMax%
/varset Songs(1) @HealSong
}
/return
}
}
/if n @HealSong!=0 /if n $char(hp,pct)>=@HealthMax {
/if n @Songs(1)==@HealSong {
/echo Healing Off
/varset Songs(1) @OrigSong
}
}
/return
Sub SongFailed
/if n @PrevSong==0 {
/varset SongTimer 1
/return
}
/varset CurSong @PrevSong
/varset SongTimer 1
/return
Sub Event_NeedTarget
/if n @TargetUpNext<=0 /call GetTarget
/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)
/echo 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)+1))
/if n @TargetUpNext==0 /if n $target(id)==0 /call gettarget
/return
Sub GetTarget
/declare MobID local
/declare SRadius local
/varset MobID $searchspawn(npc,radius:$calc(@CirR*2))
/if n @Songs(1)==@SnareSong /varset Songs(1) @OrigSong
/if n @MobID!=0 /if n $spawn(@MobID,speed)>100 {
/target id @MobID
/echo Kiting aggro'd mob: $target(name,clean)
/return
}
/varset MobID 0
/for SRadius 0 to 10000 step 100
/varset MobID $searchspawn(npc,range:@DBLevel:$char(level),loc:@RubberX:@RubberY,radius:@SRadius)
/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)
/return
Sub Event_Caster(CastText)
/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 Event_Levitate
/delay 2
/stopsong
/cast item "Singing Steel Boots"
:Levloop
/delay 2
/call Circ
/if $char(casting)!=FALSE /goto :Levloop
/return