Simple Spell Cast Announcement

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

Moderator: MacroQuest Developers

fryfrog
a hill giant
a hill giant
Posts: 271
Joined: Fri Jun 20, 2003 5:37 am

Simple Spell Cast Announcement

Post by fryfrog » Fri May 14, 2004 2:59 pm

This is a very simple script. You can alter the line "/varset SpellsToAnnounce" and fill in the spells you want it to announce. It isn't as cool as I would like it, but its simple and flexible. I am also sure there are better ways to do some of the things I have done... so please, if you have any ideas post em.

Really, I would wish for a simple way of doing more "random" announcments. Instead of saying "Complete Healing on [ %t ]" it could say something more customized... but that would probably involve an INI file or something.

Code: Select all

#event BeginCast "You begin casting #1#."

Sub Main
/declare SpellsToAnnounce string outer
/declare SpellsToTell string outer
/varset SpellsToAnnounce Complete Healing Supernal Elixir Supernal Light Supernal Remedy
|/varset SpellsToTell

/declare Chat1 string outer
/declare Chat2 string outer
/declare Chat3 string outer
/declare UseChat1 int outer 0
/declare UseChat2 int outer 0
/declare UseChat3 int outer 0

/if (!${Defined[Param0]}) {
  /echo Supports any 3 channels (ie: g, say, rs, 1, 2, etc...
  /endmacro 
} 

/if (${Defined[Param2]}) {
  /varset Chat1 ${Param0} 
  /varset UseChat1 1
  /varset Chat2 ${Param1}
  /varset UseChat2 1
  /varset Chat3 ${Param2}
  /varset UseChat3 1
  /echo Starting Cleric Assist script, output to /${Chat1} and /${Chat2} and /${Chat3}
} else /if (${Defined[Param1]}) {
  /varset Chat1 ${Param0} 
  /varset UseChat1 1
  /varset Chat2 ${Param1}
  /varset UseChat2 1
  /echo Starting Cleric Assist script, output to /${Chat1} and /${Chat2} 
} else /if (${Defined[Param0]}) { 
  /varset Chat1 ${Param0}
  /varset UseChat1 1
  /varset UseChat2 0
  /varset UseChat3 0
  /echo Starting Cleric Assist script, output to /${Chat1} 
} 

:StartLoop
  /doevents 
  /delay 5 
  /goto :StartLoop 
/return 

Sub Event_BeginCast(string Line,string SpellName)
/if (${String[${SpellsToAnnounce}].Find[${SpellName}]}) {
  /if (${UseChat1}==1) /${Chat1} ${SpellName} on [ %t ]!
  /if (${UseChat2}==1) /${Chat2} ${SpellName} on [ %t ]!
  /if (${UseChat3}==1) /${Chat3} ${SpellName} on [ %t ]!
  |/if (${String[${SpellsToTell}].Find[${SpellName}]}) /ttell ${Spellname} being cast on YOU!
}
/return

Preocts
a snow griffon
a snow griffon
Posts: 312
Joined: Thu Jan 29, 2004 1:02 pm

Post by Preocts » Fri May 14, 2004 5:53 pm

Well, it's just something I spat out but maybe it will give you an idea?


Sample of how to pull a random comment from INI

Code: Select all

Sub Random(SpellName)
  /declare RandRange int local ${Ini[MyFile.ini,${SpellName},Count,0]}
  /if (!${RandRange}) /return "No_Random"
  /declare nRand int local ${Math.Calc[${Math.Rand[${RandRange}]}+1]}
/return "${Ini[MyFile.ini,${SpellName},${nRand},No_Return]}"
Sample INI

Code: Select all

[Complete]
Count=2
1=Casting a complete healing on joo.
2=Stay in range for 10 or die quickly so I don't have to kill you

User avatar
Leezard
a ghoul
a ghoul
Posts: 81
Joined: Wed Feb 04, 2004 12:54 pm

Post by Leezard » Sat May 15, 2004 4:06 pm

Id really like to see a plugin of this ;).
Death is merely a doorway, for a god!

