Help with login handler

Post Reply
User avatar
XMODS
Posts: 6
Joined: Tue Aug 06, 2019 2:06 am

Help with login handler

Post by XMODS »

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...

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

-- =============================================
 
a short vid of the prob..
https://res.cloudinary.com/xiija/video/ ... -42-23.mp4

Caled
Posts: 403
Joined: Thu Apr 09, 2009 4:45 am

Re: Help with login handler

Post by Caled »

Heya

Code: Select all

disableAlias('name in here')
disableTrigger('name in here')
enableAlias('name in here')
enableTrigger('name in here')
Those work, BUT
The script editor is a bit screwy and they don't visibly change to reflect that the group has been enabled/disabled until you click on it. Also, sometimes when you do click on them, they appear greyed out.

But the commands do actually work.

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Help with login handler

Post by Vadi »

It's intended that it doesn't show the latest status, otherwise when you have it open it'd be updating icons all the time and in a massive system, that would really slow things down.

Post Reply