Resource:Helpmanager

From Multi Theft Auto: Wiki
Revision as of 19:19, 13 November 2007 by Jbeta (talk | contribs) (Doc'd helpmanager)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The help manager centralizes script help GUIs and provides a simple way to add instructions.

Usage

Simple GUI

If you just want to add a text, adding this exact (don't change src nor type) line to your meta.xml will be enough:

<config src="help.xml" type="client"/>

The contents below the root node of your help.xml file will be shown under the resource's help tab.

Custom GUI

You can add your custom help GUI by adding the tab manually in a client script:

myHelpTab = call(getResourceFromName("helpmanager"), "addHelpTab", getThisResource())

You can add contents by using the returned GUI element as GUI parent for your widgets.

Commands

help: toggles the help window.

Exported functions

Server

bool showHelp ( element showTo )

Shows the help window for the showTo element, propagating down the tree.

bool hideHelp ( element hideTo )

Hides the help window for the hideTo element, propagating down the tree.

Client

bool showHelp ()

Shows the help window for the local player.

bool hideHelp ()

Hides the help window for the local player.

gui-tab addHelpTab ( resource forResource )

Adds a gui-tab with the name of the resource passed to the local player's help GUI.

Fired events

Client

(For all events, "source" is the local player.)

onHelpShown ()
onHelpHidden ()