8/16/03 - Fixed a problem where if you lost a target while enraged, script would flip out
Code: Select all
| twist_adv.mac
| Advanced bard twisting and fighting macro. This macro holds up to
| 5 songs in a twist (more than 3 will not be sustainable), and has
| target auto-following, and activatable move-behind script.
| Syntax
| p0 (move behind script - if disabled, everything but
| the move-behind will be operational.
| p1 (cast delay - allows custization of the delays for casting, incase
| your computer is lagging. 32 works for most circumstances
| p2-6 Song #1-5
| This script is a combination of Grimjack's excelent fighting and
| movebehind code, customized, and a bard song twisting macro
| -ThatOtherGuy
#define MobShouldFace v1
#define autoon v2
#define RangeMin v50
#define RangeMax v51
#define FastRange v52
#define RaidYes v90
#define expset v21
#define currentsong v0
#define song1 v90
#define song2 v91
#define song3 v92
#define song4 v93
#define song5 v94
#define dly v95
#define timer t0
#Turbo 150
#define Combatstatus v60
#define CastTimer t1
#define EnrageVar v61
#Event Enraged "has become ENRAGED"
#Event Offrage "is no longer enraged"
#Event exp "You gain party experience"
#Event rexp "You gained raid experience"
#Event aaon "Auto attack is on"
#Event aaoff "Auto attack is off"
#Event MissedNote "You miss a note, bringing your song to a close!"
Sub Main
/if $p3=="" {
/echo usage (movebehind 1|0) (song cast delay) (song1) (song2) (song3) (song4) (song5)
/return
}
/if $p2=="" {
/echo usage (movebehind 1|0) (song cast delay) (song1) (song2) (song3) (song4) (song5)
/return
}
/if $p1=="" {
/echo usage (movebehind 1|0) (song cast delay) (song1) (song2) (song3) (song4) (song5)
/return
}
/varset RaidYes $p0
/varset RangeMin 5
/varset RangeMax 15
/varset FastRange 20
/varset Combatstatus 0
/varset EnrageVar 0
/varset expset 0
/varset autoon 0
/varset song1 $p2
/varset timer 0
/if $p3!="" /varset song2 $p3
/if $p4!="" /varset song3 $p4
/if $p5!="" /varset song4 $p5
/if $p6!="" /varset song5 $p6
/echo song 1 $song1
/echo song 2 $song2
/echo song 3 $song3
/echo song 4 $song4
/echo song 5 $song5
/varset dly "$p1"
/varset currentsong "songone"
:Mainloop
/call SetExp
/doevents
/call Combatcheck
/if $Combatstatus=="1" /call RangeSub
/if $Combatstatus=="1" /call Checkbehind
/call twist
/doevents
/goto :Mainloop
/return
Sub Checkbehind
/if n $distance($calc($target(y)-$cos($target(heading))*10),$calc($target(x)-$sin($target(heading))*10))>8 {
/if $RaidYes=="1" {
/if $Combatstatus=="1" /call movebehind
}
}
/return
Sub SetExp
/if $v21=="0" {
/varset v10 $char(exp)
/varset v11 $char(aa,exp)
/varset expset 1
/return
}
/return
Sub Combatcheck
/if $autoon=="0" /return
/if $target()=="FALSE" {
/varset Combatstatus 0
/attack off
/varset autoon 0
}
/if $EnrageVar=="1" {
/if $target()=="TRUE" {
/return
} else {
/varset EnrageVar 0
/varset Combatstatus 0
}
}
/if $target()=="FALSE" {
/varset Combatstatus 0
/if $combat=="TRUE" {
/attack off
}
/return
}
/if $target()=="TRUE" {
/if $autoon=="1" {
/varset Combatstatus 1
/return
}
} else {
/varset Combatstatus 0
}
/return
Sub Rangesub
/face fast nopredict
/if n $target(distance)>=$FastRange /call Fastmove
/if n $target(distance)>$RangeMax {
/press up
}
/if n $target(distance)<$RangeMin {
/press down
}
/return
Sub Event_Enraged
/if $target()=="TRUE" {
/varset EnrageVar 1
/attack off
}
/return
Sub Fastmove
:fastmoveloop
/if $target()=="FALSE" {
/varset Combatstatus 0
/sendkey up up
/if $combat=="TRUE" {
/attack off
/return
}
}
/face fast nopredict
/if n $target(distance)>$FastRange {
/sendkey down up
/attack off
}
/if n $target(distance)<=$FastRange {
/if $Combatstatus=="1" {
/if $EnrageVar=="0" {
/attack on
}
}
/sendkey up up
/return
}
/goto :fastmoveloop
/return
Sub Event_Offrage
/if $target()=="TRUE" {
/varset EnrageVar 0
/attack
}
}
/return
Sub Event_aaon
/varset autoon 1
/return
Sub Event_aaoff
/varset autoon 0
/varset Combatstatus 0
/return
| --------------------------------
Sub movebehind
/if $target()==FALSE {
/attack off
/sendkey up up
/return
}
/varcalc MobShouldFace $char(heading)
/varcalc MobShouldFace $MobShouldFace%360
/if $target(heading)<=$calc($MobShouldFace+80) /if $target(heading)>=$calc($MobShouldFace-80) /return
/sendkey down up
:gotopointloop
/if $combat=="TRUE" {
}
/if $target()==FALSE {
/sendkey up up
/return
}
/face fast loc $calc($target(y)-$cos($target(heading))*20),$calc($target(x)-$sin($target(heading))*20)
/if n $distance($calc($target(y)-$cos($target(heading))*20),$calc($target(x)-$sin($target(heading))*20))>3 /goto :gotopointloop
/sendkey up up
/face fast nopredict
/return
|----------------------
Sub Event_exp
/delay 1s
/varset v12 $char(exp)
/varset v16 $char(aa,exp)
/varcalc v13 $v12-$v10
/varcalc v14 100-$char(exp)
/varcalc v15 $v14/$v13
| AA calcs
/varcalc v17 $v16-$v11
/varcalc v18 100-$char(aa,exp)
/varcalc v19 $v18/$v17
/varset expset 0
/varset autoon 0
/varset Combatstatus 0
/echo EXP - Gain: $v13% Total: $char(exp)%
/echo AAEXP - Gain: $v17% Total: $char(aa,exp)%
/return
Sub Event_rexp
/delay 1s
/varset v12 $char(exp)
/varset v16 $char(aa,exp)
/varcalc v13 $v12-$v10
/varcalc v14 100-$char(exp)
/varcalc v15 $v14/$v13
| AA calcs
/varcalc v17 $v16-$v11
/varcalc v18 100-$char(aa,exp)
/varcalc v19 $v18/$v17
/varset expset 0
/varset autoon 0
/echo EXP - Gain: $v13% Total: $char(exp)%
/echo AAEXP - Gain: $v17% Total: $char(aa,exp)%
/return
|-------------------------------------------------
Sub twist
/if $currentsong=="songone" {
/if n $timer=="0" {
/stop
/delay 3
/cast $song1
/doevents
/varset timer "$dly"
/echo timer = $timer and dly = $dly
/if $song2!="" {
/varset currentsong "songtwo"
}
/if $song2=="" {
/varset currentsong "songone"
}
} else {
/return
}
} /return
/if $currentsong=="songtwo" {
/if n $timer=="0" {
/stop
/delay 3
/cast $song2
/doevents
/varset timer "$dly"
/if $song3!="" {
/varset currentsong "songthree"
}
/if $song3=="" {
/varset currentsong "songone"
}
} else {
/return
}
/return
}
/if $currentsong=="songthree" {
/if n $timer=="0" {
/stop
/delay 3
/cast $song3
/doevents
/varset timer "$dly"
/if $song4!="" {
/varset currentsong "songfour"
}
/if $song4=="" {
/varset currentsong "songone"
}
} else {
/return
}
/return
}
/if $currentsong=="songfour" {
/if n $timer=="0" {
/stop
/delay 3
/cast $song4
/doevents
/varset timer "$dly"
/if $song5!="" {
/varset currentsong "songfive"
}
/if $song5=="" {
/varset currentsong "songone"
}
} else {
/return
}
/return
/if $currentsong=="songfive" {
/if n $timer=="0" {
/stop
/delay 3
/cast $song5
/doevents
/varset timer "$dly"
/varset currentsong "songone"
} else {
/return
}
/return
}
/return
Sub Event_MissedNote
/if $currentsong=="songone" {
/cast $song1
/delay 3
/varset timer "$dly"
}
/if $currentsong=="songtwo" {
/cast $song2
/delay 3
/varset timer "$dly"
}
/if $currentsong=="songthree" {
/cast $song3
/delay 3
/varset timer "$dly"
}
/if $currentsong=="songfour" {
/cast $song4
/delay 3
/varset timer "$dly"
}
/if $currentsong=="songfive" {
/cast $song5
/delay 3
/varset timer "$dly"
}
/doevents
/return
ToDo
~Add instrument switching
~Combine it with grimjack's GenBot for a completely automated bard0bot
