Code: Select all
| Twist2.mac Flexible bard song twister using timers by BrainDozer.
| Updated by Drax.
|
| Syntax: /macro Twist2.mac [block 1] [block 2]
|
| Parameter block 1 indicates non-combat songs
| Parameter block 2 indicates combat songs
|
| Choose any combination of songs in any sequance to twist for each mode.
|
| Example: /macro Twist2.mac 256 1234234
|
| This would repeat songs 2, 5 and 6 durring non-combat and songs 1, 2, 3
| and 4 in the above sequence while in combat. In this instance, song 1
| is only twisted 1 for 7, which comes in handy for long duration songs
| like amplification.
|
| Other Examples: /macro Twist2.mac 0 123 | Twists on attack only
| /macro Twist2.mac 12345 0 | non-attack twisting only
| /macro Twist2.mac 12345 | same as above
| /macro Twist2.mac 9804 11 | twists 84 and 1
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#event MissedNote "You miss a note, bringing your song to a close!"
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub Main
/declare CSong global | keeps track of current song number 1-max
/declare CSongf global | break and play song toggle (break=0 play=1)
/declare attack global | debug: @combat glitch work-around
/declare CSongt timer | break and play song timer
/declare attackct timer | debug: @combat glitch work-around check timer
/declare v90 global
/declare v91 global
/declare l0 global
/declare l1 global
/declare l2 global
/declare l3 global
/declare a array2
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/stopsong
/call initVars @Param0 @Param1
:Mainloop
/if @attackct==0 /if $combat==TRUE /if @attack==0 /call AttackOn
/if @attackct==0 /if $combat==FALSE /if @attack==1 /call AttackOff
/if @attackct==0 /varset attackct 10 | adjustable attack check delay
| Debug: work-around
/if @v9@attack!=-1 /if $char(state)==STAND /call TwistSong @attack
/doevents
/goto :Mainloop
/return
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub TwistSong
/if @CSong>@v9@Param0 /varset CSong 0 | Restart twist when end of list
/if (@CSongf==0 && @CSongt==0) /call TS2 @Param0 | Start next song in list
/if (@CSongf==1 && @CSongt==0) /call TS3 | Stop song and advance index
/return | Debug: conditionals wern't playing nice with brackets
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub TS2
/cast @a(@Param0,@CSong)
/varset CSongf 1
/varset CSongt 40 | adjustable play delay
/return
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub TS3
/stopsong
/varset CSong $int($calc(@CSong+1)) | Debug: Force integer
/varset CSongf 0
/varset CSongt 1 | adjustable break delay
/return
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub initVars
/if @Param1=="" /varset Param1 "0"
/varset v90 0 | v90,v91 max song index lengths
/varset v91 0 | l0 combat mode index
/for l0 0 to 1 | l1 parameter index
/for l1 0 to $int($calc($strlen(@Param@l0)-1)) | l2 hold
/varset l2 $mid(@l1,1,@Param@l0)
/varset l3 @v9@l0 | Debug: array didn't like the fancy stuff
/if (@l2>=1 && @l2<=8) /varset a(@l0,@l3) @l2 | Debug: Bracket trouble
/if (@l2>=1 && @l2<=8) /varset v9@l0 $int($calc(@v9@l0+1))
/next l1 | Debug: it thinks it's a float-forcing
/next l0
/varset v90 $int($calc(@v90-1)) | over increment fix
/varset v91 $int($calc(@v91-1)) |
/varset CSong 0
/varset CSongt 0
/varset CSongf 0
/if $combat==TRUE /varset attack 1 | debug: inital combat values
/if $combat==FALSE /varset attack 0 |
/return
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub AttackOn
/stopsong
/varset attack 1
/varset CSong 0 | reset sequence
/varset CSongt 0 | attack mode twist start delay
/varset CSongf 0 | force play mode
/return
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub AttackOff
/stopsong
/varset attack 0
/varset CSong 0 | reset sequence
/varset CSongt 0 | attack off mode twist start delay
/varset CSongf 0 | force play mode
/return
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sub Event_MissedNote
/varset CSongt 0 | missed note try again delay
/varset CSongf 0 | switch back to play mode
/return
