Zesstra | 152dd7b | 2025-07-30 22:23:11 +0200 | [diff] [blame] | 1 | ReceiveWave() |
| 2 | ============= |
| 3 | |
| 4 | FUNKTION |
| 5 | -------- |
| 6 | |
| 7 | public int ReceiveDynWave(struct wave_s wave, string msg_action = comm_guess_action(), object origin = previous_object()); |
| 8 | |
| 9 | DEFINIERT IN |
| 10 | ------------ |
| 11 | |
| 12 | /std/living/comm.c |
| 13 | |
| 14 | ARGUMENTE |
| 15 | --------- |
| 16 | |
| 17 | struct wave_s* wave |
| 18 | Die auszugebende Nachrichten mit Zusatzinformationen. (s.u.) |
| 19 | string action |
| 20 | action wird als <action> an ReceiveMsg() weitergegeben |
| 21 | object origin |
| 22 | Absenderobjekt der Nachricht (Default: previous_object()) |
| 23 | |
| 24 | BESCHREIBUNG |
| 25 | ------------ |
| 26 | |
| 27 | Sendet die in <wave> angegebene Nachricht an den Empfaenger. |
| 28 | |
| 29 | Im Unterschied zu ReceiveWave() wird ein Variable namens cl in <wave> vorher ausgewertet und kann dynamisch eine neue/geaenderte <wave> liefern, welche dann ausgegeben wird. |
| 30 | |
| 31 | Hierbei ist <wave> also eine von wave_s erbende struct, welche (mindestens) eine Variable <cl> vom Typ closure zusaetzlich besitzt. |
| 32 | |
| 33 | RUECKGABEWERT |
| 34 | ------------- |
| 35 | |
| 36 | Der Rueckgabe ist der Rueckgabewert von ReceiveMsg(). |
| 37 | |
| 38 | BEISPIEL |
| 39 | -------- |
| 40 | |
Zesstra | bec19a9 | 2025-07-30 22:28:17 +0200 | [diff] [blame] | 41 | .. code-block:: pike |
Zesstra | 152dd7b | 2025-07-30 22:23:11 +0200 | [diff] [blame] | 42 | |
| 43 | // von wave_s abgeleitete struct |
| 44 | struct dynwave_s (wave_s) { |
| 45 | closure cl; |
| 46 | } |
| 47 | struct dynwave_s wave = (<dynwave_s> msg: "Pass auf! Ein boeser, schwarzer Drache!", |
| 48 | type: MT_LISTEN, prefix: "Humni ruft: "); |
| 49 | wave.cl = function struct wave_s (struct wave_s wave) |
| 50 | { wave.prefix = ({"Humni","Jof","Zook"})[random(3)] + " ruft: "; |
| 51 | return wave; |
| 52 | }; |
| 53 | ReceiveWave(wave, MA_LISTEN); |
| 54 | |
| 55 | |
| 56 | SIEHE AUCH |
| 57 | ---------- |
| 58 | |
| 59 | :doc:`ReceiveMsg`, :doc:`ReceiveWave` |
| 60 | |
| 61 | Letzte Aenderung: 30.07.2025, Zesstra |
| 62 | |
| 63 | |