auto rebuff snippet

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

destructor31
decaying skeleton
decaying skeleton
Posts: 3
Joined: Sat Apr 22, 2006 12:57 pm

auto rebuff snippet

Post by destructor31 » Sat Apr 22, 2006 1:30 pm

First off a little explanation: been running my shambot mac for a while and got tired of constantly hotkeying in group or chat channel for rebuffing. My first thought was to set up timers on each spell previously cast on my tank/controller in array format; but then I remembered they are now sending messages when spells wear off. So after a couple days reading wiki/boards/manual I came up with this:

----------------------------------------------------------------

|place the following line in amongst your other events
#Event Sprebuf "Your #1# spell has worn off of #2#."


|place the following line in amongst you other sub events
| ############### Rebuff spells worn off of players

Sub Event_Sprebuf(string TXTtotalstuff, string wornoffbuff, string WOMember)

/if (${Spell[${wornoffbuff}].Mana} > ${Me.CurrentMana}) /return
/target pc ${WOMember}
/delay 3
/echo *** Hang on ! Rebuffing ${wornoffbuff} to ${WOMember}
/call cast ${wornoffbuff} gem5 5s

/return

-----------------------------------------------------------------

With all appearances it is basic and should work correctly; except when run it tells you it is casting the worn off buff on the target, but never mems the spell in the gem slot. The error recieve always tends to cut out the first word in the spell name and says there is no such spell

------------------------------------------------------------------

IE......
message:
Your Spirit of Alacrity spell has worn off Picaname.
--shammy targets Picaname--
echo:
*** Hang on ! Rebuffing Spirit of Alacrity to Picaname.
echo:
You do not have Spell:Spirit
---nothing memmed for cast---

Hope this might help someone else out there as I am still working on some kind of fix for it.

Destructor of code.

--------------------------------------------------------

After most of the day working with it. a couple new things have come to my attention. #1 if the spell is already in a different spell slot then the macro fails and ends completely #2 an unexpected side effect is in long fights if say a debuff or dot wears off the mac also attempts recast on the mob it was on (at least the closest one with that name anyway) still having problems with the string wornoffbuff not loading the spell. i will edit with more as I can.

Destructor of code.

destructor31
decaying skeleton
decaying skeleton
Posts: 3
Joined: Sat Apr 22, 2006 12:57 pm

After more review: Autorebuffer completely revamped.

Post by destructor31 » Sun Apr 23, 2006 1:13 pm

OK It took a while to come up with this version and I know it could have been done differently using more /If statements but I think this effectivly rebuffs anyone whos buff has dropped as long as they are a pc and within distance.

First......you must set all 4 of these events:

#Event Sprebuf1 "Your #1# #2# #3# #4# spell has worn off of #5#."
#Event Sprebuf2 "Your #1# #2# #3# spell has worn off of #4#."
#Event Sprebuf3 "Your #1# #2# spell has worn off of #3#."
#Event Sprebuf4 "Your #1# spell has worn off of #2#."

Then you must add in the following subs:

| ###############
| ############### Rebuff spells worn off of players
| ###############


| ############### If the spell contained 4 words
Sub Event_Sprebuf1(string TXTtotalstuff, string WOBuff1, string WOBuff2, string WOBuff3, string WOBuff4, string WOMember)

/declare wornoffbuff local ${WOBuff1}" "${WOBuff2}" "${WOBuff3}" "${WOBuff4}
/target pc ${WOMember}
/delay 3
/if (${Target.Type.Equal[PC]}) {
/if (${Me.CurrentMana}<${Spell[${wornoffbuff}].Mana}) {
/echo *** Shit ! I don't have mana to rebuff ${WOMember}
} else /if (${Target.Distance}<=100) {
/echo *** Hang on ! Rebuffing ${wornoffbuff} to ${WOMember}.
/if ( !${Me.Gem[${wornoffbuff}]} ) {
/call cast ${wornoffbuff} gem5 5s
}
}
}


/return

| ############### If the spell contained 3 words


Sub Event_Sprebuf2(string TXTtotalstuff, string WOBuff1, string WOBuff2, string WOBuff3, string WOMember)

/declare wornoffbuff local ${WOBuff1}" "${WOBuff2}" "${WOBuff3}
/target pc ${WOMember}
/delay 3
/if (${Target.Type.Equal[PC]}) {
/if (${Me.CurrentMana}<${Spell[${wornoffbuff}].Mana}) {
/echo *** Shit ! I don't have mana to rebuff ${WOMember}
} else /if (${Target.Distance}<=100) {
/echo *** Hang on ! Rebuffing ${wornoffbuff} to ${WOMember}.
/if ( !${Me.Gem[${wornoffbuff}]} ) {
/call cast ${wornoffbuff} gem5 5s
}
}
}


/return

| ############### If the spell contained 2 words


Sub Event_Sprebuf3(string TXTtotalstuff, string WOBuff1, string WOBuff2, string WOMember)

