Revision as of 23:26, April 4, 2010 by Starlightblunder (Talk | contribs)

(diff) ←Older revision | Latest revision (diff) | Newer revision → (diff)
103,470pages on
this wiki

SecureHandlerStateTemplate is one of the SecureHandler templates introduced in Patch 3.0. Those templates exist in order to allow addon code to execute within a restricted environment, where it may perform protected actions but has access only to a limited subset of the API. SecureHandlerStateTemplate executes snippets whenever any attribute prefixed with "state-" changes value, making it ideal for use in combination with SecureStateDriver.

Snippets Edit

The handler executes the following snippets in a restricted environment:

_onstate-identifier (self, stateid, newstate) 
The snippet is executed when the "state-identifier" attribute changes value; identifier may be any arbitrary string of one or more characters.
Secure frame handle to the frame.
String - identifier of the changed state.
Mixed - new value of the "state-identifier" attribute. Note that if the value is not a string, boolean or a number, it'll be replaced with nil -- this a limitation enforced by the restricted environment.

Example Edit

The frame defined in XML below will be shown only if you have a hostile target. Note that the frame also behaves properly in combat, even though it is protected.

<Frame name="MyStateFrame" inherits="SecureHandlerStateTemplate" parent="UIParent" protected="true">
   <Attribute name="_onstate-foo" value="if newstate == 'show' then self:Show(); else self:Hide(); end" />
   SecureHandler_OnLoad(self); -- Our OnLoad handler overwrites this one, so execute it now.
   RegisterStateDriver(self, "foo", "[target=target,exists,harm] show; hide");
 <Size x="64" y="64"/>
 <Anchors><Anchor point="CENTER"/></Anchors>
 <Layers><Layer level="OVERLAY">
  <Texture name="$parentTex" file="Icons\Temp" setAllPoints="true" />

Around Wikia's network

Random Wiki