I show 2 nearly identical scripts but for testing the first sends a message when touched the second receives it and replies, in the hope that examples will save me having to type out a full explanation
.[code=php]
//vkMessageLinked emulator for LSLEditor
//--------------start-------------------\\
list LM; //decodes incomming Link Message format
integer vklink =2; //mylink number
string sep="[<>]"; //seperator - must match both ends
//emulate llMessageLinked()
vkMessageLinked(integer target, integer number, string message, key id)
{llSay(target,(string)vklink+sep+(string)number+sep+message+sep+(string)id);}
//emulate link_message()
vklink_message(string vkmessage)
{
LM=llParseStringKeepNulls(vkmessage,[sep],[]);
integer sender_number =llList2Integer(LM,0);
integer number =llList2Integer(LM,1);
string message =llList2String(LM,2);
key id =llList2Key(LM,3);
//Your link_message code goes here
llOwnerSay(message);
} //<--leave this brace alone

//---------------end--------------------\\
//vkMessageLinked emulator for LSLEditor
default
{
state_entry()
{
llListen(vklink,"","",""
;//vkMessageLinked emulator for LSLEditor}
touch_start(integer total_number)
{
//vkMessageLinked emulator test code
vkMessageLinked(1,100,"test","touched"
;//tell link number 1 we were touched
}
listen(integer channel, string name, key id, string message)
{
if(channel==vklink)vklink_message(message);//vkMessageLinked emulator for LSLEditor
}
}
[/code]
[code=php]
//vkMessageLinked emulator for LSLEditor
//--------------start-------------------\\
list LM; //decodes incomming Link Message format
integer vklink = 1; //mylink number
string sep="[<>]"; //seperator - must match both ends
//emulate llMessageLinked()
vkMessageLinked(integer target, integer number, string message, key id)
{llSay(target,(string)vklink+sep+(string)number+sep+message+sep+(string)id);}
//emulate link_message()
vklink_message(string vkmessage)
{
LM=llParseStringKeepNulls(vkmessage,[sep],[]);
integer sender_number =llList2Integer(LM,0);
integer number =llList2Integer(LM,1);
string message =llList2String(LM,2);
key id =llList2Key(LM,3);
//Your link_message code goes here
llOwnerSay((string)sender_number);
llOwnerSay((string)number);
llOwnerSay(message);
llOwnerSay((string)id);
vkMessageLinked(2,0,"OK got it",NULL_KEY);
} //<--leave this brace alone

//---------------end--------------------\\
//vkMessageLinked emulator for LSLEditor
default
{
state_entry()
{
llListen(vklink,"","",""
;//vkMessageLinked emulator for LSLEditor}
listen(integer channel, string name, key id, string message)
{
if(channel==vklink)vklink_message(message);//vkMessageLinked emulator for LSLEditor
}
}
[/code]
Create 2 scripts in LSLEditor (or 2 Objects in world), place one script in each and touch the first object.
Just remember that a script cannot hear itself in chat so this emulation cannot simulate that aspect of llLink_Message. However, the vklink_message() function could be used to forward the call, to the scripts own link_message() function as follows:
CODE
[/php]
//emulate link_message()
vklink_message(string vkmessage)
{
LM=llParseStringKeepNulls(vkmessage,[sep],[]);
integer tmp =llList2Integer(LM,0);
integer num =llList2Integer(LM,1);
string str =llList2String(LM,2);
key id =llList2Key(LM,3);
//Your link_message code goes here
llMessageLinked(LINK_THIS,num,str,id);
} //<--leave this brace alone :)
With a bit of tweaking, and listening on several channels, it should be possible to emulate the constants such as LINK_ALL, LINK_THIS etc. But as I never use them in my scripts I will leave that as an exercise for the reader.