buff macro?

Have a macro idea but not sure where to start? Ask here.

Moderator: MacroQuest Developers

Sandman
decaying skeleton
decaying skeleton
Posts: 2
Joined: Wed Jul 14, 2004 7:08 am

buff macro?

Post by Sandman » Wed Jul 14, 2004 7:17 am

looking for a macro that will let me dual box my shammy / ranga without haveing to switch between the two accounts on my one computer. A macro that would allow my ranger to /tell shaman /cast one...basicly just allow whatever i /tell shaman, for the shaman to execute. dont guess this would be verry hard...buti have no idea how you guys work your magic :-)

Rusty~
a hill giant
a hill giant
Posts: 244
Joined: Wed Apr 14, 2004 2:55 pm

Post by Rusty~ » Wed Jul 14, 2004 2:14 pm

modified some of the buff code i use.. this is just a basic example and will only work with exact spell names. to have the bot cast a buff on you:
/tell bot, cast spellname on me
to cast a spell on your target:
/tell bot, cast spellname on target

Code: Select all

#event CastSpell "[#1#] cast #2#"
#event CastSpell "[#1#] cast #2# on #3#"
#event CastSpell "#1# tells you, 'cast #2#'"
#event CastSpell "#1# told you, 'cast #2#'"
#event CastSpell "#1# tells you, 'cast #2# on #3#'"
#event CastSpell "#1# told you, 'cast #2# on #3#'"

Sub Event_CastSpell(string line,string chatSender,string spellName,string targetName)
   /if ( ${Defined[targetName]} ) {
      /if ( ${targetName.Equals[me]} ) {
         /target ${chatSender}
      } else /if ( ${targetName.Equals[target]} ) {
         /keypress clear_target
         /assist ${chatSender}
         /delay 1s ${Target.ID}
         /call Cast "${spellName}"
      } else {
         /target ${targetName}
         /call Cast "${spellName}"
      }
   } else /if ( !${line.Find[ on ]} ) {
      /call Cast "${spellName}"
   }
/return

Vexix
Genbot Janitor
Posts: 245
Joined: Sat Apr 17, 2004 10:10 am

Post by Vexix » Wed Jul 14, 2004 8:20 pm

Genbot does all that and more. Check it out:

http://macroquest2.com/phpBB2/viewtopic.php?t=7906

--Vexix

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Wed Jul 14, 2004 8:57 pm

Thing is I kind of like Rusty~s work there because I think I'll be able to modify it for my needs soon. Genbot isn't very good for PL'n since it needs to be grouped, from what I can tell.

Rusty~
a hill giant
a hill giant
Posts: 244
Joined: Wed Apr 14, 2004 2:55 pm

Post by Rusty~ » Thu Jul 15, 2004 1:09 am

here's the actual code i use in my macro... it's a bit more complicated, but does a lot more too heh. as i dont bot really, i mainly use this for self echos so i dont have to sit and mem certain spells and then cast em. i have completely separate code in my Event_Chat that handles tells for buffs from "normal" people :wink: but it also just adds the person's name and the spell to the buff queue, and is cast once CheckBuff is called, and the person is in range : :smile:

Code: Select all

#event CastSpell "[#1#] cast #2#"
#event CastSpell "[#1#] cast #2# on #3#"
#event CastSpell "#1# tells you, 'cast #2#'"
#event CastSpell "#1# told you, 'cast #2#'"
#event CastSpell "#1# tells you, 'cast #2# on #3#'"
#event CastSpell "#1# told you, 'cast #2# on #3#'"

