Util Macro (v1.0.0 - 2004-06-26)

Post your completed (working) macros here. Only for macros using MQ2Data syntax!

Moderator: MacroQuest Developers

wolf5
a ghoul
a ghoul
Posts: 89
Joined: Wed Jun 02, 2004 12:58 pm

Util Macro (v1.0.0 - 2004-06-26)

Post by wolf5 » Sat Jun 26, 2004 12:46 pm

This is a util macro I created. I intend to fill it up with new utils as time goes. I have created 4 hotkeys for the 4 utils that I use for my beastlord.

Code is here: http://www.halsvik.net/d/?/public/util.mac

-Wolf5

Code: Select all

| Macro: util.mac v1.0.1 - 2004-07-05
| This macro is drawn out from Natural Beastlord Hunter. It's purpose is to grow
|  and be a utility macro. 
| It contains 4 "utilities" so far (best suited for Beastlords atm).
|
| "/macro util 1" will buff yourself with buffs from your list.
| "/macro util 2" will create pet and buff it up
| "/macro util 3" will buff self, create pet and buff it up
| "/macro util 4" will heal yourself up to max.
|
| Just make hotkeys in EQ to run these :-)

#include spellcast.inc

#define HEAL_BELOW_PCT 90
#define HEAL_SPELL "Healing"
#define HEAL_GEM 4

#define HEAL_PET_BELOW_PCT 70
#define HEAL_PET_SPELL "Sha's Restoration"
#define HEAL_PET_GEM 5

#define PET_SPELL "Spirit of Zehkes"
#define PET_GEM 7

|----------------------------------------------------------------------------
|SUB: Main - Declarations and Initialization
|----------------------------------------------------------------------------
Sub Main

    |Buffs to be kept up on self (max 15) - "Buff" or "Buff|GemSlot"
    /declare MyBuffs[7] string outer 
    /varset MyBuffs[1] "Spirit of Wolf|8" 
    /varset MyBuffs[2] "Chloroplast|6" 
    /varset MyBuffs[3] "Deftness|4" 
    /varset MyBuffs[4] "Furious Strength|4" 
    /varset MyBuffs[5] "Spiritual Radiance|3" 
    /varset MyBuffs[6] "Health|3" 
    /varset MyBuffs[7] "Frenzy|6" 
    
    |Buffs to be kept up on petf (max 15) - "Buff" or "Buff|GemSlot"
    /declare PetBuffs[4] string outer 
    /varset PetBuffs[1] "Spirit of Wolf|8" 
    /varset PetBuffs[2] "Bond of the Wild|3" 
    /varset PetBuffs[3] "Spirit of the Storm|6" 
    /varset PetBuffs[4] "Deftness|4" 

    /if ( ${Param0.Equal["1"]}) {
	    /call MaintainSelfBuffs
	    /echo DONE BUFFING ME
	}
    /if ( ${Param0.Equal["2"]}) {
        /call MaintainPetBuffs
	    /echo DONE BUFFING PET
    }
    /if ( ${Param0.Equal["3"]}) {
        /call MaintainPetBuffs
	    /call MaintainSelfBuffs
	    /echo DONE BUFFING ALL
	}

    /if ( ${Param0.Equal["4"]}) {
   	    /call HealMyself
   	    /echo Done healing
   	}

/return




|----------------------------------------------------------------------------
|SUB: HealPet - Heal pet if needed
|----------------------------------------------------------------------------
Sub HealPet
    |Heal pet?
    /if ( ${Me.Pet.PctHPs}<HEAL_PET_BELOW_PCT ) {
        /if ( ${Me.Pet.ID} ) {
            /target ${Me.Pet.CleanName}
            /call Cast "HEAL_PET_SPELL" gemHEAL_PET_GEM
            /if ( !${Me.Sitting} ) /sit
            /return 0
        }
    }
/return 1


|----------------------------------------------------------------------------
|SUB: HealMyself
|----------------------------------------------------------------------------
Sub HealMyself
    |Heal?
    /if ( ${Me.PctHPs}<HEAL_BELOW_PCT ) {
:AGAIN
        /if ( !${Target.Name.Equal[${Me.Name}]} ) /target ${Me.Name}
        /call Cast "HEAL_SPELL" gemHEAL_GEM
        |/if ( !${Me.Sitting} ) /sit
        |/keypress ESC
        /delay 1
        /if ( ${Me.PctHPs}<HEAL_BELOW_PCT ) /goto :AGAIN
        /return 0
    }
