DoCast - Item Swaping on certain spell casts

A forum for macro code snippets to be used in writing other macros. Post routines or .inc files here only, completed macros go to the Macro Depot. MQ2Data format only!

Moderator: MacroQuest Developers

User avatar
Night Hawk
a grimling bloodguard
a grimling bloodguard
Posts: 590
Joined: Fri Aug 13, 2004 4:56 pm

DoCast - Item Swaping on certain spell casts

Post by Night Hawk » Sun Oct 31, 2004 1:43 pm

Ok here's another of my little snippets. I used to use a spell haste item, but have gotten an upgrade since. Switchin gear everytime you wanna cast buffs or certain spell plain sucks, and my plugin knowledge is next to nothing. I might suggest someone make this in a plugin as it would be much more efficent.


Firstly I use the NUMPAD for my spell casting (1-9). So I unbound all my normal EQ binds to them. I set up 9 CustomBinds with MQ2CustomBinds then bound them to Num_1 through Num_9.

Here's to make things easier for all of you bums!
/custombind add cast1
/custombind add cast2
/custombind add cast3
/custombind add cast4
/custombind add cast5
/custombind add cast6
/custombind add cast7
/custombind add cast8
/custombind add cast9
/custombind set cast1 /docommand /mac docast 1
/custombind set cast2 /docommand /mac docast 2
/custombind set cast3 /docommand /mac docast 3
/custombind set cast4 /docommand /mac docast 4
/custombind set cast5 /docommand /mac docast 5
/custombind set cast6 /docommand /mac docast 6
/custombind set cast7 /docommand /mac docast 7
/custombind set cast8 /docommand /mac docast 8
/custombind set cast9 /docommand /mac docast 9
/bind cast1 Num_1
/bind cast2 Num_2
/bind cast3 Num_3
/bind cast4 Num_4
/bind cast5 Num_5
/bind cast6 Num_6
/bind cast7 Num_7
/bind cast8 Num_8
/bind cast9 Num_9
I use Shroud of the Nimble as my default shoulder item, and Mantle of the Rainmaker as my Spell Haste item. Please change these to suit your tastes !!

Code: Select all

|- docast.mac -- used with CustomBinds: cast1-cast9 :: Num_1-Num_9

Sub Main(int Param0)
   /declare DefaultShoulderItem string outer
   /declare SwitchShoulderItem string outer

   /declare SpellSlot int outer
   /declare Switched bool outer 0

   /varset SpellSlot ${Param0}

   /declare c int outer
   
|#########################################################
|############ Change item names below. ###################
   /varset DefaultShoulderItem Shroud of the Nimble
   /varset SwitchShoulderItem Mantle of the Rainmaker
|#########################################################

   /if (${Me.Gem[${SpellSlot}].SpellType.Equal["Beneficial"]}) {
      /if (${String[${Me.Inventory[shoulder]}].NotEqual[${SwitchShoulderItem}]}) {
         /exchange "${SwitchShoulderItem}" shoulder
         /varset Switched 1
      }
   }
   /cast ${SpellSlot}
   /delay 25s !${Me.Casting.ID}
   /if (${Switched}) /exchange "${DefaultShoulderItem}" shoulder

/return
I have a pretty good comp, and I don't notice any more delay to casting than EQ has already. It could get more extensive adding tons of lower spell ones though. So. I only have added the important ones for my own needs.
Last edited by Night Hawk on Sat Apr 23, 2005 11:44 pm, edited 5 times in total.

User avatar
Night Hawk
a grimling bloodguard
a grimling bloodguard
Posts: 590
Joined: Fri Aug 13, 2004 4:56 pm

Post by Night Hawk » Mon Nov 01, 2004 3:51 pm

Guess I could try using that String.Count thing here, too :P

User avatar
Night Hawk
a grimling bloodguard
a grimling bloodguard
Posts: 590
Joined: Fri Aug 13, 2004 4:56 pm

Post by Night Hawk » Mon Nov 01, 2004 6:55 pm

Updated:
-Changed the item names to be declared at the top of the main sub.
-Added in a check to see if you acctually switched, before trying to switch back.

User avatar
Night Hawk
a grimling bloodguard
a grimling bloodguard
Posts: 590
Joined: Fri Aug 13, 2004 4:56 pm

Post by Night Hawk » Wed Nov 03, 2004 1:01 pm

I dunno why I didn't think of it before. I should probably just check if the the spell is benefical, doh.

dman
a hill giant
a hill giant
Posts: 181
Joined: Fri Dec 05, 2003 12:54 pm

Post by dman » Wed Nov 03, 2004 1:32 pm

Code: Select all

   /declare c int outer 
    
   /declare SpellHasteAmmount int outer 20 
   /declare SpellHasteList string outer S_Heal1|B_SD|B_Haste|B_Dex|B_Sta|B_AC|B_Str|B_HP|B_IOS|B_SOW|B_SV|B_Regen|B_ATK|P_Proc|P_Haste|P_Pet|P_Heal|S_Invis 

   /for c 1 to ${SpellHasteAmmount} 
      /if (${Me.Gem[${SpellSlot}].Name.Equal["${String[${SpellHasteList}].Arg[${c},|]}"]}) { 
         /if (${String[${Me.Inventory[shoulder]}].NotEqual[Mantle of the Rainmaker]}) { 
            /exchange "${SwitchItem}" shoulder 
            /varset Switched 1 
         } 
      } 
   /next c 
