Hi here, need your help I've messed up with else if or etc make 0 1 as a var... don't get it at all ;_;
I'm trying to make a toggle function with one keybinds, bindings.xml part is ok for me but have no more idea for lua... u_u
Basicaly, I want 0 became 1 or 1 became 0 ... ^^;
Lua Code:
local function helm()
local control = ZO_OptionsWindow.controlTable[3][8]
SetSetting(control.system, control.settingId, 0)
end
--or
local function nohelm()
local control = ZO_OptionsWindow.controlTable[3][8]
SetSetting(control.system, control.settingId, 1)
end
Thanks for your help :c
Edit :
where I am now ... ; ;
Lua Code:
function toghelm()
local control = ZO_OptionsWindow.controlTable[3][8]
SetSetting(control.system, control.settingId, (var))
var = x
if x == 0 then return nohelm()
elseif x == 1 then return helm()
end
end
local function helm()
local control = ZO_OptionsWindow.controlTable[3][8]
SetSetting(control.system, control.settingId, 0)
end
local function nohelm()
local control = ZO_OptionsWindow.controlTable[3][8]
SetSetting(control.system, control.settingId, 1)
end
tried also something like
Lua Code:
function toghelm()
local control = ZO_OptionsWindow.controlTable[3][8]
SetSetting(control.system, control.settingId, (var))
var = helmvar
if helmvar == 1 then var = 0
elseif helmvar == 0 then var = 1
end
end
Well, those always return 0 (helm is on) ... but can't catch the way to make 0 to 1 et 1 to 0 at function execution ^^;
one more try...
Lua Code:
function toghelm()
local control = ZO_OptionsWindow.controlTable[3][8]
local helmstate = GetSetting(control.system, control.settingId)
if helmstate == 1 then return helm()
elseif helmstate == 0 then return nohelm()
end
end
local function helm()
local control = ZO_OptionsWindow.controlTable[3][8]
SetSetting(control.system, control.settingId, 0)
end
local function nohelm()
local control = ZO_OptionsWindow.controlTable[3][8]
SetSetting(control.system, control.settingId, 1)
end
really don't get it