Twist one song?

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

Banannaboy
a lesser mummy
a lesser mummy
Posts: 43
Joined: Tue Apr 13, 2004 9:59 pm

Twist one song?

Post by Banannaboy » Sat May 01, 2004 2:18 am

Hey - I currently use this as my macro and Im wondering it it would be possible to make it so if im only twisting one song - it wont stop it and start it, it will just play it continuously without stopping. My macro is the following:

Code: Select all

| - twist.mac - 
| 
| Modified from Colonel's Macro by ml2517 
| 
| Modified to current form 4/29/2004
| Updated by Banannaboy 
| 
|  Combat Twist Order (Optional) --+   <- If you don't feed it a second 
|  NonCombat Twist Order -----+    |      spell set it works with just 
|                             |    |      one set. 
| Usage:                      v    v 
|           /macro twist.mac ### [###] 
| # represents the spell gem number you'd like to sing
|   
|          /echo Drop Anchor
|  Drops an anchor (at your current location) to move to after every fight.
|
|          /echo Set Tank
|  Sets tank to your current target. The tank is the person you will be assisting.
|
| This macros originally twisted combat and non combat songs. It has been modified to twist
|  combat and noncombat songs, assist tank to find target, attack and follow target, and then return
|  to anchor after every fight.
| 
| Example: 
| /macro twist.mac 4567 123456 
| /macro twist.mac 123458 

#Event destroy "You have scrounged up something that doesn't look edible."
#Event move "Your target is too far away, get closer!"
#Event anchor "Drop Anchor"
#Event back "You cannot see your target."
#Event exp "You gain party experience!!"
#Event tank "Set Tank"

Sub Main(NonCombatGems,CombatGems) 
    /if (!${Defined[NonCombatGems]}) /endmacro 

| 
|  Variable Declarations 
| 
    /declare CombatCurSong int outer 
    /declare NonCombatCurSong int outer 
    /declare NNonCombatSongs int outer 
    /declare NCombatSongs int outer 
    /declare NonCombatSongList int outer 
    /declare CombatSongList int outer 
    /declare TwistI int outer 
    /declare TwistJ int outer 
    /declare DynamicBuffer int outer 
    /declare NonCombatSongArray[30] int outer 
    /declare CombatSongArray[30] int outer
    /declare AnchorX int outer
    /declare AnchorY int outer
    /declare tank string outer 

| 
|  Timer Declarations 
| 
    /declare SingTime timer outer 


    /varset CombatCurSong 1 
    /varset NonCombatCurSong 1 
    /varset NNonCombatSongs ${String[${NonCombatGems}].Length} 
    /if (${Defined[CombatGems]}) /varset NCombatSongs ${String[${CombatGems}].Length} 
    /varset NonCombatSongList ${NonCombatGems} 
    /if (${Defined[CombatGems]}) /varset CombatSongList ${CombatGems} 
    /varset DynamicBuffer 5
    /varset AnchorX 0
    /varset AnchorY 0
    /varset tank none 

    /for TwistI 1 to ${NNonCombatSongs} 
        /varcalc TwistJ ${TwistI} 
        /varset NonCombatSongArray[${TwistI}] ${String["${NonCombatSongList}"].Mid[${TwistJ},1]} 
    /next TwistI 
    /if (${Defined[CombatGems]}) { 
        /for TwistI 1 to ${NCombatSongs} 
            /varcalc TwistJ ${TwistI} 
            /varset CombatSongArray[${TwistI}] ${String["${CombatSongList}"].Mid[${TwistJ},1]} 
        /next TwistI 
    } 
    :Loop 
    /if (${Me.Standing}) { 
        /if (${Defined[CombatGems]}) /if (${Me.Combat}) /call CombatSing ${CombatSongArray[${CombatCurSong}]} 
        /if ((!${Me.Combat})||(!${Defined[CombatGems]})) /call NonCombatSing ${NonCombatSongArray[${NonCombatCurSong}]} 
    } 
   /if (${Me.State.Equal["DUCK"]}) /keypress DUCK 
   /if (!${Me.Standing}) /stand 
   /goto :Loop 
/return 


