Simple Twist.mac

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.mac

Post by Virtuoso65 » Thu Apr 29, 2004 11:48 pm

This is a no frills twisting mac. If you want to do circles or change song lineup baced on combat/noncombat then look elsewhere. If you want item twisting then use the MQ2Twising plugin.

Code: Select all

| twisting.mac
| MQData & MQ2DataVars complient
| usage /mac twisting.mac song1 song2 song3 song4
#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(p0,p1,p2,p3)
/declare a[4] int outer
/declare nsongs int outer
/declare cursong int outer
/declare t0 timer outer
  /if (${Defined[p0]}) {
  	  /varset nsongs 1
  	  /varset a[1] ${p0}
  	  /echo Song 1: ${Me.Gem[${p0}]}
  } else {
           /echo You can't twist 0 songs. Duh.
           /end
  }
  /if (${Defined[p1]}) {
            /varcalc nsongs ${nsongs}+1
            /varset a[2] ${p1}
            /echo Song 2: ${Me.Gem[${p1}]}
      } else /goto :Loop2
  /if (${Defined[p2]}) {
            /varcalc nsongs ${nsongs}+1
            /varset a[3] ${p2}
            /echo Song 3: ${Me.Gem[${p2}]}
  } else /goto :Loop2
  /if (${Defined[p3]}) {
            /varcalc nsongs ${nsongs}+1
            /varset a[4] ${p3}
            /echo Song 4: ${Me.Gem[${p3}]}
  }
  /varset cursong 0
  /varset t0 1

:Loop
  /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 :Loop

:Loop2
  /if (!${Bool[${Me.Casting}]}) {
	/stopsong
	/delay 1
	/cast ${p0}
	/doevents
  }
/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