<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.mudlet.org/index.php?action=history&amp;feed=atom&amp;title=Manual%3AIDManager</id>
	<title>Manual:IDManager - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.mudlet.org/index.php?action=history&amp;feed=atom&amp;title=Manual%3AIDManager"/>
	<link rel="alternate" type="text/html" href="https://wiki.mudlet.org/index.php?title=Manual:IDManager&amp;action=history"/>
	<updated>2026-06-07T14:14:10Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.0</generator>
	<entry>
		<id>https://wiki.mudlet.org/index.php?title=Manual:IDManager&amp;diff=18424&amp;oldid=prev</id>
		<title>Demonnic: Demonnic moved page Area 51/IDManager to Manual:IDManager without leaving a redirect: released with 4.14</title>
		<link rel="alternate" type="text/html" href="https://wiki.mudlet.org/index.php?title=Manual:IDManager&amp;diff=18424&amp;oldid=prev"/>
		<updated>2021-11-25T19:55:53Z</updated>

		<summary type="html">&lt;p&gt;Demonnic moved page &lt;a href=&quot;/index.php?title=Area_51/IDManager&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Area 51/IDManager (page does not exist)&quot;&gt;Area 51/IDManager&lt;/a&gt; to &lt;a href=&quot;/w/Manual:IDManager&quot; title=&quot;Manual:IDManager&quot;&gt;Manual:IDManager&lt;/a&gt; without leaving a redirect: released with 4.14&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 19:55, 25 November 2021&lt;/td&gt;
				&lt;/tr&gt;
&lt;!-- diff cache key wikidb:diff::1.12:old-18292:rev-18424 --&gt;
&lt;/table&gt;</summary>
		<author><name>Demonnic</name></author>
	</entry>
	<entry>
		<id>https://wiki.mudlet.org/index.php?title=Manual:IDManager&amp;diff=18292&amp;oldid=prev</id>
		<title>Demonnic: /* Introduction */</title>
		<link rel="alternate" type="text/html" href="https://wiki.mudlet.org/index.php?title=Manual:IDManager&amp;diff=18292&amp;oldid=prev"/>
		<updated>2021-10-18T23:14:49Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Introduction&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 23:14, 18 October 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l3&quot; &gt;Line 3:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Introduction =&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Introduction =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The IDManager is a new item available in Mudlet 4.14+ which allows you to create named tempTimers and event handlers. Mudlet comes with a set of functions for creating named timers and events, and these functions &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;use a default &lt;/del&gt;IDManager &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;which &lt;/del&gt;is &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;created &lt;/del&gt;for &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;the entire profile when &lt;/del&gt;you &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;load it. If &lt;/del&gt;you want to &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;isolate &lt;/del&gt;your &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;named timers &lt;/del&gt;and &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;event handlers from the rest of the profile so you don&amp;#039;t have to worry as much about name collisions&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;then you can get &lt;/del&gt;your own IDManager &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;object &lt;/del&gt;to &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;register &lt;/del&gt;things &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;with&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The IDManager is a new item available in Mudlet 4.14+ which allows you to create named tempTimers and event handlers. Mudlet comes with a set of functions for creating named timers and events, and these functions &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;create an &lt;/ins&gt;IDManager &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;for each &amp;quot;username&amp;quot; that registers one. This page &lt;/ins&gt;is for &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;if &lt;/ins&gt;you &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;decide &lt;/ins&gt;you want &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;direct access &lt;/ins&gt;to your &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;own IDManager instance rather than letting Mudlet handle it for you. For most people, simply using registerNamedEventHandler(userName, handlerName, eventName, functionReference) &lt;/ins&gt;and &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;accompanying functions will be sufficient&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;creating &lt;/ins&gt;your own IDManager &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;would mostly be for if you prefer an Object Oriented approach &lt;/ins&gt;to things&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;, or want to build your own functionality on top without using the existing functions as the intermediary&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Motivation ===&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Motivation ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wikidb:diff::1.12:old-18285:rev-18292 --&gt;
