Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Plugins ➜ HelpSystem plugin

HelpSystem plugin

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


Posted by Ked   Russia  (524 posts)  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>
Top

Posted by Nick Gammon   Australia  (23,133 posts)  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
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.


9,317 views.

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

Go to topic:           Search the forum


[Go to top] top

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