/return 1



|----------------------------------------------------------------------------
|SUB: MaintainPetBuffs - Heal pet and keep its buffs up
|----------------------------------------------------------------------------
Sub MaintainPetBuffs
        /if ( !${Me.Pet.ID} ) {
            /echo Creating new pet
            /call Cast "PET_SPELL" gemPET_GEM
            /return 0
        }
        |KeepUpBuffsOnPet
	    /declare iCount int local
	    /declare t string local
	    /for iCount 1 to ${PetBuffs.Size} 
	      /call SplitString tmp_tmp ${PetBuffs[${iCount}]} "|"
	      /varset t ${Me.PetBuff[${tmp_tmp[1]}]}
	      /if ( ${t.Equal[NULL]} ) {
	         /if ( !${Target.ID}!=${Me.Pet.ID} ) {
	         	/target ${Me.Pet.Name}
	         }
	         |Cast with gemselection or default
	         /if ( ${tmp_tmp.Size}>1 ) {
	             /call Cast "${tmp_tmp[1]}" gem${tmp_tmp[2]}
	         } else {
	             /call Cast "${tmp_tmp[1]}"
	         }
	         |/delay 5 
	         |Return to top - so we dont keep buffing if being attacked
	         |/return 0
	      } 
	    /next iCount
/return 1


|----------------------------------------------------------------------------
|SUB: MaintainSelfBuffs - Keep buffs up
|----------------------------------------------------------------------------
Sub MaintainSelfBuffs
    |KeepUpBuffsOnMe
    /declare iCount int local
    /declare t string local
    /for iCount 1 to ${MyBuffs.Size} 
      /call SplitString tmp_tmp ${MyBuffs[${iCount}]} "|"
      /varset t ${Me.Buff[${tmp_tmp[1]}]}
      /if ( ${t.Equal[NULL]} ) {
         /if ( !${Target.ID}!=${Me.ID} ) {
         	/target ${Me.Name}
         }
         |Cast with gemselection or default
         /if ( ${tmp_tmp.Size}>1 ) {
             |/echo Cast "${tmp_tmp[1]}" gem${tmp_tmp[2]}
             /call Cast "${tmp_tmp[1]}" gem${tmp_tmp[2]}
         } else {
             |/echo Cast "${tmp_tmp[1]}"
             /call Cast "${tmp_tmp[1]}"
         }
         |/delay 5 
         |Return to top - so we dont keep buffing if being attacked
         |/return 0
      } 
    /next iCount

/return 1


|----------------------------------------------------------------------------
|SUB: SplitString - A generic string splitter.
|----------------------------------------------------------------------------
Sub SplitString(string varname, string inputstring, string splitter)
    |A variable with name in varname will be declared and filled
    /declare i int local
    /declare i2 int local
    /declare c int local
    /declare stringcnt int local

    /varcalc stringcnt ${inputstring.Count["|"]} + 1
    
    /if (!${Defined[${varname}]}) { 
        /declare ${varname}[${stringcnt}] string global
    } else {
        /deletevar ${varname}
        /declare ${varname}[${stringcnt}] string global
    }
    
    /varset c 1
:nextsubstring
    /varcalc i ${inputstring.Find["${splitter}"]} - 1
    |/echo ${inputstring}:${splitter} ${inputstring.Find["${splitter}"]}
    /if ( ${i}>-1 ) {
    	|/echo iii: ${inputstring.Length} ${inputstring} ${i}
        | /varcalc i2 ${inputstring.Length} - ${i} +1
         /varcalc i2 ${inputstring.Length} - ${i} - 1
        | /varcalc i2 ${inputstring.Length} - ${i} - 1 BUGFIX?????
        /varset ${varname}[${c}] ${inputstring.Left[${i}]}
        /varcalc c ${c} + 1
        |/echo stringarray[${c}] ${inputstring.Left[${i}]}

        /varset inputstring ${inputstring.Right[${i2}]}
         
         /goto :nextsubstring

     } else {
          |/echo stringarray[${c}] ${inputstring}
          /varset ${varname}[${c}] ${inputstring}
     }

/return
Last edited by wolf5 on Mon Jul 05, 2004 4:21 pm, edited 1 time in total.

Drumstix42
a grimling bloodguard
a grimling bloodguard
Posts: 808
Joined: Mon May 03, 2004 4:25 pm

Post by Drumstix42 » Sat Jun 26, 2004 8:35 pm