This could also be written as:

Code: Select all

   /declare SpellHasteList string outer S_Heal1|B_SD|B_Haste|B_Dex|B_Sta|B_AC|B_Str|B_HP|B_IOS|B_SOW|B_SV|B_Regen|B_ATK|P_Proc|P_Haste|P_Pet|P_Heal|S_Invis 

      /if (${SpellHasteList.Find[${Me.Gem[${SpellSlot}].Name}]}) { 
         /if (${Me.Inventory[shoulder].Name.NotEqual[Mantle of the Rainmaker]}) { 
            /exchange "${SwitchItem}" shoulder 
            /varset Switched 1 
         } 
      } 

User avatar
Night Hawk
a grimling bloodguard
a grimling bloodguard
Posts: 590
Joined: Fri Aug 13, 2004 4:56 pm

Post by Night Hawk » Wed Nov 03, 2004 1:33 pm

Thanx !

botofall
decaying skeleton
decaying skeleton
Posts: 8
Joined: Thu Oct 14, 2004 2:01 am

Post by botofall » Fri Nov 05, 2004 12:14 pm

bleh been trying to add this is mine to use my 8 click cast items i use all the time but dun get how it works,,,, cause its ending mac when i copy pasted and changed few text lines

all my items are in box of abu'kar ,,, so would this get them outa of it equip click and re switch for new ones ?

if not thats what im tryin to do !

Code: Select all

Sub SelfBuff

	/if (!${Window[InventoryWindow].Open}) /keypress inventory 
	/if (!${Window[pack4].Open}) /itemnotify pack4 rightmouseup 
		/itemnotify ${FindItem["Kizrack's Chestplate of Battle"].InvSlot} leftmouseup 
		/itemnotify chest leftmouseup
		/itemnotify ${FindItem["Kizrack's Gauntlets of Battle"].InvSlot} leftmouseup 
		/itemnotify hands leftmouseup
		/itemnotify ${FindItem["Symbol of the Planemasters"].InvSlot} leftmouseup 
		/itemnotify range leftmouseup
		/itemnotify ${FindItem["Rulas's Chromatic Ring"].InvSlot} leftmouseup 
		/itemnotify rightfinger leftmouseup




/if (${Me.Buff[Taelosian Guard].Duration}<2) {
		/cast item "Ilsin's Cloak"
		/delay 7s
	}
/if (${Me.Buff[Pestilence Shock].Duration}<5) {
	/if (${Finditem[Symbol of the Planemasters].ID}) /cast item "Symbol of the Planemasters"
		/delay 7s
	}
/if (${Me.Buff[Shield of the Arcane].Duration}<5) {
	/if (${Finditem[Kizrack's Chestplate of Battle].ID}) /cast item "Kizrack's Chestplate of Battle"
		/delay 7s
	}
/if (${Me.Buff[Miraculous Visions].Duration}<5) {
	/if (${Finditem[Kizrack's Gauntlets of Battle].ID}) /cast item "Kizrack's Gauntlets of Battle"
		/delay 7s
	}
/if (${Me.Buff[Chromatic Chaos].Duration}<5) {
	/if (${Finditem[Rulas's Chromatic Ring].ID}) /cast item "Rulas's Chromatic Ring"
		/delay 7s
	}
		/itemnotify rightfinger leftmouseup
		/itemnotify ${FindItem["Raex's Chestplate of Destruction"].InvSlot} leftmouseup 
		/itemnotify chest leftmouseup
		/itemnotify ${FindItem["Vadd's Gauntlets of Elite Combat"].InvSlot} leftmouseup 
		/itemnotify hands leftmouseup
		/itemnotify ${FindItem["Horn of Doomcalling"].InvSlot} leftmouseup 
		/itemnotify range leftmouseup

/return
re did it thats newist version,,, un tested tho

User avatar
Night Hawk
a grimling bloodguard
a grimling bloodguard
Posts: 590
Joined: Fri Aug 13, 2004 4:56 pm

Post by Night Hawk » Tue Apr 12, 2005 1:24 pm

-- removed, see first post --

User avatar
Night Hawk
a grimling bloodguard
a grimling bloodguard
Posts: 590
Joined: Fri Aug 13, 2004 4:56 pm

Post by Night Hawk » Sat Apr 23, 2005 11:43 pm

Alright, code in first post updated. I changed the names to variables so you only have to change one thing (makes more sense that way).

I'm planning on implementing casting queue such as that of EQ2, and possibly an INI file setup which you can add as many swaps as needed for beneficial,or detrimental spells.

More to come... in time.

To setup extra sitches for now, all you need to do is add in extra checks (such as the shoulder one above) and setup extra ${Switched} variables, to handle all that good stuff. With the exchange plugin, I've created up to 3 switches so far, and there's really no delay to acctually casting a spell. Very useful.