[Thu Apr 15 09:46:16 2004] Cleared the following: Timers Vars Arrays
[Thu Apr 15 09:46:16 2004] Ending macro: Failed to parse /if command
[Thu Apr 15 09:46:16 2004] twist.mac@121 (Sing): /if (n @Param0<1 || n @Param0> {
[Thu Apr 15 09:46:16 2004] twist.mac@111 (Main(Param0)): /call Sing @ncSongArray(@cursong) @nncsongs
[Thu Apr 15 09:46:16 2004] Cleared the following: Timers Arrays
[Thu Apr 15 09:46:16 2004] The current macro has ended.
[Thu Apr 15 09:46:16 2004] Usage:
[Thu Apr 15 09:46:16 2004] /if <condition> <command>
[Thu Apr 15 09:46:16 2004] <condition> : (<condition> && <condition>) or [n] <a>==<b>
The code for the macro is this:
Code: Select all
| - twist.mac -
| /mac twist <non combat songs> <combat songs>
| Shamelessly Modified/Merged Version of twist.mac and stick.mac as written by rzmonk76 and M0nk respectively.
| Modiffied to current form 3/31/2004
|
| Additions: Added Help hints if you forget which set comes in which order, just type the name of the macro
| Added Pull Modes (Toggled via /echo Pull), to temporarily stop downtime twists.
| Added Anchor Mode (Toggled via /echo Anchor), to automatical return to starting spot after combat
#define MOBini "stick-npc.ini"
#define PCini "stick-pc.ini
#event MissedNote "You miss a note, bringing your song to a close!"
#event Recovered "You haven't recovered yet..."
#event EXP "experience!!"
#event RageON "has become ENRAGED."
#event RageOFF "is no longer enraged"
#event MobGate " Gates."
#event StunON "You are stunned"
#event StunON "You lose control of yourself!"
#event StunOFF "You are unstunned"
#event StunOFF "You have control of yourself again."
#event Pull "[MQ2] Pull"
#event Anchor "[MQ2] Anchor
#turbo
Sub Main(Param0)
:setupDeclare
/zapvars
/declare MA_SB global
/declare MobID global
/declare CharX global
/declare CharY global
/declare MeleeDistance global
/declare DefaultMeleeDistance global
/declare Pull global
/declare Anchor global
/declare AnchorX global
/declare AnchorY global
/declare AnchorHeading global
/declare Debug global
/varset Debug 0
:setPCiniOther
/varset DefaultMeleeDistance $ini("PCini","$char(name)","DefaultMeleeDistance")
/if "@DefaultMeleeDistance"=="NOTFOUND" {
/ini "PCini" "$char(name)" "DefaultMeleeDistance" "15"
/delay 0
/varset DefaultMeleeDistance $ini("PCini","$char(name)","DefaultMeleeDistance")
}
/if $defined(Param0)==false {
/echo "Usage: /macro twist <non combat songs> <combat songs>"
/echo ""
/echo "Example: /macro twist 123 0 (twist only during downtime)"
/echo " /macro twist 0 123 (twist only during combat)"
/echo " /macro twist 123 456 (twist during both downtime and combat)"
/echo ""
/echo "/echo Pull On (stop twisting downtime songs until combat is engaged)"
/echo "/echo Pull Off (starts singing any downtime songs again)
/endmacro
}
/declare CASTTIME global
/declare cursong global
/declare nncsongs global
/declare ncsongs global
/declare prevsong global
/declare ncSongList global
/declare cSongList global
/declare SingTime timer
/declare I global
/declare J global
/declare ncSongArray array
/declare cSongArray array
/varset CASTTIME 33
/varset Anchor 0
/varset cursong 1
/varset nncsongs $strlen(@Param0)
/varset ncsongs $strlen(@Param1)
/varset ncSongList @Param0
/varset cSongList @Param1
/for I 1 to @nncsongs
/varcalc J $int(@I-1)
/varset ncSongArray(@I) $mid(@J,1,@ncSongList)
/next I
/for I 1 to @ncsongs
/varcalc J $int(@I-1)
/varset cSongArray(@I) $mid(@J,1,@cSongList)
/next I
/varset CASTTIME 33
/if n @Debug==1 {
/echo "Initiating Main Loop"
}
:Loop
/if "$char(state)"!="SIT" {
/if $combat==TRUE {
/varset cursong 1
/if n @Debug==1 {
/echo "Combat Mode Detected, calling attack routine"
}
/call Attack
/doevents
}
/if "$combat"!="TRUE" /if n @SingTime<=0 {
/varset cursong 1
/if n @Debug==1 {
/echo "Combat is off, and its time to sing, so calling no combat sing routine"
}
/call Sing @ncSongArray(@cursong) @nncsongs
}
}
/if $char(state)=="DUCK" /press d
/doevents
/goto :Loop
/return
Sub Sing
/varset SingTime @CASTTIME
/if (n @Param0<1 || n @Param0> {
/if n @Debug==1 {
/echo "Returning without singing, you want to sing a song lower than 0 or higher than 8, @Param0"
}
/return
}
/if ("$combat"!="TRUE" && n @Pull==1) {
/varset cursong 1
/if n @Debug==1 {
/echo "In Pull Mode outside combat, not singing"
}
/return
}
/stopsong
/cast @Param0
/if n @Debug==1 {
/echo "Singing Song in Gem #@Param0 which is song @cursong out of @Param1"
}
/varset prevsong @cursong
/varadd cursong 1
/if n @cursong>@Param1 /varset cursong 1
/doevents
/return
Sub Event_MissedNote
/varset cursong @prevsong
/varset SingTime 0
/doevents
/return
Sub Event_Recovered
/varset SingTime 0
/varset cursong @prevsong
/doevents
/return
Sub attack
:attackCheck
/varset MobID $target(id)
/if n @Debug==1 {
/echo "I'm ready to attack Mob ID# @MobID"
}
:attackSetup
/if $target(type)!=NPC {
/attack off
/delay 5
/return
}
/if n $target(distance)>150 {
/if n @Debug==1 {
/echo "$target(name,clean) is too far away to engage"
}
/attack off
/delay 5
/return
}
:attackPreFight
/call ClearReturn
/varset MeleeDistance $ini("MOBini","$zone","$target(name,clean).DistanceMelee")
/if "@MeleeDistance"=="NOTFOUND" {
/ini "MOBini" "$zone" "$target(name,clean).DistanceMelee" @DefaultMeleeDistance
/delay 0
/varset MeleeDistance $ini("MOBini","$zone","$target(name,clean).DistanceMelee")
}
/if ("$combat"=="TRUE" && @Pull==1) {
/varset cursong 1
/varset Pull 0
/if n @Debug==1 {
/echo "Pull Mode Disabled due to Combat Starting"
}
}
:attackMeleeLoop
/doevents exp
/doevents RageOn
/doevents MobGate
/doevents StunON
/if n $target(id)!=@MobID {
/if n @Debug==1 {
/echo "MOb ID has changed, ending attack"
}
/goto :attackend
}
/if $return==EndATK {
/if n @Debug==1 {
/echo "Event Requested End of Attack"
}
/goto :attackend
}
/if $combat!="TRUE" {
/varset cursong 1
/if n @Debug==1 {
/echo "Attack Mode not enabled"
}
/goto :attackend
}
/if n $char(feetwet)!=0 /face fast
/if n $char(feetwet)==0 /face fast nolook
/if n $target(id)==@MobID /if n $target(distance)>@MeleeDistance /sendkey down up
/if n $target(id)==@MobID /if n $target(distance)<=@MeleeDistance /sendkey up up
/if n $target(id)==@MobID /if n $target(distance)<=$calc(@MeleeDistance-5) /press down
/if "$combat"=="TRUE" {
/if n @SingTime<=0 {
/if n @Debug==1 {
/echo "Calling Combat Songs Routine"
}
/call Sing @cSongArray(@cursong) @ncsongs
}
}
}
/if "$combat"!="TRUE" {
/if n @SingTime<=0 {
/if n @Debug==1 {
/echo "Calling Non Combat Songs Routine"
}
/call Sing @ncSongArray(@cursong) @nncsongs
}
}
/goto :attackMeleeLoop
:attackend
/varset MobID NULL
/attack off
/sendkey up up
/varset SingTime 0
/if n @Debug==1 {
/echo "Starting Attack ending routines"
}
/if "$combat"!="TRUE" /if n @SingTime<=0 /call Sing @ncSongArray(@cursong) @nncsongs
/if n @Anchor==1 {
/if n @Debug==1 {
/echo "Returning to Anchor Point"
}
/call MoveToAnchor
}
/return
Sub ClearReturn
/return NULL
Sub event_exp
/if n $target(hp,pct)>0 /return
/return EndATK
Sub event_RageOn
/if n $target(hp,pct)>15 /return
/if n $target(hp,pct)==0 /return
/if $target(id)==@MobID /sendkey up up
/call ClearReturn
/echo Rage On
/attack off
/call ClearReturn
:waitRage
/doevents
/if $target(id)!=@MobID /return EndATK
/if $return==EndATK /return EndATK
/if $return==RageOFF /return
/goto :waitRage
/return
Sub event_RageOFF
/echo Rage OFF
/attack on
/return RageOFF
Sub event_MobGate
/if n $target(distance)<100 /return
/echo MOB GATED!
/attack off
/return EndATK
Sub event_StunON
/doevents flush StunOFF
/call ClearReturn
:LoopStunOFF
/doevents StunOFF
/if "$return"=="StunOFF" {
/call ClearReturn
/return
}
/goto :LoopStunOFF
/return
Sub event_StunOFF
/return StunOFF
Sub event_Pull
/if n @Pull==0 {
/if $combat=="FALSE" {
/varset Pull 1
/echo "Pulling Mode On"
/stopsong
}
/return
}
/if n @Pull==1 {
/varset Pull 0
/echo "Pull Mode Off"
/return
}
/return
Sub event_Anchor
/if n @Anchor==1 {
/varset Anchor 0
/echo "No Longer Anchored"
/return
}
/if n @Anchor==0 {
/varset Anchor 1
/echo "Anchored to current loc"
/varset AnchorX $char(x)
/varset AnchorY $char(y)
/varset AnchorHeading $char(heading)
/return
}
/return
Sub MoveToAnchor
:AnchorMoveLoop
/if "$combat"!="TRUE" /if n @SingTime<=0 /call Sing @ncSongArray(@cursong) @nncsongs
/if "$char(state)"=="SIT" /stand
/face nolook loc @AnchorY,@AnchorX
/if n $distance(@AnchorY,@AnchorX)>11 /sendkey down up
/if n $distance(@AnchorY,@AnchorX)<=11 {
/sendkey up up
/face heading @AnchorHeading
/return
}
/goto :AnchorMoveLoop
/return 