Sub CheckBuffs
   /if ( !${Defined[buffQueue]} ) /declare buffQueue string outer
   /declare oldTarget int local ${Target.ID}
   /if ( ${buffQueue.Find[[]} ) {
      /if ( ${buffQueue.Find[[]}>1 ) /varset buffQueue ${buffQueue.Right[-${Math.Calc[${buffQueue.Find[[]}-1]}]}
      /declare buffText string local
      /declare targetName string local
      /declare spellType string local
      /declare spellRange int local 118
      /for i 1 to ${buffQueue.Count[[]}
         /varset buffText [${buffQueue.Arg[${i},[]}
         /varset spellName ${buffText.Arg[1,,].Right[-1]}
         /if ( ${spellName.Right[1].Equal["]"]} ) /varset spellName ${spellName.Left[-1]}
         /varset targetName ${buffText.Arg[2,,].Left[-1]}
         /call GetBuffName "${spellName}"
         /varset spellName ${Macro.Return.Arg[1,,]}
         /varset spellType ${Macro.Return.Arg[2,,]}
         /if ( ${spellType.Equal[item]} ) {
            /varcalc spellRange 1.18*${FindItem[${spellName}].Spell.Range}
         } else {
            /varcalc spellRange 1.18*${Spell[${spellName}].Range}
         }
         /if ( ${Bool[${spellName}]} ) {
            /if ( !${Bool[${targetName}]} ) {
               /call Cast "${spellName}" ${spellType} 4s
            } else /if ( ${Spawn[pc ${targetName}].ID} && ( ${Spawn[pc ${targetName}].Distance3D}<=${spellRange} || !${spellRange} ) ) {
               /target pc ${targetName}
               /call Cast "${spellName}" ${spellType} 4s
               /if ( ${Spawn[${oldTarget}].ID} ) {
                  /if ( ${Target.Name.Equal[${targetName}]} ) /target id ${oldTarget}
               } else {
                  /keypress clear_target
               }    
            }
            /if ( ${Macro.Return.Equal[CAST_SUCCESS]} || ${Macro.Return.Equal[CAST_CANCELLED]} ) /call DeleteFromQueue "${buffText}"
         } else {
            /call DeleteFromQueue "${buffText}"
         }
      /next i
   }

   /return

Sub GetBuffName(string spellName)
   /declare buffText string local
   /declare spellType string local 
   /if ( !${Me.Gem[4].SpellType.Equal[detrimental]} ) {
      /varset spellType gem4
   } else {
      /varset spellType gem1
   }
   /if ( ${spellName.Equal[c3]} ) /varset spellName Koadic's Endless Intellect
   /if ( ${spellName.Equal[c4]} ) {
      /varset spellName Silken Augmenter's Pantaloons
      /varset spellType item
   }
   /if ( ${spellName.Equal[mgb]} ) {
      /varset spellName Mass Group Buff
      /varset spellType alt
   }
   /if ( ${spellName.Equal[c5]} ) /varset spellName Voice of Quellious
   /if ( ${spellName.Equal[haste]} || ${spellName.Equal[sov]} || ${spellName.Equal[speed]} || ${spellName.Equal[speed of vallon]} || ${spellName.Equal[vallon]} ) {
      /varset spellName Romar's Pantaloons of Visions
      /varset spellType item
   }
   /if ( ${spellName.Equal[mr]} || ${spellName.Equal[grm]} || ${spellName.Equal[gmr]} || ${spellName.Equal[god]} || ${spellName.Equal[magic resist]} ) /varset spellName Guard of Druzzil
   /if ( ${spellName.Equal[lev]} ) /varset spellName Levitation
   /if ( ${spellName.Equal[imp invis]} ) /varset spellName Improved Invisibility
   /if ( ${spellName.Equal[invis]} ) /varset spellName Invisibility
   /if ( ${spellName.Equal[ivu]} ) /varset spellName Invisibility versus Undead
   /if ( ${spellName.Equal[rune]} ) /varset spellName Rune of Zebuxoruk
   /if ( ${spellName.Left[3].Equal[pac]} ) /varset spellName Pacification
   /if ( ${Me.Book[illusion: ${spellName}]} ) /varset spellName illusion: ${spellName}
   /if ( ${spellName.Equal[tash]} ) {
      /varset spellName Howl of Tashan
      /varset spellType gem3
   }
   /if ( ${spellName.Equal[slow]} ) {
      /varset spellName Serpent of Vindication
      /varset spellType item
   }
   /if ( ${spellName.Equal[mez]} ) {
      /if ( ${Me.Gem[glamour of kintaz]} ) {
         /varset spellName Glamour of Kintaz
      } else /if ( ${Me.Gem[sleep]} ) {
         /varset spellName Sleep
      } else /if ( ${Me.Gem[apathy]} ) {
         /varset spellName Apathy
      } else {
         /varset spellName Bliss
      }
      /varset spellType gem7
   }
   /if ( ${spellName.Left[6].Equal[dispel]} ) {
      /if ( ${Me.Gem[recant magic]} ) {
         /varset spellName Recant Magic
      } else {
         /varset spellName Wand of the Vortex
         /varset spellType item
      }
   }
   /if ( ${Int[${Me.Book[${spellName}]}]} || ${AltAbility[${spellName}].ID} || ${FindItem[${spellName}].ID} ) /return ${spellName},${spellType}
   /return

Sub AddToQueue(string buffText)
   /varset buffText [${buffText}]
   /if ( !${buffQueue.Find[${buffText}]} ) /varset buffQueue ${buffQueue}${buffText}
   /return

Sub DeleteFromQueue(string buffText)
   /declare a int local
   /declare b int local
   /declare strLeft string local
   /declare strRight string local
   /varcalc a ${buffQueue.Find[${buffText}]}-1
   /varcalc b ${buffQueue.Length}-${buffText.Length}-${a}
   /if ( ${a}>0 ) /varset strLeft ${buffQueue.Left[${a}]}
   /if ( ${b}>0 ) /varset strRight ${buffQueue.Right[${b}]}
   /varset buffQueue ${strLeft}${strRight}
/return

Sub Event_CastSpell(string line,string chatSender,string spellName,string targetName)
   /if ( ${Defined[targetName]} ) {
      /call AddToQueue "${spellName},${targetName}"
   } else /if ( !${line.Find[ on ]} ) {
      /call AddToQueue "${spellName}"
   }
/return

Sandman
decaying skeleton
decaying skeleton
Posts: 2
Joined: Wed Jul 14, 2004 7:08 am

Post by Sandman » Fri Jul 16, 2004 7:29 pm

thanks for the input :-)...cant wait for MQ2 to come back after patch to try this out...again thanks alot all

Vexix
Genbot Janitor
Posts: 245
Joined: Sat Apr 17, 2004 10:10 am

Post by Vexix » Sat Jul 17, 2004 3:28 am

No need to be grouped for genbot. Everything can be done through tells or a private channel. :cool:

--Vexix