[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Plugins
. . -> [Subject]  HelpSystem plugin

HelpSystem plugin

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Ked   Russia  (524 posts)  [Biography] bio
Date Wed 09 Nov 2005 10:21 AM (UTC)
Message
Trying to get a grip on Lua I've written this thing to provide a central access point for help pages of all plugins installed in a world. After installing type "#help" and it should bring up a menu of plugins, after that typing "#help <menu_number>" will display the description for the corresponding plugin. The output is in no way formatted, so it might not look too good unless you take care to format the descriptions of your plugins for presentation inside Mushclient.



<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- MuClient version 3.68 -->

<!-- Plugin "HelpSystem" generated by Plugin Wizard -->

<muclient>
<plugin
   name="HelpSystem"
   author="Ked"
   id="4436c2b199a520b71736d800"
   language="Lua"
   purpose="Organizing the presentation of plugin help pages"
   save_state="y"
   date_written="2005-11-09"
   requires="3.65"
   version="1.1"
   >
<description trim="y">
<![CDATA[
Help system

#help    -   brings up a menu of available pages
#help n  -   display help for plugin number n

]]>
</description>

</plugin>


<aliases>
<alias name="HelpMenu" match="#help" send_to="12" enabled="y"><send>DisplayMenu()</send></alias>
<alias name="HelpEntry" match="^[#]help ([0-9]+)$" send_to="12" enabled="y" regexp="y">
	<send>DisplayHelpFile(%1)</send></alias>
</aliases>

<!--  Script  -->


<script>
<![CDATA[
function getIDs()
    local idList = {}
    for k,v in pairs(GetPluginList()) do
        idList[v] = GetPluginInfo(v,1)
    end
    return idList
end


menu = {}

function DisplayMenu(...)
    menu = {}
    local idList = getIDs()
    AnsiNote(ANSI(37,1,44), "PLUGIN HELP FILE INDEX\n")
    
    AnsiNote(ANSI(37), "To view the help file of a plugin type #HELP, followed by the menu number of that plugin.\n")
    
    local c = 1
    for k,v in pairs(idList) do
	local name = v
	AnsiNote(" ", ANSI(37), tostring(c), ") ", name)
	menu[c] = k
	c= c + 1
    end
    AnsiNote("\n", ANSI(0))
end

function DisplayHelpFile(num)
    if menu[num] == nil then
        AnsiNote(ANSI(37), "Unable to find menu entry " .. tostring(num))
        return
    end
    local name = GetPluginInfo(menu[num], 1)
    AnsiNote(ANSI(37,1,44), "HELP FOR PLUGIN: " .. string.upper(name) .. "\n")
    AnsiNote(ANSI(37), GetPluginInfo(menu[num], 3) .. "\n")

end
]]>
</script>


<!--  Plugin help  -->

<aliases>
  <alias
   script="OnHelp"
   match="HelpSystem:help"
   enabled="y"
  >
  </alias>
</aliases>

<script>
<![CDATA[
function OnHelp ()
  world.Note (world.GetPluginInfo (world.GetPluginID (), 3))
end
]]>
</script> 

</muclient>
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Thu 10 Nov 2005 05:09 AM (UTC)
Message
Yep, seems to work as advertised! Thanks. :)

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


8,417 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]