/declare wornoffbuff local ${WOBuff1}" "${WOBuff2}
/target pc ${WOMember}
/delay 3
/if (${Target.Type.Equal[PC]}) {
/if (${Me.CurrentMana}<${Spell[${wornoffbuff}].Mana}) {
/echo *** Shit ! I don't have mana to rebuff ${WOMember}
} else /if (${Target.Distance}<=100) {
/echo *** Hang on ! Rebuffing ${wornoffbuff} to ${WOMember}.
/if ( !${Me.Gem[${wornoffbuff}]} ) {
/call cast ${wornoffbuff} gem5 5s
}
}
}


/return

| ############### If the spell contained 1 word


Sub Event_Sprebuf4(string TXTtotalstuff, string WOBuff1, string WOMember)

/declare wornoffbuff local ${WOBuff1}
/target pc ${WOMember}
/delay 3
/if (${Target.Type.Equal[PC]}) {
/if (${Me.CurrentMana}<${Spell[${wornoffbuff}].Mana}) {
/echo *** Shit ! I don't have mana to rebuff ${WOMember}
} else /if (${Target.Distance}<=100) {
/echo *** Hang on ! Rebuffing ${wornoffbuff} to ${WOMember}.
/if ( !${Me.Gem[${wornoffbuff}]} ) {
/call cast ${wornoffbuff} gem5 5s
}
}
}


/return

| ###############
| ############### Rebuff Snippet Ends
| ###############

BTW I discovered using the previous version that the reason /call cast wasnt working was because the string originally defined did not recognise the spaces between the different words of the spell names. the work around was to tear down the string and rebuild it.

I Sure hope this helps someone else out.
It is definitly helping me out.

Please send feedback as I am contemplating on setting it up as a stand alone .ini file to reduce the mac sizes as it does take up some space.


Destructor of code.

Kannkor
a lesser mummy
a lesser mummy
Posts: 70
Joined: Sat Sep 02, 2006 2:30 pm

Post by Kannkor » Tue Sep 05, 2006 9:04 pm

Just use quotes instead of concatenating all the possibilities.
In the call Cast line
/call Cast added--->"${SpellWornOff}" <-----added gem5 10s

Here is the entire code I used...
Ensure to have..
#include spell_routines.ini

Code: Select all

#Event BuffWornOff "Your #1# spell has worn off of #2#."

Sub Event_BuffWornOff(Line, string SpellWornOff, string ChatSender)
	/target ${ChatSender}
	/call Cast "${SpellWornOff}" gem5 10s
/return

destructor31
decaying skeleton
decaying skeleton
Posts: 3
Joined: Sat Apr 22, 2006 12:57 pm

auto rebuffer

Post by destructor31 » Thu Sep 07, 2006 4:23 am

OMG thanks that seriuosly reduces allot of needless code :lol:

Kannkor
a lesser mummy
a lesser mummy
Posts: 70
Joined: Sat Sep 02, 2006 2:30 pm

Post by Kannkor » Fri Sep 15, 2006 5:33 pm

How are you, or anyone else handling group buffs fading?

It's very harsh on mana casting group buffs 5 times...

JimJohnson
a grimling bloodguard
a grimling bloodguard
Posts: 1299
Joined: Sat Oct 11, 2003 6:00 am

Post by JimJohnson » Fri Sep 15, 2006 6:20 pm

Raid Setting or Group exping? group and raid I would just pull the spell type if its group version dont recast. Depending on what your doing with it you can set up different conditions to recast group buffs, just need to know more of what your doing

Kannkor
a lesser mummy
a lesser mummy
Posts: 70
Joined: Sat Sep 02, 2006 2:30 pm

Post by Kannkor » Fri Sep 15, 2006 8:27 pm

Right now.. group exping. Want to expand it to raid situation (more like 2-3 groups.. still raid I guess).

Here is what I have... not confident this is the best way...

I have an event that catches any buffs fading that calls this and sends what buff, and who it faded to. I check to see if it's a group type spell, if it is, and I have a that buff - it ignores the request, otherwise, it casts it.

How can I change this for raid situation? Can I improve it for group situation?

Code: Select all

Sub BuffWornOff(SpellWornOff, ChatSender)
	/if (${Spell[${SpellWornOff}].TargetType.Equal["Group v2"]} && ${Me.Buff[${SpellWornOff}].ID}) {
	
	} else {
	/target ${ChatSender}
	/if (${Target.Name.Equal["${ChatSender}"]} && ${Target.Type.Equal["PC"]}) /call Cast "${SpellWornOff}" gem5 10s
	}
/return


JimJohnson
a grimling bloodguard
a grimling bloodguard
Posts: 1299
Joined: Sat Oct 11, 2003 6:00 am

Post by JimJohnson » Fri Sep 15, 2006 9:37 pm

have it check if the wore off effect is on the group leader or not, if its on group leader have it recast, you can do the same with raid probably, have it call something that checks the raidwindow and store the groupleaders inti variables, then check those names against the wore off. If its one of the variables(GroupLeaders) then rebuff that person. If not set as a GL Ingore the groupbuff request.

Kannkor
a lesser mummy
a lesser mummy
Posts: 70
Joined: Sat Sep 02, 2006 2:30 pm

Post by Kannkor » Sat Sep 16, 2006 5:41 pm

Fantastic idea JJ!

Thanks!