First Macro - helps with shaman 2boxing - need suggestions

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

Moderator: MacroQuest Developers

JP5
a lesser mummy
a lesser mummy
Posts: 70
Joined: Tue Jul 06, 2004 10:32 pm

First Macro - helps with shaman 2boxing - need suggestions

Post by JP5 » Tue Jul 06, 2004 10:40 pm

This is my first macro. It involves making hotkeys with, for example:
/1 Slow This
on one character, and having the shaman in a second box react to the commands. I'm pretty familiar with event based programming, so don't think I'll have many problems with that. I might have trouble with the variable declaring/setting so would appreciate help/suggestions with that.

Again, any suggestions/fixes very much appreciated.

(The manual was very helpful, just to get that out of the way...)

Code: Select all

|Shaman 2boxing assist bot.
|Functions: Makes it so you don't have to alt tab between two eq windows.

|Instructions (needs work =p )
|Join an empty channel that has you and your shaman box in it.
|Coordinate your spells with the #events below. Change events as needed to fit your hotkeys.
|Commands from the main character are executed when the other char
|  hears the commands on its machine.

#turbo 10

|------ Cast Spell Requests------
#event RequestCast1 "#*# tells #1#:#2#, 'Slow #3#'"
#event RequestCast2 "#*# tells #1#:#2#, 'HoT #3#'"
#event RequestCast3 "#*# tells #1#:#2#, 'CH #3#'"
#event RequestCast4 "#*# tells #1#:#2#, 'Focus Buff #3#'"
#event RequestCast5 "#*# tells #1#:#2#, 'Stamina Buff #3#'"
#event RequestCast6 "#*# tells #1#:#2#, 'Regen Buff #3#'"
#event RequestCast7 "#*# tells #1#:#2#, 'Cannibalize IV'"
#event RequestCast8 "#*# tells #1#:#2#, 'Chloroblast #3#'"

|----- Other Requests ------
#event C5 "#*# tells #1#:#2#, 'C5'"
#event FollowMe '#1# tells #2#:#3#, 'Follow Me'
#event InterruptCasting "#*# tells #1#:#2#, 'Interrupt Casting'

|----- Stuff that happens to you
#event Interrupted "Your spell is interrupted"
#event OutOfRange "Your target is out of range, get closer!"
#event #1# hits you for #2# points of damage#*#"


Sub Main

/declare Spell1 outer
/declare Spell2 outer
/declare Spell3 outer
/declare Spell4 outer
/declare Spell5 outer
/declare Spell6 outer
/declare Spell7 outer
/declare Spell8 outer
/declare Channel outer
/declare ChannelNum outer

|----- Names of Spells. Feel free to customize.
/varset Spell1 "Togor's Insects"
/varset Spell2 Quiessence
/varset Spell3 "Kragg's Mending"
/varset Spell4 "Focus of Soul"
/varset Spell5 "Talisman of the Brute"
/varset Spell6 Regrowth
/varset Spell7 "Cannibalize IV"
/varset Spell8 Chloroblast
|----- Other stuff
/varset Channel 2boxshaman
/varset ChannelNum 4


|----- Loop that checks for Spell Requests
:mainloop
  /doevents
  /delay 0.5s
  /goto :mainloop
/return

Sub Event_RequestCast1(string Line, string ChannelName, string ChannelNumber, string Target)
  /keypress Esc
  /stand
  /target ${Target}
  /cast @Spell1
  /echo Casting @Spell1 Now
  /${ChannelNumber} Casting @Spell1 Now
/return

Sub Event_RequestCast2(string Line, string ChannelName, string ChannelNumber, string Target)
  /keypress Esc
  /stand
  /target ${Target}
  /cast @Spell2
  /echo Casting @Spell2 Now
  /${ChannelNumber} Casting @Spell2 Now
/return

Sub Event_RequestCast3(string Line, string ChannelName, string ChannelNumber, string Target)
  /keypress Esc
  /stand
  /target ${Target}
  /cast @Spell3
  /echo Casting @Spell3 Now
  /${ChannelNumber} Casting @Spell3 Now
/return

Sub Event_RequestCast4(string Line, string ChannelName, string ChannelNumber, string Target)
  /keypress Esc
  /stand
  /target ${Target}
  /cast @Spell4
  /echo Casting @Spell 4 Now
  /${ChannelNumber} Casting @Spell4 Now
/return 

