Simple Twist V2 unlimited params

Post your completed (working) macros here. Only for macros using MQ2Data syntax!

Moderator: MacroQuest Developers

Virtuoso65
a hill giant
a hill giant
Posts: 150
Joined: Wed Oct 15, 2003 2:29 pm

Simple Twist V2 unlimited params

Post by Virtuoso65 » Sat May 22, 2004 1:45 pm

This is what I see as the next logical step for my twisting macro, the ability to twist as many songs as the user wishes. If you want to twist 1 song or 20 songs this macro will keep it togather.

Usage: /mac twist # # # # # ........

Code: Select all


| twisting.mac
| MQData & MQ2DataVars complient
| usage /mac twisting.mac song1 song2 song3 song4....songN
#event Loading "#*#LOADING, PLEASE WAIT...#*#"
#event MissedNote "#*#You miss a note, bringing your song to a close!#*#"
#event Recovered  "#*#You haven't recovered yet...#*#"
Sub MAIN
/declare a[${Macro.Params}] int outer 0
/declare nsongs int outer 0
/declare cursong int outer 0
/declare t0 timer outer 0
/declare pcount int outer 0
/declare bcount int outer 0
/varset nsongs ${Macro.Params}

  /for pcount 0 to ${Macro.Params}
         /if (${Defined[Param${pcount}]}) {
  	    /varcalc bcount ${pcount}+1
                    /varset a[${bcount}] ${Param${pcount}}
	    /echo Song ${bcount}: ${Me.Gem[${Param${pcount}}]}
          }
  /Next pcount

/varset cursong 0
/varset t0 1
/if (!${Defined[Param0]}) {
	/echo Usage: /mac twisting # # # #....
	/end
}
/if ((${Defined[Param0]})&&(!${Defined[Param1]})) /goto :loop2

:Loop1
  /if (${t0}<=0) {
    /stopsong
    /delay 2
    /varset t0 32
    /varcalc cursong ${cursong}+1
    /if (${cursong}>${nsongs}) /varset cursong 1
    /popup ${Me.Gem[${a[${cursong}]}]}
    /cast ${a[${cursong}]}
    }
  /doevents
/goto :Loop1

:loop2
  /if (!${Bool[${Me.Casting}]}) {
	/stopsong
	/delay 1
	/cast ${Param0}
	/doevents
	/delay 3
  }
/goto :Loop2

/return

Sub Event_MissedNote
  /varcalc cursong ${cursong}-1
  /varset t0 1
/return

Sub Event_Loading
    /end
/return

Sub Event_Recovered
  /varcalc cursong ${cursong}-1
  /varset t0 1
/return