Link message

De DigiWiki.

Triggered when the script receives a link message that was sent by a call to llMessageLinked. llMessageLinked is used to send messages from one script to another.

//This is just an example script, you shouldn't handle touches within single script this way.
 
default
{
    touch_start(integer num_detected)
    {
        llMessageLinked(LINK_THIS, 0, llDetectedName(0), llDetectedKey(0));
    }
 
    link_message(integer source, integer num, string str, key id)
    {
        // PUBLIC_CHANNEL has the integer value 0
        llWhisper(PUBLIC_CHANNEL, str + " (" + (string)id + ") touched me!");
    }
}

Useful Snippets:

// This is just an example script, you shouldn't handle link message within single script this way.
 
default
{
     // To propagate an unlimited number of arguments of any type.
     // Presumed, the separator string isn't used in any source string!
 
    state_entry() 
    {    
        list my_list = [1, 2.0, "a string", <1, 2, 3>, <1, 2, 3, 4>, llGetOwner()];  
        string list_parameter = llDumpList2String(my_list, "|");	// Typecast list to a string
        llMessageLinked(LINK_THIS, 0, list_parameter, NULL_KEY)
    }
 
    link_message(integer sender_num, integer num, string list_argument, key id) 
    {
        list re_list = llParseString2List(list_argument, ["|"], [""]);	// Typecast string back to a list
    }    
}
Outils personnels
  • Cette page a été consultée 476 fois.
donate
Google Ads