Thursday 15 March 2012

LUA - OnUpdate shift modifier -



LUA - OnUpdate shift modifier -

i'm changing in addon world of warcraft written in lua. there simple boolean variable determines if "all" frames shown or specific one.

so when = true show specific frames when = false show frames

i want create modifier shift key show frames when shiftkey pressed , hide them 1 time again when shift realeased.

if isshiftkeydown() cfg.aura.onlyshowplayer = false else cfg.aura.onlyshowplayer = true end

this simple solution works. problem here though works on starting of script. see in wow everytime interface gets loaded run script if not told otherwise. not efficent because send user loadingscreen.

onupdate should prepare problem here run specific code everytime frame gets rendered pretty handy , want accomplish.

so made

local function onupdate(self,elapsed) if isshiftkeydown() cfg.aura.onlyshowplayer = false else cfg.aura.onlyshowplayer = true end end local shiftdebuffs = createframe("frame") shiftdebuffs:setscript("onupdate", onupdate)

my problem doesn't work. new onupdate stuff , re-create pasted addon did worked fine. right goes straight = false, happening think because default.

thanks help

right goes straight = false, happening think because default.

no, there no "default" branch in if statement. command then branch status has evaluated true. need check logic, if script executed cfg.aura.onlyshowplayer = false, means isshiftkeydown() evaluated true.

lua shift modifier

No comments:

Post a Comment