Skip to content
everloot

Lore archive · Warcraft Wiki, 2023 dump

SecureHandlerStateTemplate

Last wiki revision 2010-04-04

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.

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.
  • self : Secure frame handle to the frame.
  • stateid : String - identifier of the changed state.
  • newstate : 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.

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

Source

https://warcraft.wiki.gg/wiki/SecureHandlerStateTemplate · retrieved 2023-11-13 · CC BY-SA 4.0

Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.

This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.