Jump to content

Personal Channel

Roadmap Writer

Recommended Posts

For an educational application based on RLV I am working on making a edu-relay for a "realplay" environment.

One of the things I want to establish is a "personal" communication channel. I like to have each member of a roleplay (realplay) his or her own communication channel. Is there a way to define a channel number that depends on the name or id of an avatar, so any object knows how to communicate with an avatar? The personal channel is also used to redirect the chat of an avatar to replace the name of an avatar in chat with the name of the role that is playing.

At the moment all avatars in the role play have their own number in their username. That works, but I am looking for a more general way to make a personal chat channel.

Thanks in advance.

Roadmap Writer.

Link to comment
Share on other sites

There should be several ways to do this. It should be pretty simple to construct a channel integer based on the key which is formed of hexidecimal characters.

If you work with a database, you could also generate a unique random integer that gets stored in the dartabase for each player when they first register.

Just two thoughts that popped up in my mind.



Link to comment
Share on other sites

the standard method of generating a per user channel is to hack up part of their user key, providing a collision chance as low as 1 in 4billion

 vIntChn = !vIntChn + (vIntChn = (integer)("0x" + llGetSubString( llGetOwner(), 0, 7 )));

or as high as 1 in 268 million,

 vIntChn = (integer)("0xF" + llGetSubString( llGetOwner(), 0, 6 ));


but for your purposes, it's much simpler to either have the object listen directly to the person, (then it doesn't matter what channel they're on, because it ignores all others) with

 llListen( channel, llGetOwner(), "", "" );

or even have a general listen, which checks th names of people with a list of character names, and spitouts the dialog that way



return (integer)("0x" + llGetSubString( (string)llGetOwner(), -8, -1 )) | 0x80000000;

... if you were intending to keep the range negative (yours would flip it to positive if it started negative)

  • Like 1
Link to comment
Share on other sites

::nods:: "0x########" treats the integer as a bitfield, if the first of 8 hex digits is >7 (8-F to be precise) it will place a bit in the higest register, which is effectively the flag for negative (fliping that bit has the same effect as adding or subtracting 2147483647)

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now

  • Create New...