Sub CombatSing(Song) 
     /declare Buffer int local 
     /declare Duration int local 
     /varset Duration 0 

  :CombatSing1 
    /call CheckSong ${Song} 
    /varset Duration ${Macro.Return} 
    /varset SingTime 30 
    /varset Buffer 0    
    /cast "${Me.Gem[${Song}]}" 
    /doevents
    /call GetBehind
  :CombatSing2 
    /delay 1
    /doevents 
    /if (${Me.Casting.ID}) { 
        /if (${SingTime}<=0) /goto :CombatSingBreak 
        /goto :CombatSing2 
    } 
    :CombatSingBreak 
    /if (${SingTime}>0) /goto :CombatSing1 
    /if (${Duration}==0) { 
        /delay ${DynamicBuffer} 
        /stopsong 
    } else { 
      :CombatSing3 
        /varcalc Buffer ${Buffer}+1 
        /delay 1 
        /if (${Buffer}>8) { 
        /stopsong 
        /goto :CombatSing1 
        } 
        /if ((!${Me.Song["${Me.Gem[${Song}]}"].ID})&&(!${Me.Buff["${Me.Gem[${Song}]}"].ID})) /goto :CombatSing3 
        /if ((${Me.Song["${Me.Gem[${Song}]}"].Duration}<${Math.Calc[${Duration}-1]})&&(${Me.Buff["${Me.Gem[${Song}]}"].Duration}<${Math.Calc[${Duration}-1]})) /goto :CombatSing3 
        /varset DynamicBuffer ${Buffer} 
        /stopsong 
    } 
|    /echo Dynamic Buffer: ${DynamicBuffer} 
    /varcalc CombatCurSong ${CombatCurSong}+1 
    /if (${CombatCurSong}>${NCombatSongs}) /varset CombatCurSong 1 
/return 


Sub NonCombatSing(Song) 
     /declare Buffer int local 
     /declare Duration int local 
     /varset Duration 0 

  :NonCombatSing1 
    /call CheckSong ${Song} 
    /varset Duration ${Macro.Return} 
    /varset SingTime 30 
    /varset Buffer 0    
    /cast "${Me.Gem[${Song}]}"
    /doability "Forage"
    /doevents
    /autoinventory
    /newif (${String[${tank}].Equal[none]}) {
      /goto :skip
    }
    /assist ${tank}
    /newif (${Target.PctHPs}<=96 && ${String[${Target.Type}].Equal[NPC]}) {
      /attack on
    }
    :skip  
  :NonCombatSing2 
    /delay 1 
    /if (${Me.Casting.ID}) { 
        /if (${SingTime}<=0) /goto :NonCombatSingBreak 
        /goto :NonCombatSing2 
    } 
    :NonCombatSingBreak 
    /if (${SingTime}>0) /goto :NonCombatSing1 
    /if (${Duration}==0) { 
        /delay ${DynamicBuffer} 
        /stopsong 
    } else { 
      :NonCombatSing3 
        /varcalc Buffer ${Buffer}+1 
        /delay 1 
        /if (${Buffer}>8) { 
        /stopsong 
        /goto :NonCombatSing1 
        } 
        /if ((!${Me.Song["${Me.Gem[${Song}]}"].ID})&&(!${Me.Buff["${Me.Gem[${Song}]}"].ID})) /goto :NonCombatSing3 
        /if ((${Me.Song["${Me.Gem[${Song}]}"].Duration}<${Math.Calc[${Duration}-1]})&&(${Me.Buff["${Me.Gem[${Song}]}"].Duration}<${Math.Calc[${Duration}-1]})) /goto :NonCombatSing3 
        /varset DynamicBuffer ${Buffer} 
        /stopsong 
    } 
|    /echo Dynamic Buffer: ${DynamicBuffer} 
    /varcalc NonCombatCurSong ${NonCombatCurSong}+1 
    /if (${NonCombatCurSong}>${NNonCombatSongs}) /varset NonCombatCurSong 1 
/return 

Sub CheckSong(GemNumber) 
/if (${Me.Gem[${GemNumber}].SpellType.Find["Beneficial"]}) { 
    /if (${Me.Gem[${GemNumber}].TargetType.Find["Group"]} || ${Me.Gem[${GemNumber}].TargetType.Find["Self"]} || ${Me.Gem[${GemNumber}].TargetType.Find["PC"]}) { 
        /return ${Me.Gem[${GemNumber}].Duration} 
    } else { 
        /return 0 
    } 
} else { 
    /return 0 
} 
/return 

Sub Event_destroy
  /echo Destroying ${Cursor.Name}
  /destroy
/return

