send_skill(var* skill, var mode)

send_skill_to(ENTITY*, var* skill, var mode)

send_skill_id(var client_id, var* skill, var mode)

Sends the given entity parameter - for instance, a skill or skill vector - to the server, or from a server to the creator of the entity (send_skill), to a client that has created another entity (send_skill_to), or to a client with a certain id number (send_skill_id). The skill or skill vector is updated on the same entity instance on the target machine.


skill Entity parameter to be sent.
ENTITY* Receiver of the parameter, or NULL for sending to all clients.  LC 
client_id Receiver of the parameter.  LC 

either 0 or a combination of the following flags:

SEND_ALL send the skill to all clients (server only).
SEND_VEC send also the two following skills, when 3 skills represent a vector.
SEND_STRING send a string when the skill was set to a STRING* pointer.  LC 
SEND_UNRELIABLE send in unreliable mode. Otherwise it's sent in reliable mode.
SEND_RATE send only every n-th frame, with n = dplay_entrate/time_step.


0 Parameter not sent due to SEND_RATE or for other reasons.
!= 0 Parameter sent .


Examples (see also the multiplayer tutorial):

// send a skill when it was changed
var skill1_old = -1; // local variable to backup skill1
if (my.skill1 != skill1_old) { // send only if changed
skill1_old = my.skill1; // store change
if (my.skill1 == 0) { // send important values in reliable mode
} else {
} ... // send a string from the server to the clients my.skill80 = str_create("Avatar"); // create a string on clients and server. Make sure to remove it when removing the entity.
if (connection & CONNECT_SERVER) { // running on the server?
str_for_id((STRING*)my.skill80,my.client_id); // set the string to the client name
send_skill(my.skill80,SEND_ALL|SEND_STRING); // send the name to all clients

See also:

EVENT_RECEIVE, send_var, skill1..skill100

► latest version online