&lt;/table&gt;</summary>
		<author><name>Demonnic</name></author>
	</entry>
	<entry>
		<id>https://wiki.mudlet.org/index.php?title=Manual:IDManager&amp;diff=18285&amp;oldid=prev</id>
		<title>Demonnic: IDManager documentation</title>
		<link rel="alternate" type="text/html" href="https://wiki.mudlet.org/index.php?title=Manual:IDManager&amp;diff=18285&amp;oldid=prev"/>
		<updated>2021-10-17T00:27:02Z</updated>

		<summary type="html">&lt;p&gt;IDManager documentation&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
&lt;br /&gt;
The IDManager is a new item available in Mudlet 4.14+ which allows you to create named tempTimers and event handlers. Mudlet comes with a set of functions for creating named timers and events, and these functions use a default IDManager which is created for the entire profile when you load it. If you want to isolate your named timers and event handlers from the rest of the profile so you don&amp;#039;t have to worry as much about name collisions, then you can get your own IDManager object to register things with.&lt;br /&gt;
&lt;br /&gt;
=== Motivation ===&lt;br /&gt;
&lt;br /&gt;
Handling the IDs returned by tempTimer and registerAnonymousEventHandler is some of the most repeated code in Mudlet, and also some of the most frequently forgotten. We get a lot of people through the help channel with duplicated event handlers because they didn&amp;#039;t know to capture and kill the previous handler ID first. It&amp;#039;s been asked in the past several times if they could provide their own ID. We got asked one too many times and decided to fix it.&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
&lt;br /&gt;
As these are the underlying functions which drive the named timers and event handlers for functions like registerNamedEventHandler, each function will be described and then a link to the corresponding documentation in the main API given. Also, events and timers differ largely in name, so I will cover them in tandem. All examples assume you&amp;#039;ve created an IDManager and stored it as myIDM.&lt;br /&gt;
&lt;br /&gt;
=== Creation ===&lt;br /&gt;
&lt;br /&gt;
Creating a new IDManager is as simple as requesting one from getNewIDManager(). It is recommended you do guard against overwriting these, as they contain all the references to the managed timers and events, and you don&amp;#039;t want to lose that.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
myIDM = myIDM or getNewIDManager()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Register a new handler or timer ===&lt;br /&gt;
&lt;br /&gt;
The registration functions return true if the handler or timer was registered successfully, or nil+error if something goes wrong. If you register something to the same name twice, the old handler or timer is killed and reregistered with the new information. This means duplicates with the same name are impossible. Timer names and handler names are checked separately, you can have one of each named &amp;quot;thing&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
;See: [[Manual:Lua_Functions#registerNamedEventHandler|registerNamedEventHandler()]], [[Manual:Lua_Functions#registerNamedTimer|registerNamedTimer()]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local ok,err = myIDM:registerEvent(&amp;quot;vitals&amp;quot;, &amp;quot;gmcp.Char.Vitals&amp;quot;, demonnic.handleVitals)&lt;br /&gt;
if not ok then&lt;br /&gt;
  cecho(&amp;quot;Something went wrong registering the vitals handler! Panic!\n&amp;quot;)&lt;br /&gt;
  cecho(&amp;quot;ERROR was: &amp;quot; .. err)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local ok,err = myIDM:registerTimer(&amp;quot;balance&amp;quot;, 1, demonnic.checkBalance)&lt;br /&gt;
if not ok then&lt;br /&gt;
  cecho(&amp;quot;Something went wrong registering the balance timer! PANIC!\n&amp;quot;)&lt;br /&gt;
  cecho(&amp;quot;ERROR was: &amp;quot; .. err)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Stop a handler or timer ===&lt;br /&gt;
&lt;br /&gt;
A stopped handler or timer is available to be resumed.&lt;br /&gt;
&lt;br /&gt;
;See: [[Manual:Lua_Functions#stopNamedEventHandler|stopNamedEventHandler()]], [[Manual:Lua_Functions#stopNamedTimer|stopNamedTimer()]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local ok = myIDM:stopEvent(&amp;quot;vitals&amp;quot;)&lt;br /&gt;
if not ok then&lt;br /&gt;
  printDebug(&amp;quot;&amp;#039;vitals&amp;#039; event not registered yet&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local ok = myIDM:stopTimer(&amp;quot;balance&amp;quot;)&lt;br /&gt;
if not ok then&lt;br /&gt;
  printDebug(&amp;quot;&amp;#039;balance&amp;#039; timer not registered yet&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Resume a stopped handler or timer ===&lt;br /&gt;
&lt;br /&gt;
Returns false if the handler or timer hasn&amp;#039;t been registered yet. If it has, it cancels it if it&amp;#039;s running currently and reregisters it with the saved information.&lt;br /&gt;
&lt;br /&gt;
;See: [[Manual:Lua_Functions#resumeNamedEventHandler|resumeNamedEventHandler()]], [[Manual:Lua_Functions#resumeNamedTimer|resumeNamedTimer()]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local ok = myIDM:resumeEvent(&amp;quot;vitals&amp;quot;)&lt;br /&gt;
if not ok then&lt;br /&gt;
  printDebug(&amp;quot;&amp;#039;vitals&amp;#039; event not registered yet&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local ok = myIDM:resumeTimer(&amp;quot;balance&amp;quot;)&lt;br /&gt;
if not ok then&lt;br /&gt;
  printDebug(&amp;quot;&amp;#039;balance&amp;#039; timer not registered yet&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== List handlers or timers ===&lt;br /&gt;
&lt;br /&gt;
Sometimes you want to know what handlers or timers are already registered, whether for display purposes or checking configuration.&lt;br /&gt;
&lt;br /&gt;
;See [[Manual:Lua_Functions#getNamedEventHandlers|getNamedEventHandlers()]], [[Manual:Lua_Functions#getNamedTimers|getNamedTimers()]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local handlerList = myIDM:getEvents()&lt;br /&gt;
-- { &amp;quot;vitals&amp;quot; } if only a &amp;quot;vitals&amp;quot; handler has been registered&lt;br /&gt;
&lt;br /&gt;
local timerList = myIDM:getTimers()&lt;br /&gt;
-- { &amp;quot;balance&amp;quot; } if only a &amp;quot;balance&amp;quot; timer has been registered&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Delete a handler or timer ===&lt;br /&gt;
&lt;br /&gt;
A deleted handler or timer is gone forever unless reregistered. If you might use it again you may as well stop it instead. &lt;br /&gt;
&lt;br /&gt;
;See: [[Manual:Lua_Functions#deleteNamedEventHandler|deleteNamedEventHandler()]], [[Manual:Lua_Functions#deleteNamedTimer|deleteNamedTimer()]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local ok = myIDM:deleteEvent(&amp;quot;vitals&amp;quot;)&lt;br /&gt;
if not ok then&lt;br /&gt;
  printDebug(&amp;quot;&amp;#039;vitals&amp;#039; event not registered yet&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local ok = myIDM:deleteTimer(&amp;quot;balance&amp;quot;)&lt;br /&gt;
if not ok then&lt;br /&gt;
  printDebug(&amp;quot;&amp;#039;balance&amp;#039; timer not registered yet&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Stop all handlers or timers ===&lt;br /&gt;
&lt;br /&gt;
You can stop all of your registered handlers or timers at once using these functions&lt;br /&gt;
&lt;br /&gt;
;See: [[Manual:Lua_Functions#stopAllNamedEventHandlers|stopAllNamedEventHandlers()]], [[Manual:Lua_Functions#stopAllNamedTimers|stopAllNamedTimers()]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
myIDM:stopAllEvents()&lt;br /&gt;
&lt;br /&gt;
myIDM:stopAllTimers()&lt;br /&gt;
&lt;br /&gt;
-- do both in one call&lt;br /&gt;
myIDM:emergencyStop()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Delete all handlers or timers ===&lt;br /&gt;
&lt;br /&gt;
For when you just want to clear it all out and start over.&lt;br /&gt;
&lt;br /&gt;
;See: [[Manual:Lua_Functions#deleteAllNamedEventHandlers|stopAllNamedEventHandlers()]], [[Manual:Lua_Functions#deleteAllNamedTimers|stopAllNamedTimers()]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
myIDM:deleteAllEvents()&lt;br /&gt;
&lt;br /&gt;
myIDM:deleteAllTimers()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Demonnic</name></author>
	</entry>
</feed>