WoW:API SetCVar: Difference between revisions

Updated with new information
(Added information on scriptCVar)
(Updated with new information)
Line 20: Line 20:


By default CVAR_UPDATE is not fired when you call SetCVar, to make sure it does you need to pass the third argument scriptCVar which will be the first argument in the event when it's fired.
By default CVAR_UPDATE is not fired when you call SetCVar, to make sure it does you need to pass the third argument scriptCVar which will be the first argument in the event when it's fired.
== Notes ==
From Ohklus: '''Do not overwrite this function!''' You'll have a very hard time finding the reason for those nasty "sry, your addon was blocked cause it called a secure function" errors.
My example: hitting the escape key should just open the game menu. If you overwrite SetCVar you'll get the error each time you press Esc (except when closing a window). The error is released by the Blizzard UI functions [[API_SpellStopCasting]], [[API_SpellStopTargeting]] and [[API_ClearTarget]], because they appear in [[API_ToggleGameMenu]]. I've got no idea why SetCVar is called between hitting Esc and reaching [[API_ToggleGameMenu]].


__NOTOC__
__NOTOC__
Anonymous user