on_client
This event is executed when a client receives a message
from the server. The event_type variable is set
to the type of the message. When the message contains a string, a pointer
to the received string is handed over as parameter to the function.
Remarks:
There are 3 types of client events:
|
EVENT_STRING |
The server has sent a string with send_string_to. The string pointer
is passed as the first argument. |
| EVENT_VAR |
The server has sent a variable or struct with send_var_to. The address
is passed as the first argument. |
| EVENT_DATA |
The server has
sent a data buffer with send_data_to.
The buffer address is passed as the first argument. The buffer is only
valid during the event function and deallocated afterwards. |
Example:
// client received message -> display it
TEXT* tMessage = { string(""); flags = VISIBLE; }
function client_event(void* str)
{
if ((event_type == EVENT_STRING) && (str == &mystring))
{
str_cpy((tMessage.pstring)[0],"STRING mystring was just changed!");
}
}
...
on_client = client_event;
See also:
on_server,
send_string_to, send_var_to, send_data_to