The doonce variable turns off/on at each level to make sure that you don't announce the HP percent more than once per each level.
Code: Select all
Sub Main
/declare doonce global
/declare monitorhp global
/varset doonce 0
/varset monitorhp 1 | set to 0 for off, 1 for on - ANNOUNCE MOB HP's
/if "$target()"=="TRUE" /if n @monitorhp==1 /call announcehp
/return
Sub announcehp
/if n $target(hp,pct)>75 /varset doonce 0
/if n $target(hp,pct)<74 /if n $target(hp,pct)>50 /varset doonce 0
/if n $target(hp,pct)<49 /if n $target(hp,pct)>25 /varset doonce 0
/if n $target(hp,pct)>10 /if n $target(hp,pct)<9 /varset doonce 0
/if n $target(hp,pct)>5 /if n $target(hp,pct)<4 /varset doonce 0
/if n $target(hp,pct)>=74 /if n $target(hp,pct)<=75 /if n @doonce==0 {
/if $left(1,"$target(name,clean)")=="#" {
/rs $right($calc($strlen("$target(name,clean)")-1),"$target(name,clean)") is at $target(hp,pct) Health
} else {
/rs $target(name,clean) is at $target(hp,pct) Health
}
/varset doonce 1
/return
}
/if n $target(hp,pct)>=49 /if n $target(hp,pct)<=50 /if n @doonce==0 {
/if $left(1,"$target(name,clean)")=="#" {
/rs $right($calc($strlen("$target(name,clean)")-1),"$target(name,clean)") is at $target(hp,pct) Health
} else {
/rs $target(name,clean) is at $target(hp,pct) Health
}
/varset doonce 1
/return
}
/if n $target(hp,pct)>=24 /if n $target(hp,pct)<=25 /if n @doonce==0 {
/if $left(1,"$target(name,clean)")=="#" {
/rs $right($calc($strlen("$target(name,clean)")-1),"$target(name,clean)") is at $target(hp,pct) Health
} else {
/rs $target(name,clean) is at $target(hp,pct) Health
}
/varset doonce 1
/return
}
/if n $target(hp,pct)>=9 /if n $target(hp,pct)<=10 /if n @doonce==0 {
/if $left(1,"$target(name,clean)")=="#" {
/rs $right($calc($strlen("$target(name,clean)")-1),"$target(name,clean)") is at $target(hp,pct) Health
} else {
/rs $target(name,clean) is at $target(hp,pct) Health
}
/varset doonce 1
/return
}
/if n $target(hp,pct)>=4 /if n $target(hp,pct)<=5 /if n @doonce==0 {
/if $left(1,"$target(name,clean)")=="#" {
/rs $right($calc($strlen("$target(name,clean)")-1),"$target(name,clean)") is at $target(hp,pct) Health
} else {
/rs $target(name,clean) is at $target(hp,pct) Health
}
/varset doonce 1
/return
}
/return
