gms_chat_ext

Gebruik: gms_chat_ext ( text, color, tag )

Omschrijving

Sends a chat message with a custom tag. The text and color arguments are equivalent to the gms_chat script.

The tag argument can be a string of no more than 96 characters. You can use this to store additional information about the chat message.

Chat messages accompanied by a tag do not show up in the default chat box. You must register a custom script with gms_script_set_chat_receive to handle these chat messages.

Voorbeeld

// Set the receive script after gms_settings

gms_script_set_chat_receive(on_chat_receive)

// Prepare the tag data

var data = ds_map_create();
data[? "s"] = spr_bobby // custom sprite for the message

data[? "i"] = image_index // custom index

data[? "r"] = room

// Send the chat message with the tag encoded as JSON

gms_chat_ext(keyboard_string, c_red, json_encode(tag))
ds_map_destroy(data)

// Script: on_chat_receive

var sender_id = argument0, text = argument1, color = argument2, tag = argument3;
// Only process custom messages that don't show up in the default chat

if tag != "" 
{
    // Decode the tag data

    var data = json_decode(tag);

    // Only show the custom message if we're in the same room

    if room == data[? "r"]
    {
        // TODO: Show custom chat message with text, color, data[? "s"], data[? "i"]

    }

    ds_map_destroy(data)
}

Reacties (0)

Laatste bericht op -