Sub Event_RequestCast5(string Line, string ChannelName, string ChannelNumber, string Target)
  /keypress Esc
  /stand
  /target ${Target}
  /cast @Spell5
  /echo Casting @Spell5 Now
  /${ChannelNumber} Casting @Spell5 Now
/return

Sub Event_RequestCast6(string Line, string ChannelName, string ChannelNumber, string Target)
  /keypress Esc
  /stand
  /target ${Target}
  /cast @Spell6
  /echo Casting @Spell6 Now
  /${ChannelNumber} Casting @Spell6 Now
/return

|----- This is a self only spell, so no targeting is done. 
|----- Therefore string Target not needed in Sub Event_RequestCast7
Sub Event_RequestCast7(string Line, string ChannelName, string ChannelNumber)
  /stand
  /cast @Spell7
  /echo Casting @Spell7 Now
  /${ChannelNumber} Casting @Spell7 Now
/return

Sub Event_RequestCast8(string Line, string ChannelName, string ChannelNumber, string Target)
  /keypress Esc
  /stand
  /target ${Target}
  /cast @Spell8
  /${ChannelNumber} Casting @Spell8 Now
/return

Sub Event_Interrupted
  /echo Spell Interrupted. 
  /@ChannelNum Spell Interrupted. Please investigate.
/return

Sub Event_InterruptCasting(string Line, string ChannelName, string ChannelNumber)
  /keypress D
  /keypress D
  /${ChannelNumber} Executed Spell Interrupt.
/return

|**---- this Sub_Event is weird.. because there is no #*# in front,
        I don't know if I have to have a string Line before all the other strings
**|

Sub Event_FollowMe(string FollowThisGuy, string ChannelName, string ChannelNumber)
  /keypress Esc
  /target ${FollowThisGuy}
  /face
  /follow
  /echo Following ${FollowThisGuy}
  /${ChannelNumber} Following ${FollowThisGuy}
/return

Sub Event_C5(string Line, string ChannelName, string ChannelNumber)
  /if ${Me.AltAbilityReady[47]}==TRUE {
    /alt activate 47
    } else {
      /echo Canni 5 not ready.
      /${ChannelNumber} Canni 5 not ready.
/return

JP5
a lesser mummy
a lesser mummy
Posts: 70
Joined: Tue Jul 06, 2004 10:32 pm

Post by JP5 » Wed Jul 07, 2004 12:15 am

One problem is after I set my variables such as Spell1, I refer to the variables by using @Spell1. I think this might be old MQ syntax.

Would probably make sense to #declare Spell1 "Togor's Insects", and then instead of saying /cast @Spell1, I could say /cast Spell1, and it would still work.

This removes the need for any /declare and /varset, and that doesn't feel right. Input?

JP5
a lesser mummy
a lesser mummy
Posts: 70
Joined: Tue Jul 06, 2004 10:32 pm

Post by JP5 » Wed Jul 07, 2004 12:31 am

Another self debug...

From MacroQuest Manual..
The first parameter in the sub will be the entire line itself... 1 starts AFTER that.
Therefore,

Code: Select all

|**---- this Sub_Event is weird.. because there is no #*# in front, 
        I don't know if I have to have a string Line before all the other strings 
**| 

Sub Event_FollowMe(string FollowThisGuy, string ChannelName, string ChannelNumber) 
  /keypress Esc 
  /target ${FollowThisGuy} 
  /face 
  /follow 
  /echo Following ${FollowThisGuy} 
  /${ChannelNumber} Following ${FollowThisGuy} 
/return
changes to..

Code: Select all

Sub Event_FollowMe(string Line, string FollowThisGuy, string ChannelName, string ChannelNumber) 
  /keypress Esc 
  /target ${FollowThisGuy} 
  /face 
  /follow 
  /echo Following ${FollowThisGuy} 
  /${ChannelNumber} Following ${FollowThisGuy} 
/return
--------------------

another thing that might need fixed is my use of /if

From what I know, the parameters defined in /if have to be in parentheses.

My current code doesn't have that, as you can see.

Code: Select all

Sub Event_C5(string Line, string ChannelName, string ChannelNumber) 
  /if ${Me.AltAbilityReady[47]}==TRUE { 
    /alt activate 47 
    } else { 
      /echo Canni 5 not ready. 
      /${ChannelNumber} Canni 5 not ready. 
/return 
That should change to

Code: Select all

  /if (${Me.AltAbilityReady[47]}==TRUE) {
     do this shit }