Help with login handler
Posted: Sun Aug 11, 2019 4:51 pm
Trying to get group alias and triggers for each character to work,
not sure if it is possible?...
enableAlias and enableTrigger don't seem to be working?..
or am i missing something...
a short vid of the prob..
https://res.cloudinary.com/xiija/video/ ... -42-23.mp4
not sure if it is possible?...
enableAlias and enableTrigger don't seem to be working?..
or am i missing something...
Code: Select all
char = matches[2]
clearWindow("info1")
info1:echo(" \n Login: " ..char.."\n")
-- load table?
login_data = login_data or {}
if io.exists(getMudletHomeDir() .. "/login_data.lua") and table.is_empty(login_data) then
table.load(getMudletHomeDir() .. "/login_data.lua", login_data)
end
-- add character if it doesn't exist?
if table.contains(login_data, char) then
info1:echo(" Already stored! \n")
else
info1:echo(" Setup for: " ..char.. "\n")
table.insert( login_data, { a_name = char, b_class = "blank", c_race = "blank"} )
table.save(getMudletHomeDir() .. "/login_data.lua", login_data)
end
acctSwitch(char)
-- =============== Switch to active character =====================================
function acctSwitch(current)
clearWindow("info2")
-- ====== If NEW Character, Create Groups ================
if exists(current, "alias") == 0 then
permGroup(current, "alias", "Characters")
info2:echo("\nCreating new Alias Group for..." ..current)
end
if exists(current, "trigger") == 0 then
permGroup(current, "trigger", "Characters")
info2:echo("\nCreating new Trigger Group for..." ..current)
end
-- ---------------------------------------------------
-- turn off all character groups
for k,v in ipairs(login_data) do
name = string.format(v.a_name )
info2:echo("\nDisabling... " ..name)
disableTrigger(name)
disableAlias(name)
end
info2:echo("\nSwitching to... " ..current)
init(current)
end
-- ================= Enable Current Character's Groups ===============================
function init(char)
info2:echo("\nLoading Aliases... " ..char)
enableAlias(char)
info2:echo("\nLoading Triggers... " ..char)
enableTrigger(char)
end
-- =============================================
https://res.cloudinary.com/xiija/video/ ... -42-23.mp4