This is similar to what I have in the making, except it's much more personalized, with spell sets and such.

Wondering if you would mind me using some of your code to help me better organize my code.

Much thanx to you if so.

wolf5
a ghoul
a ghoul
Posts: 89
Joined: Wed Jun 02, 2004 12:58 pm

Post by wolf5 » Sun Jun 27, 2004 3:52 am

Go ahead. I don't enforce any copyrights on my stuff :smile: .

-Wolf5

Drumstix42
a grimling bloodguard
a grimling bloodguard
Posts: 808
Joined: Mon May 03, 2004 4:25 pm

Post by Drumstix42 » Sun Jun 27, 2004 4:59 pm

Heh, the thing with mine, was it was just a simple strait out macro for getting otu pet, buffing it, and myself.

But not on all occasions wouldn I need to buff both of us.

THen I made a simple rebuff macro, but thought if i did it that way I'll end up with 500 macros for doing a few differething things.

The thing I need to do is just make some Subs....
becaus I think I'm abusing the /goto :Someplace WAY too much :twisted:

I mean, hey it works, and uses less lines probably. But it gets confusin after a while ;)

Older version exampl:

Code: Select all

|-- 1 : No Pet (Stun) Proc
|-- 2 : We're Inside
|-- 3 : Self-Only (Outside)
|-- 4 : Self-Only (Inside)
|-- 5 :
|-- 6 : Pet-Only (Inside)
|-- 0 : Help

#include SPELLCAST.inc

Sub Main
   /if (${Param0}==0) {
      /echo |-- 1 : No Pet (Stun) Proc
      /echo |-- 2 : We're Inside
      /echo |-- 3 : Self-Only (Outside)
      /echo |-- 4 : Self-Only (Inside)
      /echo |-- 5 :
      /echo |-- 6 : Pet-Only (Inside)
      /echo |-- 0 : Help
      /endmac
   }
   /echo Lets get ready for battle
   /if (${Param0}==3) {
      /echo Self-Buffs (OutSide)
      /goto :SelfOutside
   }
   /if (${Param0}==4) {
      /echo Self-Buffs (Inside)
      /goto :SelfInside
   }
   /if (${Param0}==6) {
      /echo Pet-Buffs (Inside)
      /goto :PetInside
   }
   /if (${Param0}==1) /echo -No Pet (Stun) Proc (Using Vermin)
   :MedLoop
    /if (${Me.PctMana}<85) {
       /echo Medding...
       /if (${Me.Standing}) /sit
       /delay 10s
       /goto :MedLoop
   }
   /if (!${Me.Standing} && !${Me.Mount.ID}>0) /stand
   /if (${Me.Moving}) {
       /keypress forward
       /keypress back
       /delay 8
   } else {
       /delay 4
   }
   :SelfOutside
   /if (!${Me.Mount.ID}>0&&${Param0}!=2) {
       /itemnotify Ammo rightmouseup
       :WaitForCast
        /if (${Me.Casting.ID}) /goto :WaitForCast
       /echo Hello Drogster!
   } else {
      /if (${Param0}==2) {
         /echo No Mounts Inside
      } else {
         /echo Drogster is already out.
      }
   }
   /delay 1s
   /if (${Param0}==3) /goto :SelfInside
|---------------------------------------------------------------
   :PetInside
   /if (${Window[SpellBookWnd].Open}) /book
   /memspellset 5
   :SpellBookOpen
    /delay 5
    /if (${Window[SpellBookWnd].Open}) /goto :SpellBookOpen
   /delay 1s
|---------------------------------------------------------------
   /if (${Me.Pet.ID}>0) {
      /echo Pet is already out.
   } else {
      /memspellset 4
      :SpellBookTwo
       /delay 5
       /if (${Window[SpellBookWnd].Open}) /goto :SpellBookTwo
      /delay 1s
|---------------------------------------------------------------
      :Pet
       /delay 2s ${Me.SpellReady["Spirit of Arag"]}
       /if (!${Me.SpellReady["Spirit of Arag"]}) /goto :Pet
      /call cast "Spirit of Arag"
      /delay 1s
|---------------------------------------------------------------
      /memspellset 5
      :SpellBookThree
       /delay 5
       /if (${Window[SpellBookWnd].Open}) /goto :SpellBookThree
      /delay 1s
   }
