Ok I got the snippet from Rogue Helper that clicks clickies, but wanted to ask if it would be possible to make this into an INC file so I could simply add it to ALL my macros. What worries me is the LOOP logic. Should it just be taken out and pieced into the macros I want? Like place the events and variables there? or will this work as an INC file?
clicky.mac/.inc
clicky.ini
"/iclick organic" would automatically click the ring. If it is not equiped it equips it and then removes it and puts back what was there.
setting KeepUp to true will automatically keep these clickies alive.
clicky.mac/.inc
Code:
#Event ItemSet "[MQ2] ItemSet#*#"
#Event ItemBounce "[MQ2] ItemBounce#*#"
#Event ItemCast "[MQ2] ItemCast#*#"
Sub Main
/echo Loading ... Please Wait!
/declare ialias string outer None
/declare doIclick bool outer FALSE
/declare bouncenum int outer 1
/declare ibounce string outer None
/declare itemspellname string outer None
/declare clicktimer timer outer 0
/declare lastevent string outer None
/squelch /alias /iset /echo ItemSet
/squelch /alias /ibounce /echo ItemBounce
/squelch /alias /iclick /echo ItemCast
:EndAlias
:ForeverLoop
|- Service any events
/doevents
/goto :ForeverLoop
/if (!${Target.ID}) /goto :Foreverloop
:ItemCheckLoop
/varset ialias ${Ini[Clicky.ini].Arg[${i},|]}
/if (${ialias.NotEqual[NULL]}) {
|- Obtained an itemalias from the Clicky.ini file
|- We supposed to keep this spell up?
/if (${Ini[Clicky.ini,${ialias},KeepUp].Equal[FALSE]}) /goto :NextItem
|- Scan the item's bounce list for the active bouncers
/varset bouncenum 1
/varset doIclick TRUE
:BounceCheckLoop
/varset ibounce ${Ini[Clicky.ini,${ialias},BounceOff${bouncenum}]}
/if (${ibounce.NotEqual[NULL]}) {
/if (${ibounce.Equal[${Me.Buff[${ibounce}]}]}) /varset doIclick FALSE
} else /goto :DoneBounceChecks
/varcalc bouncenum ${bouncenum}+1
/goto :BounceCheckLoop
:DoneBounceChecks
|- By now we won't click the item if a bouncer spell is on us
|- Just have to check to see if the existing buff is on too
/varset itemspellname ${FindItem[${Ini[Clicky.ini,${ialias},FullName]}].Spell}
/if (${itemspellname.Equal[${Me.Buff[${itemspellname}]}]}) /varset doIclick FALSE
|- Finally, do it if we should
/if (${doIclick}) /docommand /iclick ${ialias}
|- Did we fail to find that previous item? (i.e. Dead and naked at bind point!)
/if (${clicktimer}) /goto :DoneItemChecks
:NextItem
/varcalc i ${i}+1
} else /goto :DoneItemChecks
/goto :ItemCheckLoop
:DoneItemChecks
/goto :ForeverLoop
/return
|---- EVENTS
Sub Event_SpellBounced
/varset lastevent Event_SpellBounced
/varset clicktimer 60s
|/beep
|/beep
|/beep
/if (${verbosity}>=1) /Echo ** Just detected a BOUNCED spell!
/if (${verbosity}>=1) /Echo ** Use /ibounce to update click-item info!
/return
Sub Event_ItemSet(string Line)
/varset lastevent Event_ItemSet
|- Sanity check parameters
/if (!${Line.Arg[5].Length} || ${Line.Arg[6].Length}) {
/if (${verbosity}>=0) /Echo ** Improper use of /iset
/if (${verbosity}>=0) /Echo -- /iset <itemalias> keepup|nokeepup <"Item Name">
/if (${verbosity}>=0) /Echo -- For example:
/if (${verbosity}>=0) /Echo -- /iset gobby keepup "Shrunken Goblin Skull Earring"
/return
}
/ini "Clicky.ini" "${Line.Arg[3]}" "FullName" "${Line.Arg[5]}"
/ini "Clicky.ini" "${Line.Arg[3]}" "KeepUp" "${If[${Line.Arg[4].Equal[keepup]},TRUE,FALSE]}"
/if (${verbosity}>=0) /Echo ** ${Line.Arg[5]} (KeepUp=${If[${Line.Arg[4].Equal[keepup]},TRUE,FALSE]}) updated in INI!
/return
Sub Event_ItemBounce(string Line)
/varset lastevent Event_ItemBounce
|- Sanity check parameters
/if (!${Line.Arg[4].Length}) {
/if (${verbosity}>=0) /Echo ** Improper use of /ibounce
/if (${verbosity}>=0) /Echo -- /ibounce <itemalias> "Some Spell Name"
/if (${verbosity}>=0) /Echo -- For example:
/if (${verbosity}>=0) /Echo -- /ibounce gobby "Strength of Tunare"
/return
}
|- Look for that item's section, return if non-existent
/if (!${Ini[Clicky.ini,${Line.Arg[3]}].Length}) {
/if (${verbosity}>=0) /Echo ** [${Line.Arg[3]}] not in INI file!
/return
}
|- Find the next available BounceOff key number and store the spell
/declare bindex int local 1
:CheckNextKey
/if (${Ini[Clicky.ini,${Line.Arg[3]},BounceOff${bindex}].Length}) {
|- This one is in use...
/varcalc bindex ${bindex}+1
/goto :CheckNextKey
} else {
|- This one not defined (yet). Good.
/ini "Clicky.ini" "${Line.Arg[3]}" "BounceOff${bindex}" "${Line.Arg[4]}"
/if (${verbosity}>=0) /Echo ** Added "${Line.Arg[4]}" to [${Line.Arg[3]}]'s bounce list
}
/return
Sub Event_ItemCast(string Line)
/varset lastevent Event_ItemCast
|- Sanity check parameter
/if (!${Line.Arg[3].Length}) {
/if (${verbosity}>=0) /Echo ** Improper use of /icast
/if (${verbosity}>=0) /Echo -- /icast <itemalias>
/if (${verbosity}>=0) /Echo -- For example:
/if (${verbosity}>=0) /Echo -- /icast gobby
/return
}
|- Look for that item's section, return if non-existent
/if (!${Ini[Clicky.ini,${Line.Arg[3]}].Length}) {
/if (${verbosity}>=0) /Echo ** [${Line.Arg[3]}] not in INI file!
/return
}
/declare fullname string local ${Ini[Clicky.ini,${Line.Arg[3]},FullName]}
|- Is it in a Bag?
/if (${verbosity}>=1) /Echo ** Attempting to use: ${fullname}
/if (${FindItem[${fullname}].InvSlot.Pack}) {
:OpenPack
/if (!${Window[${FindItem[${fullname}].InvSlot.Pack.Name}].Open}) {
/itemnotify ${FindItem[${fullname}].InvSlot.Pack.Name} rightmouseup
/delay 2
/goto :OpenPack
}
/declare camefrom ${FindItem[${fullname}].InvSlot}
:GrabItem
/if (!${Cursor.ID}) {
/itemnotify ${InvSlot[${camefrom}]} leftmouseup
/delay 2
/goto :GrabItem
}
/declare clickyID int local ${Cursor.ID}
/declare wornat int local ${Cursor.WornSlot[1]}
:SwapFirst
/if (${Cursor.ID}==${clickyID}) {
/itemnotify ${InvSlot[${wornat}]} leftmouseup
/delay 2
/goto :SwapFirst
}
|- Click it
/delay 2
/if (${verbosity}>=1) /Echo ** Clicking: ${fullname}
/declare previousID ${Cursor.ID}
/itemnotify ${InvSlot[${wornat}]} rightmouseup
:SwapAgain
/if (${Cursor.ID}==${previousID}) {
/itemnotify ${InvSlot[${wornat}]} leftmouseup
/delay 2
/goto :SwapAgain
}
|- Put it back
:PutItBack
/if (${Cursor.ID}==${clickyID}) {
/itemnotify ${InvSlot[${camefrom}]} leftmouseup
/delay 2
/goto :PutItBack
}
:SummonedCheck
/if (${Cursor.ID}) {
|- Something was summoned
/autoinv
/delay 2
/goto :SummonedCheck
}
:ClosePack
/if (${Window[${InvSlot[${camefrom}].Pack.Name}].Open}) {
/itemnotify ${InvSlot[${camefrom}].Pack.Name} rightmouseup
/delay 2
/goto :ClosePack
}
} else {
|- Just click it
/if (${FindItem[${fullname}].InvSlot}) {
/if (${verbosity}>=1) /Echo ** Clicking: ${fullname}
/itemnotify ${FindItem[${fullname}].InvSlot} rightmouseup
/delay 2
} else {
/if (${verbosity}>=0) /Echo ** "${fullname}" not found!
}
}
:CastLoop
/delay 1
/if (${Me.Casting.ID}) /goto :CastLoop
/return
/doevents flush
/return
clicky.ini
Code:
[Stanos]
FullName=Stanos' Wicked Gauntlets
KeepUp=FALSE
[Dart]
FullName=Serrated Dart of Energy
KeepUp=FALSE
[Mirrored]
FullName=Mirrored Mask
KeepUp=FALSE
[Shrink]
FullName=Wand of Imperceptibility
KeepUp=FALSE
[Orgasmic]
Fullname=Ring of Organic Darkness
KeepUp=FALSE
"/iclick organic" would automatically click the ring. If it is not equiped it equips it and then removes it and puts back what was there.
setting KeepUp to true will automatically keep these clickies alive.