<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://addonstudio.org/mw1/index.php?action=history&amp;feed=atom&amp;title=WoW%3ASecureStateDriver</id>
	<title>WoW:SecureStateDriver - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://addonstudio.org/mw1/index.php?action=history&amp;feed=atom&amp;title=WoW%3ASecureStateDriver"/>
	<link rel="alternate" type="text/html" href="https://addonstudio.org/mw1/index.php?title=WoW:SecureStateDriver&amp;action=history"/>
	<updated>2026-05-22T12:28:45Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://addonstudio.org/mw1/index.php?title=WoW:SecureStateDriver&amp;diff=19210&amp;oldid=prev</id>
		<title>Move page script: Move page script moved page SecureStateDriver to WoW:SecureStateDriver without leaving a redirect</title>
		<link rel="alternate" type="text/html" href="https://addonstudio.org/mw1/index.php?title=WoW:SecureStateDriver&amp;diff=19210&amp;oldid=prev"/>
		<updated>2023-08-15T04:48:56Z</updated>

		<summary type="html">&lt;p&gt;Move page script moved page &lt;a href=&quot;/wiki/WoW:SecureStateDriver&quot; title=&quot;WoW:SecureStateDriver&quot;&gt;SecureStateDriver&lt;/a&gt; to &lt;a href=&quot;/wiki/WoW:SecureStateDriver&quot; title=&quot;WoW:SecureStateDriver&quot;&gt;SecureStateDriver&lt;/a&gt; without leaving a redirect&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 04:48, 15 August 2023&lt;/td&gt;
				&lt;/tr&gt;
&lt;!-- diff cache key addonstu_asmw2:diff::1.12:old-19209:rev-19210 --&gt;
&lt;/table&gt;</summary>
		<author><name>Move page script</name></author>
	</entry>
	<entry>
		<id>https://addonstudio.org/mw1/index.php?title=WoW:SecureStateDriver&amp;diff=19209&amp;oldid=prev</id>
		<title>WoWWiki&gt;Starlightblunder: Created page with &#039;&#039;&#039;&#039;SecureStateDriver&#039;&#039;&#039; is a mechanism that allows secure handlers to register to be notified when conditions that are expressible use macro conditional change. The handler can t...&#039;</title>
		<link rel="alternate" type="text/html" href="https://addonstudio.org/mw1/index.php?title=WoW:SecureStateDriver&amp;diff=19209&amp;oldid=prev"/>
		<updated>2009-05-31T15:13:12Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;#039;&amp;#039;&amp;#039;&amp;#039;SecureStateDriver&amp;#039;&amp;#039;&amp;#039; is a mechanism that allows secure handlers to register to be notified when conditions that are expressible use macro conditional change. The handler can t...&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{uitech}}&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;SecureStateDriver&amp;#039;&amp;#039;&amp;#039; is a mechanism that allows secure handlers to register to be notified when conditions that are expressible using macro conditionals change. The handler can then respond by executing a snippet in the restricted environment, allowing (restricted) addon code to alter protected values while in combat.&lt;br /&gt;