|---------------------------------------------------------------
   /target pet
   /echo Pet buffs...
   /call cast "Dexterity"
   /call cast "Stamina"
   /call cast "Shifting Shield"
   /call cast "Furious Strength"
   /call cast "Talisman of Kragg"
   /if (${Param0}==1) {
      /call cast "Spirit of Vermin" gem8
   } else {
      /call cast "Spirit of the Storm"
   }
   /delay 1s
   /if (${Param0}==6) /goto :PetTwoInside
|---------------------------------------------------------------
   :SelfInside
   /if (${Param0}==4||${Param0}==3) {
      /memspellset 5
      :SpellBookInside
       /delay 5
       /if (${Window[SpellBookWnd].Open}) /goto :SpellBookInside
      /delay 1s
   }
   /target myself
   /echo Self buffs...
   /call cast "Dexterity"
   /call cast "Stamina"
   /call cast "Shifting Shield"
   /call cast "Furious Strength"
   /call cast "Talisman of Kragg"
   /delay 1s
   /if (${Param0}==4) /goto :SelfTwoInside
|---------------------------------------------------------------
   /memspellset 1
   :SpellBookFour
    /delay 5
    /if (${Window[SpellBookWnd].Open}) /goto :SpellBookFour
   /delay 1s
|---------------------------------------------------------------
   :PetTwoInside
   /target pet
   /call cast "Spiritual Strength" gem5
   /if (${Param0}!=2&&${Param0}!=6) /call cast "Spirit of Wolf" gem4
   /call cast "Infusion of Spirit" gem3
   /if (${Param0}==6) /goto :PetThreeInside
   :SelfTwoInside
   /target myself
   /call cast "Spiritual Vigor" gem5
   /if (${Param0}!=2&&${Param0}!=4) /call cast "Spirit of Wolf" gem4
   /call cast "Infusion of Spirit" gem3
   /delay 1s
|---------------------------------------------------------------
   /target myself
   /call cast "Frenzy" gem2
   /memspellset 7
   :Chloroplast
    /delay 2s
    /if (!${Me.SpellReady["Chloroplast"]}) /goto :Chloroplast
   /call cast "Chloroplast"
   /if (${Param0}==4) /goto :SelfThreeInside
   /target pet
   /call cast "Chloroplast"
   /delay 1s
|---------------------------------------------------------------
   :PetThreeInside
   :SelfThreeInside
   /memspellset 1
   :SpellBookFive
    /delay 5
    /if (${Window[SpellBookWnd].Open}) /goto :SpellBookFive
   /delay 1s
   /if (${Param0}==4) /goto :SelfFourInside
|---------------------------------------------------------------
   /target pet
   /call cast "Sha's Ferocity"
   /delay 1s
   /if (${Param0}==6) /goto :PetFourInside
|---------------------------------------------------------------
   :SelfFourInside
   /target myself
   /call cast "Alacrity"
   /delay 1s
   :PetFourInside
   /echo Done!
/return
Like I said, personal use :)

wolf5
a ghoul
a ghoul
Posts: 89
Joined: Wed Jun 02, 2004 12:58 pm

Post by wolf5 » Sun Jun 27, 2004 5:38 pm

Keeping the code subbified can sometime help a lot on readability + the reusability is so much better :smile:

I'm just an casual EQ player - but programmer by profession, so I'll probably add code to the Util once in a (great) while, but the util might be a kickoff macro for some ppl. Just expand them to their own usage.

Keep it structured + commented and maybe post their "spinoffs" at this forum. That way people can grab a little from here and little from there and have a nice Util tailored for themselves.

-Wolf5

DumbStruck
a ghoul
a ghoul
Posts: 125
Joined: Fri Apr 30, 2004 8:46 am

Post by DumbStruck » Mon Jul 05, 2004 3:14 pm

WOLF you forgot about this mac i used it loved it now its at the bottom of the pile hehe .. i used this last night went into a never ending loop . only way to get out was to /unload and restart mq2 any ideas why ..


I dont know how i ever played eq with out mq2 . i started playing before kunark release and just learned about mq2 damnit .. all the good times i could of had hehe .

wolf5
a ghoul
a ghoul
Posts: 89
Joined: Wed Jun 02, 2004 12:58 pm

Post by wolf5 » Mon Jul 05, 2004 4:19 pm

Did it happen only once? If so I don't know why. Depends on which util u used.

Also. I did a change to the Sub SplitString in NBH.mac because of some changes. Have made the same change to util: http://halsvik.net/d/?/public/util.mac
(old one http://halsvik.net/d/?/public/util_1.0.0.mac )

It is not tested.

-Wolf5