fryfrog
a hill giant
a hill giant
Posts: 271
Joined: Fri Jun 20, 2003 5:37 am

Post by fryfrog » Sun May 16, 2004 2:35 pm

Worked in the random comments from INI support, thanks a bunch it was a lot easier than I thought it was. I also converted from comparing an int to just using a bool value. It doesn't support random comments in anything other than primary channel though. I tend to run in /g for exp, /g and /say for raids. /g is okay to be funny, but /say would be annoying for others to figure out wtf you mean :)

The format is exactly like above of course for the ini file.

Code: Select all

#event Sitting "You must be standing to cast a spell"
#event BeginCast "You begin casting #1#."

Sub Main
/declare SpellsToAnnounce string outer
|/declare SpellsToTell string outer
/varset SpellsToAnnounce Complete Healing Supernal Elixir Supernal Light Supernal Remedy
|/varset SpellsToTell

/declare Chat1 string outer
/declare Chat2 string outer
/declare Chat3 string outer
/declare UseChat1 bool outer TRUE
/declare UseChat2 bool outer TRUE
/declare UseChat3 bool outer TRUE
/declare UseRandChat1 bool outer TRUE

/if (!${Defined[Param0]}) {
  /echo Supports any 3 channels (ie: g, say, rs, 1, 2, etc...
  /endmacro 
} 

/if (${Defined[Param2]}) {
  /varset Chat1 ${Param0} 
  /varset Chat2 ${Param1}
  /varset Chat3 ${Param2}
  /echo Starting Cleric Assist script, output to /${Chat1} and /${Chat2} and /${Chat3}
} else /if (${Defined[Param1]}) {
  /varset Chat1 ${Param0} 
  /varset Chat2 ${Param1}
  /varset UseChat3 FALSE
  /echo Starting Cleric Assist script, output to /${Chat1} and /${Chat2} 
} else /if (${Defined[Param0]}) { 
  /varset Chat1 ${Param0}
  /varset UseChat2 FALSE
  /varset UseChat3 FALSE
  /echo Starting Cleric Assist script, output to /${Chat1} 
} 

:StartLoop
  /doevents 
  /delay 5 
  /goto :StartLoop 
/return 

Sub Event_BeginCast(string Line,string SpellName)
/if (${String[${SpellsToAnnounce}].Find[${SpellName}]}) {
  /if (${UseRandChat1}) {
     /call Random "${SpellName}"
     /if (!${String[${Macro.Return}].Find[No_Random]}) /${Chat1} ${Macro.Return}
  } else /if (${UseChat1}) /${Chat1} ${SpellName} on [ %t ]!
  /if (${UseChat2}) /${Chat2} ${SpellName} on [ %t ]!
  /if (${UseChat3}) /${Chat3} ${SpellName} on [ %t ]!
  |/if (${String[${SpellsToTell}].Find[${SpellName}]}) /ttell ${Spellname} being cast on YOU!
}
/return

Sub Random(SpellName)
  /declare RandRange int local ${Ini[RandCom.ini,"${SpellName}",Count,0]}
  /if (!${RandRange}) /return No_Random
  /declare nRand int local ${Math.Calc[${Math.Rand[${RandRange}]}+1]}
/return ${Ini[RandCom.ini,"${SpellName}",${nRand},No_Return]}

Sub Event_Sitting
  /sit off
/return

Chill
Contributing Member
Contributing Member
Posts: 435
Joined: Fri May 07, 2004 5:06 pm
Location: Erie, PA

Post by Chill » Sun May 16, 2004 4:25 pm

Leezard wrote:Id really like to see a plugin of this ;).
Why on earth would this need to be a plugin? I think this could be a simple include file, or if someone really cared they could add these functions to SpellCast.inc and call them whenever they cast a spell they wanted to announce.

fryfrog
a hill giant
a hill giant
Posts: 271
Joined: Fri Jun 20, 2003 5:37 am

Post by fryfrog » Sun May 16, 2004 6:49 pm

As a plugin, you could do many much neater things. You can see my thread in the plugins section for an idea or two.