&lt;br /&gt;
The implementation is included as part of FrameXML in FrameXML/SecureStateDriver.lua. Conditionals are generally evaluated every 0.2 seconds, and in response to events guaranteed to alter some secure conditionals.&lt;br /&gt;
&lt;br /&gt;
==API==&lt;br /&gt;
There are two functions provided by the Secure State Driver API: RegisterUnitWatch is the unit-frame special case, and RegisterStateDriver is the generic implementation.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;RegisterStateDriver&amp;#039;&amp;#039;&amp;#039;(frame, stateid, conditional)&lt;br /&gt;
: Is the generic state driver -- you can register to be notified when an arbitrary macro conditional evaluates to a different values. Updates are delivered via attributes; handle OnAttributeChanged or use [[SecureHandlerStateTemplate]] with a corresponding snippet to respond from a restricted environment.&lt;br /&gt;
:; frame : Frame-derived widget - notifications will be delivered to this frame.&lt;br /&gt;
:; stateid : String - an arbitrary identifier string for this conditional (coerced into lower case), or &amp;quot;visibility&amp;quot;. The latter is a special state -- rather than delivering an update through attribute changes, it shows and hides the frame when the conditional evaluates to &amp;quot;show&amp;quot; or &amp;quot;hide&amp;quot; respectively.&lt;br /&gt;
:; conditional : String - macro conditional parsable by {{api|SecureCmdOptionParse}}. The value this conditional evaluates to will be set as the value of the &amp;quot;state-&amp;#039;&amp;#039;stateid&amp;#039;&amp;#039;&amp;quot; attribute on the frame.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;RegisterUnitWatch&amp;#039;&amp;#039;&amp;#039;(frame, asState)&lt;br /&gt;
: Assists in controlling unit frames -- can either show/hide the frame based on whether its unit exists; or deliver that information via a state attribute.&lt;br /&gt;
:; frame : Frame-derived widget - The frame to be shown/hidden/notified when its unit exists / does not exist.&lt;br /&gt;
:; asState : Boolean - if true, the &amp;quot;state-unitexists&amp;quot; attribute will be set to a boolean value denoting whether the unit exists; if false, the frame will be shown if its unit exists, and hidden if it does not.&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Showing/hiding a unit frame&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 local frame = CreateFrame(&amp;quot;BUTTON&amp;quot;, &amp;quot;MyParty1&amp;quot;, UIParent, &amp;quot;SecureUnitButtonTemplate&amp;quot;);&lt;br /&gt;
 frame:SetAttribute(&amp;quot;unit&amp;quot;, &amp;quot;party1&amp;quot;);&lt;br /&gt;
 frame:SetWidth(50); frame:SetHeight(50); frame:SetPoint(&amp;quot;CENTER&amp;quot;);&lt;br /&gt;
 local tex = frame:CreateTexture(); tex:SetAllPoints(); tex:SetTexture(1,0,0);&lt;br /&gt;
 RegisterUnitWatch(frame);&lt;br /&gt;
The snippet above will display a clickable unit frame for the &amp;quot;party1&amp;quot; unit (consisting solely of a red square in the center of your screen) only when one exists.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Responding to custom states&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 local frame = CreateFrame(&amp;quot;FRAME&amp;quot;, &amp;quot;MyStatefulFrame&amp;quot;, UIParent, &amp;quot;SecureHandlerStateTemplate&amp;quot;);&lt;br /&gt;
 frame:SetAttribute(&amp;quot;_onstate-petstate&amp;quot;, [[ -- arguments: self, stateid, newstate&lt;br /&gt;
  if newstate == &amp;quot;nopet&amp;quot; then&lt;br /&gt;
   print(&amp;quot;Where are you, kitty?&amp;quot;);&lt;br /&gt;
  elseif newstate == &amp;quot;mypet&amp;quot; then&lt;br /&gt;
   print(&amp;quot;Oh hai, kitty!&amp;quot;);&lt;br /&gt;
  elseif newstate == &amp;quot;mcpet&amp;quot; then&lt;br /&gt;
   print(&amp;quot;Curse your sudden but inevitable betrayal, kitty!&amp;quot;); -- Your pet is hostile to you.&lt;br /&gt;
  end&lt;br /&gt;
 ]]);&lt;br /&gt;
 RegisterStateDriver(frame, &amp;quot;petstate&amp;quot;, &amp;quot;[target=pet,noexists] nopet;&amp;quot; ..&lt;br /&gt;
  &amp;quot; [target=pet,help] mypet; [target=pet,harm] mcpet&amp;quot;);&lt;br /&gt;
The snippet above will print text to your chat frame when the state of your pet changes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{API Trail Secure}}&lt;/div&gt;</summary>
		<author><name>WoWWiki&gt;Starlightblunder</name></author>
	</entry>
</feed>