Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 1 | SYNOPSIS |
| 2 | int notify_fail(string str) |
| 3 | int notify_fail(closure cl) |
| 4 | |
| 5 | BESCHREIBUNG |
| 6 | Der String <str> wird als Kommando-Fehlermeldung anstelle des default |
| 7 | "What?" gespeichert. Das Resultat ist stets 0. |
| 8 | |
| 9 | Wird eine Closure als Argument gegeben, wird sie im Fehlerfall |
| 10 | (also erst wenn ein Kommando endgueltig fehlgeschlagen hat) |
| 11 | ausgefuehrt und hat die Fehlermeldung als Resultat |
| 12 | zurueckzugeben. Die Closure erhaelt als Argument den |
| 13 | originalen Befehlsgeber; in der Regel dies ist this_player(), |
| 14 | was aber vom MODIFY_CMD hook geaendert werden kann. |
| 15 | |
| 16 | Wird notify_fail() mehr als einmal fuer ein Kommando |
| 17 | aufgerufen, wird lediglich der letzte Aufruf gewertet. |
| 18 | notify_fail() erkennt verschachtelte Kommandos (siehe Efun |
| 19 | command()), und ein notify_fail() in einem Unterkommando |
| 20 | hat keinen Einfluss auf das uebergeordnete Kommando. |
| 21 | |
| 22 | BEISPIELE |
| 23 | Verwendet man |
| 24 | |
Zesstra | 5481d49 | 2021-04-08 20:07:06 +0200 | [diff] [blame] | 25 | notify_fail(message); return 0; |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 26 | |
| 27 | anstelle von |
| 28 | |
| 29 | write(message); return 1; |
| 30 | |
| 31 | erhalten andere Objekte ihre Chance, das Kommando |
| 32 | (erfolgreich) auszufuehren. |
| 33 | |
| 34 | SIEHE AUCH |
| 35 | add_action(E), command(E), query_verb(E), query_command(E), |
| 36 | query_notify_fail(E), hooks(C) |