Universal Duration Effect Item Clicking

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

Shadows91
a lesser mummy
a lesser mummy
Posts: 31
Joined: Mon Feb 09, 2009 11:21 pm

Universal Duration Effect Item Clicking

Post by Shadows91 » Tue Jun 23, 2009 8:15 pm

Required Plugins:
-> MQ2Cast
-> MQ2Exchange

Above all subroutines, add the following:

Code: Select all

#include AutoClick.inc
Inside the macro's loop, add the following:

Code: Select all

/call AutoClick
Save the following code as "AutoClick.inc" inside the **\Release\Macros folder:

Code: Select all

| -=-AutoClick-=-=-=-Include-=-=- 
| -=>Created by Shadows91 
| _______________________________ 
| -=>Adds the following function: 
|   <- Clickable item recognition 
|      and casting 
| _______________________________ 
| -=>Requires the following plugins: 
|   <- MQ2Cast 
|   <- MQ2Exchange 
| _______________________________ 
| -=>Item Restrictions: 
|   <- NO Illusions 
|   <- NO Invisibility 
|   <- NO Invisibility Versus Animal 
|   <- NO Invisibility Versus Undead 
|   <- NO Nimbi 
| _______________________________ 
| -=>Clicking Restrictions: 
|   <- NOT Invisible 
|   <- NOT Moving 
|   <- NOT in Combat 
|   <- NOT Casting 
|   <- NOT Sticking 
|   <- NOT Following (MQ2AdvPath) 
|   <- NOT in "Cooldown" \ "Debuffed" (>>Only Applies to Cleric\Shaman\Druid<<) 
|   <- NOT in the Following Zones: The Plane of Knowledge, Guild Lobby, Guild Hall, The Void (A - G), The Plane of Time (A) 
|   <- NO Cursor Items 
| _______________________________ 
| -=>Known Issues: 
|   <- "Spam" clicks movement \ levitation effects in zones that 
|       don't allow said effect type(s). 
|   <- Certain effects will override other effects, which will result 
|       in an unending click loop. 
| 
|    SOLUTION: Disable the item via AutoClick.ini (See Below) 
| _______________________________ 
| -=>Item Disabling: 
|      1. Open AutoClick.ini (Located **\Release\Macros) 
|      2. Under the header that is of the name of the character that contains the desired 
|           clickable item status to modify (Example: [Soandso]), locate the item of which 
|           you seek to disable and change the value to "OFF" (Example: Fabled Journeyman's Boots=OFF) 
|      3. Save the file as AutoClick.ini 
|      4. Delete the variable "AutoClick_Initialized", which will allow for a reinstantiation of 
|		 	ItemClickArray. (Command: /deletevar AutoClick_Initialized) 
|    
|      NOTE: Should you wish to re-enable said item, simply change the item's value to ON (Example: 
|              Fabled Journeyman's Boots=ON)        
| __________ Version 1.1 __________ 
| -=-=-=-=-=-=-3/20/09-=-=-=-=-=-=- 

Sub AutoClick 
	/If (!${Defined[AutoClick_Initialized]}) { 
| -=-=-=-=-=-=-=-=-=-=-=-=-=-=- 
| -= AutoClick  Declarations =- 
| -=-=-=-=-=-=-=-=-=-=-=-=-=-=- 
		/If (!${Defined[counter1]}) /declare counter1 int global 
		/If (!${Defined[counter2]}) /declare counter2 int global 
		/If (!${Defined[counter3]}) /declare counter3 int global 
		/If (!${Defined[counter4]}) /declare counter4 int global 
		/If (!${Defined[CheckItems]}) /declare CheckItems bool global TRUE 
| -=-=-=-=-=-=-=-=-=-=-=-=-=-=- 
| -=  AutoClick  Definitions =- 
| -=-=-=-=-=-=-=-=-=-=-=-=-=-=- 
		/echo -= Locating new clickable items, please wait... 
		/declare ItemClickList string local 
		/declare noClickDescription[9] string local 
		/varset noClickDescription[1] Your form is covered in a shroud of air 
		/varset noClickDescription[2] You vanish 
		/varset noClickDescription[3] You feel your skin tingle 
		/varset noClickDescription[4] You feel different 
		/varset noClickDescription[5] Part of your image fades away 
		/varset noClickDescription[6] You look through the eyes of the Fier`dal 
		/varset noClickDescription[7] You feel a slight chill creep over you 
		/varset noClickDescription[8] You gather shadows about you 
		/varset noClickDescription[9] Your feet feel quick 
		/varset noClickDescription[9] Your eyes tingle 
		/varset counter4 0 
		/for counter1 30 downto 0 
			/If (${Me.Inventory[${counter1}].Container}) { 
				/for counter2 1 to ${Me.Inventory[${counter1}].Container} 
					/If (${Me.Inventory[${counter1}].Item[${counter2}].WornSlot[1]}!= 13 && !${Ini[AutoClick.ini,${Me.CleanName},${Me.Inventory[${counter1}].Item[${counter2}].Name}].Equal[OFF]} && !${Me.Inventory[${counter1}].Item[${counter2}].Name.Find[Nimbus]}&& ${Me.Inventory[${counter1}].Item[${counter2}].ID}  && ${Me.Inventory[${counter1}].Item[${counter2}].Spell.Name.Length} && ${Me.Inventory[${counter1}].Item[${counter2}].Spell.CastOnYou.Length} && ${Me.Inventory[${counter1}].Item[${counter2}].EffectType.Find[Click]} && !${Me.Inventory[${counter1}].Item[${counter2}].Stackable} && !${Me.Inventory[${counter1}].Item[${counter2}].TimerReady} && ${Me.Inventory[${counter1}].Item[${counter2}].Spell.Duration} >= 40) { 
						/for counter3 1 to ${noClickDescription.Size} 
							/If (${Me.Inventory[${counter1}].Item[${counter2}].Spell.CastOnYou.Find[${noClickDescription[${counter3}]}]}) /next counter2 
						/next counter3                    
						/varset ItemClickList ${ItemClickList}${Me.Inventory[${counter1}].Item[${counter2}].Spell.Name}|${Me.Inventory[${counter1}].Item[${counter2}].Name}_
						/If (!${Ini[AutoClick.ini,${Me.CleanName},${Me.Inventory[${counter1}].Item[${counter2}].Name}].Equal[ON]}) { 
							/varset counter4 ${Math.Calc[${counter4}+1]} 
							/Ini AutoClick.ini ${Me.CleanName} "${Me.Inventory[${counter1}].Item[${counter2}].Name}" ON 
							/echo *** New Item: ${Me.Inventory[${counter1}].Item[${counter2}].Name} : "${Me.Inventory[${counter1}].Item[${counter2}].Spell.Name}" 
						} else { 
							/echo *** Item: ${Me.Inventory[${counter1}].Item[${counter2}].Name} : "${Me.Inventory[${counter1}].Item[${counter2}].Spell.Name}" 
						} 
					}          
				/next counter2 
			} else { 
				/If (${Me.Inventory[${counter1}].WornSlot[1]}!= 13 && !${Ini[AutoClick.ini,${Me.CleanName},${Me.Inventory[${counter1}].Name}].Equal[OFF]} && !${Me.Inventory[${counter1}].Name.Find[Nimbus]}&& ${Me.Inventory[${counter1}].ID} && ${Me.Inventory[${counter1}].Spell.Name.Length} && ${Me.Inventory[${counter1}].Spell.CastOnYou.Length} && ${Me.Inventory[${counter1}].EffectType.Find[Click]} && !${Me.Inventory[${counter1}].Stackable} && !${Me.Inventory[${counter1}].TimerReady} && ${Me.Inventory[${counter1}].Spell.Duration} >= 40) { 
					/for counter3 1 to ${noClickDescription.Size} 
						/If (${Me.Inventory[${counter1}].Spell.CastOnYou.Find[${noClickDescription[${counter3}]}]}) /next counter1 
					/next counter3                    
					/varset ItemClickList ${ItemClickList}${Me.Inventory[${counter1}].Spell.Name}|${Me.Inventory[${counter1}].Name}_ 
					/If (!${Ini[AutoClick.ini,${Me.CleanName},${Me.Inventory[${counter1}].Name}].Equal[ON]}) { 
						/varset counter4 ${Math.Calc[${counter4}+1]} 
						/Ini AutoClick.ini ${Me.CleanName} "${Me.Inventory[${counter1}].Name}" ON 
						/echo *** New Item: ${Me.Inventory[${counter1}].Name} : "${Me.Inventory[${counter1}].Spell.Name}" 
					} else { 
						/echo *** Item: ${Me.Inventory[${counter1}].Name} : "${Me.Inventory[${counter1}].Spell.Name}" 
					} 
				}          
			}          
		/next counter1 
		/If (${Defined[ItemClickArray]}) /deletevar ItemClickArray
		/declare ItemClickArray[${ItemClickList.Count[_]},2] string global 
		/for counter1 1 to ${ItemClickList.Count[_]} 
			/varset ItemClickArray[${counter1},1] ${ItemClickList.Arg[${counter1},_].Arg[1,|]} 
			/varset ItemClickArray[${counter1},2] ${ItemClickList.Arg[${counter1},_].Arg[2,|]} 
		/next counter1 
		/echo -= Clickable item search complete 
		/If (${counter4}>0) { 
			/echo -= ${counter4} new item(s) indexed under section "[${Me.CleanName}]" of AutoClick.ini 
		} 
		/declare AutoClick_Initialized bool global TRUE 
	} 
| -=-=-=-=-=-=-=-=-=-=-=-=-=-=- 
| -=  AutoClick   Functions  =- 
| -=-=-=-=-=-=-=-=-=-=-=-=-=-=- 
	/If (!${Window[RespawnWnd].Open} && ${CheckItems}) { 
		/If (!${Me.Ducking} && !${Me.Combat} && !${Cursor.ID} && !${Select[${Zone.ID},202,219,344,345,459,460,461,462,463,464,465]} && !${Me.Casting.ID} && !${Stick.Active} && !${Me.Invis} && !${AdvPath.Following} && !${Me.Moving} && !${Me.CombatState.Equal[COMBAT]}${If[${Select[${Me.Class.ShortName},CLR,SHM,DRU]}, && !${Select[${Me.CombatState},COOLDOWN,DEBUFFED]}]}) { 
			/for counter1 1 to ${ItemClickArray.Size[1]} 
				/If (!${Me.Buff[${ItemClickArray[${counter1},1]}].ID} && ${Spell[${ItemClickArray[${counter1},1]}].Stacks}) { 
					/delay 300 !${Me.Casting.ID} 
					/casting "${ItemClickArray[${counter1},2]}" 
					/echo -= Clicking "${ItemClickArray[${counter1},2]}" : ${ItemClickArray[${counter1},1]} 
					/delay 20 ${Me.Casting.ID} 
					/delay 300 !${Me.Casting.ID} 
					/delay ${Spell[${ItemClickArray[${counter1},1]}].RecoveryTime} 
				} 
			/next counter1 
			/varset CheckItems FALSE 
			| >Change this value to modify the check time delay (Default: 4s) 
			/timed 40 /varset CheckItems TRUE 
		} 
	} 
/return
-([Edited: 6/23/09 | 11:36 PM] Fixed a contextual error {Thanks, fearless})
-([Edited: 6/24/09 | 12:56 AM] Removed stacking duration check {Thanks, demonstar55})
-([Edited: 6/24/09 | 11:51 AM] Removed superfluous variables)
Last edited by Shadows91 on Wed Jun 24, 2009 12:31 pm, edited 8 times in total.

demonstar55
a snow griffon
a snow griffon
Posts: 314
Joined: Fri Nov 28, 2008 6:31 am

Post by demonstar55 » Tue Jun 23, 2009 10:49 pm

Code: Select all

${Spell[${FindItem[ITEMNAME].Spell}].Stacks}
should tell you it the item's effect will stack, of course replace ITEMNAME with whatever the macro's variable for item name is

Shadows91
a lesser mummy
a lesser mummy
Posts: 31
Joined: Mon Feb 09, 2009 11:21 pm

Post by Shadows91 » Wed Jun 24, 2009 1:04 am

Update:
- Removed stacking duration check (Thanks, demonstar55)
- Fixed a contextual error (Thanks, fearless)

xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Universal Duration Effect Item Clicking

Post by xyilla » Thu Sep 11, 2025 8:50 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Universal Duration Effect Item Clicking

Post by xyilla » Thu Sep 11, 2025 8:51 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Universal Duration Effect Item Clicking

Post by xyilla » Thu Sep 11, 2025 8:52 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Universal Duration Effect Item Clicking

Post by xyilla » Thu Sep 11, 2025 8:53 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Universal Duration Effect Item Clicking

Post by xyilla » Thu Sep 11, 2025 8:54 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Universal Duration Effect Item Clicking

Post by xyilla » Thu Sep 11, 2025 8:56 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Universal Duration Effect Item Clicking

Post by xyilla » Thu Sep 11, 2025 8:57 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Universal Duration Effect Item Clicking

Post by xyilla » Thu Sep 11, 2025 8:58 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Universal Duration Effect Item Clicking

Post by xyilla » Thu Sep 11, 2025 8:59 am