Page 1 of 1

Howto: Implement Help System?

Posted: Wed Sep 09, 2009 1:11 am
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

Re: Howto: Implement Help System?

Posted: Wed Sep 09, 2009 12:58 pm
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.

Re: Howto: Implement Help System?

Posted: Sat Sep 12, 2009 8:37 pm
by eraldo
Great idea Heiko!