A
          / \      _             Play Now                         Nemesis on fb
          | |     | |  _______   _        _   _______    _______   _    _______
          | |\    | | |   ____| |  \    /  | |   ____|  /   ____| | |  /   ____|
 /-------/-------------------------------------------------------------------,
O= Home <=XX|  About  News  Pics  Adventurers  Wizards  Download  Connect     >
 \-------\-------------------------------------------------------------------'
          | |   \   | |  |____  | |      | | |  |____   ___ \  \  | |  ___ \  \
          | |     \_| |_______| |_|      |_| |_______| |_______/  |_| |_______/
          \ /
           V  

Documentation Area

Document Path: /doc/lib/notify_fail


Simul efun: notify_fail - set customized error messages

Synopsis:
	void notify_fail(string str);

Description:
	Store 'str' as the error message given instead of the default
	funny error messages like "Huh?" and 'What ?'.

	If notify_fail() is called more than once, only the last call
	will be used.

	The idea of this function is to give command related error messages.

Return value:
	false

Examples:
	This could be some code of a safe in room. And perhaps the player
	is carrying a book. The player wants to "turn page" of his book.
	So the code below does not block the action "turn" if the player
	types "turn page". But if the player does not have an object with
	the action "turn" he would get the error message "Turn what?"

	init() {
		add_action("turn_wheel", "turn");
	}

	turn_wheel(str) {
		if (str != "wheel") {
			notify_fail("Turn what?\n");
			return 0;
		}
		write("You turn the wheel.\n");
		...
	}

Note:
	A function of an add_action should return 0, if it fails e.g. as
	the argument of the verb does not fit. And it must not give an error
	message as another object might have/offer the same action/verb.

See also:


This page was generated in LPC

Imprint / Impressum