Code: Select all
#turbo
#event Pause "[MQ2] Pause"
#event Unpause "[MQ2] Unpause"
Sub Main
||||||||Define the song you'd like to twist as RunSong. Define the item you'd like to switch as ItemName.
||||||||Define if you'd like to switch ItemName into primary or secondary slot.
/if (!${Defined[RunSong]}) /declare RunSong string outer Selo`s Accelerating Chorus
/if (!${Defined[ItemName]}) /declare ItemName string outer Thunderous Drum of Karana
/if (!${Defined[PriSec]}) /declare PriSec string outer primary
/if (${PriSec.Equal[primary]}) {
/varset PriSec 13
} else {
/varset PriSec 14
}
||||||||Make a song duration variable.
/if (!${Defined[SongDur]}) /declare SongDur timer outer 100
:Run
/doevents
||||||||Do nothing if sitting.
/if (${Me.State.Equal[SIT]}) {
/delay 2s
/goto :Run
}
||||||||If you already have RunSong and SongDur is not 0, then do nothing.
/if (${Me.Buff[${RunSong}].ID} && ${SongDur}!=0) /goto :Run
||||||||Make sure RunSong is memorized.
/if (!${Defined[RunSlot]}) /declare RunSlot int local
/varset RunSlot ${Me.Gem[${RunSong}]}
/if (!${RunSlot}) {
/echo ${RunSong} is not memorized.
/delay 10s
/goto :Run
}
||||||||Switch items.
/call Switch
/goto :Run
/return
Sub Switch
||||||||SwitchBack is to switch the item back if needed. NeedToSwitch checks if the item needs to be switched. ItemSlot is the item's slot.
||||||||ItemName is the item that needs to be switched
/if (!${Defined[SwitchBack]}) /declare SwitchBack int local 0
/if (!${Defined[NeedToSwitch]}) /declare NeedToSwitch int local 0
/if (!${Defined[ItemName]}) /declare ItemName string outer Thunderous Drum of Karana
/if (!${Defined[ItemSlot]}) /declare ItemSlot int local ${FindItem[${ItemName}].InvSlot}
/if (${ItemSlot}==${PriSec}) /varset NeedToSwitch 1
||||||||Switch item if needed.
/squelch /twist off
:Switch
/if (${NeedToSwitch}==0) {
||||||||ItemPack is the backpack ItemName is in if it is in a backpack at all.
/if (!${Defined[ItemPack]} && ${FindItem[${ItemName}].InvSlot.Pack}) /declare ItemPack int local ${FindItem[${ItemName}].InvSlot.Pack}
/if (${Defined[ItemPack]}) /itemnotify ${ItemPack} rightmouseup
/delay 2
/itemnotify ${ItemSlot} leftmouseup
/delay 2
/itemnotify ${PriSec} leftmouseup
/delay 2
/itemnotify ${ItemSlot} leftmouseup
/delay 2
/if (${Defined[ItemPack]}) /itemnotify ${ItemPack} rightmouseup
}
||||||||Second time through this will switch the item back.
/if (${SwitchBack}==1) /return
/delay 2
||||||||Find RunSong's slot, set it to RunSlot, and twist it.
/if (!${Defined[RunSlot]}) /declare RunSlot int local
/varset RunSlot ${Me.Gem[${RunSong}]}
/if (!${RunSlot}) {
/echo ${RunSong} is not memorized.
/varset SwitchBack 1
/goto :Switch
}
/squelch /twist ${RunSlot}
/delay ${Int[${Math.Calc[(${Spell[${RunSong}].CastTime}*10)+15]}]}
||||||||Wait till the spell lands.
:Land
/if (!${Me.Buff[${RunSong}].ID}) /goto :Land
||||||||Twist off, and set SongDur to the duration of the song -10 seconds.
/squelch /twist off
/varcalc SongDur (${Spell[${RunSong}].Duration}*60)-100
||||||||Switch items back
/varset SwitchBack 1
/goto :Switch
/return
Sub Event_Pause
/if (!${Defined[Paused]}) /declare Paused int outer 0
/varset Paused 0
/echo Paused.
:Paused
/delay 1s
/doevents Unpause
/if (${Paused}==0) /goto :Paused
/return
Sub Event_Unpause
/if (!${Defined[Paused]}) /declare Paused int outer 1
/varset Paused 1
/echo Unaused.
/return


