Howto: Implement Help System?

Post Reply
eraldo
Posts: 43
Joined: Sun Jul 12, 2009 1:25 am

Howto: Implement Help System?

Post by eraldo »

I want to make a help system for my profile...

It should work something like this:
/help >> get general help
/help <topic> >> get help text related to this topic

I thought I could do it like this:
- make a table with all the help texts:

Code: Select all

    help = {}
    help.<topic> = [[some "help text" here]]
    ...
- call it like this:
- alias pattern: "^/help (.*)?$"
- alias script:

Code: Select all

    echo( help[ matches[ 2 ] ] )
- example: Input: "/help prompt" >> Output: "You can setup your prompt with: /setPrompt"

Better method... but seems harder to me!
I want to use the same thing to enable and disable scripts and get script info about them:
/script <scriptname> <command>

examples:
/script help
/script prompt load
/script prompt help
/script prompt set

In this case... depending on the 'command' I want to do different things like show or run something.

How could I go about making/structuring this?
Any other ideas are welcome as well. ;)

Greetings,
Eraldo

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: Howto: Implement Help System?

Post by Heiko »

alias pattern must be: "^/help\s?(.*)"

As you are building a complex profile for the MUD Avalon that will be used by many users with different classes, guilds and races it would make more sense to use a HTML manual in a browser in my opinion. This is simply more readable and easier to write.
I will add a function to open a browser & a locally stored webpage that you can distribute with the profile e.g. openWebBrowser( getMudletHomeDir() .. "/manual.html"). You can already do this with the built in Lua operating system library.

eraldo
Posts: 43
Joined: Sun Jul 12, 2009 1:25 am

Re: Howto: Implement Help System?

Post by eraldo »

Great idea Heiko!

Post Reply