Sub Event_move
  /doevents flush
  /keypress forward hold
  :Checker
  /face fast nolook
  /newif (${Target.Distance}<=15) {
    /face fast nolook
    /keypress forward
    /return
  }
  /goto :Checker
/return

Sub Event_anchor
  /varset AnchorX ${Me.X}
  /varset AnchorY ${Me.Y}
  /echo Anchor dropped at ${AnchorX} , ${AnchorY}
/return

Sub Event_back
  /face fast nolook
/return

Sub Event_exp
/newif (${AnchorX}==0 || ${AnchorY}==0) {
  /echo No anchor is set.
  /return
}
  :AnchorMoveLoop 

   /newif (${Me.State.NotEqual[STAND]}) /stand 
   /face nolook loc ${AnchorY},${AnchorX} 
   /newif (${Math.Distance[${AnchorY},${AnchorX}]}>5) /keypress forward hold 
   /newif (${Math.Distance[${AnchorY},${AnchorX}]}<=5) { 
      /keypress forward 
      /newif (${Me.State.NotEqual[STAND]}) /stand 
      /face away nolook loc ${AnchorY},${AnchorX} 
      /return 
} 
    /goto :AnchorMoveLoop 
/return

Sub Event_tank
  /echo Setting tank...
  /varset tank ${Target}
  /echo Tank set to ${tank}
/return

Sub GetBehind 
   /if (${Target.ID}==0) { 
      /keypress forward 
      /goto :nomob 
   } 
   /if (${Math.Distance[${Math.Calc[${Target.Y}-${Math.Cos[${Target.Heading.DegreesCCW}]}*10]},${Math.Calc[${Target.X}-${Math.Sin[${Target.Heading.DegreesCCW}]}*10]}]}<4) /goto :noneed 
   /face nolook fast loc ${Math.Calc[${Target.Y}-${Math.Cos[${Target.Heading.DegreesCCW}]}*10]},${Math.Calc[${Target.X}-${Math.Sin[${Target.Heading.DegreesCCW}]}*10]} 
   /keypress forward hold 
   :gobehindloop 
   /delay 1 
   /if (${Target.ID}==0) { 
      /keypress forward 
      /goto :nomob 
   } 
   /face nolook fast loc ${Math.Calc[${Target.Y}-${Math.Cos[${Target.Heading.DegreesCCW}]}*10]},${Math.Calc[${Target.X}-${Math.Sin[${Target.Heading.DegreesCCW}]}*10]} 
   /if (${Math.Distance[${Math.Calc[${Target.Y}-${Math.Cos[${Target.Heading.DegreesCCW}]}*10]},${Math.Calc[${Target.X}-${Math.Sin[${Target.Heading.DegreesCCW}]}*10]}]}>3) /goto :gobehindloop 
   /keypress forward 
   :noneed 
   /face nolook fast
   :nomob 
/return 

Oid
a snow griffon
a snow griffon
Posts: 416
Joined: Thu Oct 17, 2002 3:26 am
Contact:

Post by Oid » Sat May 01, 2004 9:54 am

/macro twist 11?
Smokey the Lax says only you can prevent reproduction.

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Sat May 01, 2004 10:14 am

I understand this request, he just wants it to keep playing the same song that is being played if the next song in the list is the same. I'll mess around with the code and see what I can do. BTW: You really need to grab my latest version and hack your stuff back into it. I had a few major flaws in the version you modified.

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Sat May 01, 2004 11:48 am

Ok I looked into this and its just way too f'd up to try to get the timing right on the pulses that you are just letting carry through in regards to this macro. Just be a good bard and stay standing at all times. If you need to set down to med just pause the macro, start the song you want and sit down.

Space-Boy
a hill giant
a hill giant
Posts: 242
Joined: Wed Dec 04, 2002 12:53 pm
Contact:

Post by Space-Boy » Sat May 01, 2004 5:14 pm

or you can just do what i do =) this works exactly like ya want, ill post code later when im at home


take the autorogue macro, and hack out all the rogue crap so its just pure melee

get the latest twist plugin and compile it

set a spot in the macro in the combat section to begin twisting via the twist command

do the same thing in the no combat section.... if you just want one song youcan make it say /twist hold (gem #) etc

i actually have mine set up to take parameters for the combat set and the no combat set =)

<3 afk barding =)
har
You have gotten better at Carpal Tunnel! (247)