Roadmap Writer Posted March 9, 2011 Share Posted March 9, 2011 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 More sharing options...
Darkie Minotaur Posted March 9, 2011 Share Posted March 9, 2011 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 More sharing options...
Roadmap Writer Posted March 9, 2011 Author Share Posted March 9, 2011 Thanks for your directions. The first one also popped up into my mind. But, are, let's say the first 4 or 6 hex digits, enough to discriminate it from others? Or the last ones? Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted March 9, 2011 Share Posted March 9, 2011 Well, if they are randomly generated, it should be enough (not Fort Knox, maybe) - if you really, really, really want to make sure, you would have to check them against each other. Link to comment Share on other sites More sharing options...
Ron Khondji Posted March 9, 2011 Share Posted March 9, 2011 I use this: integer channel() { return (integer)("0x"+llGetSubString((string)llGetOwner(),-8,-1))*-1;} Link to comment Share on other sites More sharing options...
Void Singer Posted March 9, 2011 Share Posted March 9, 2011 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 PS @Ron: 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) 1 Link to comment Share on other sites More sharing options...
Ron Khondji Posted March 10, 2011 Share Posted March 10, 2011 @Ron: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) Thank you. I didn´t know it could start negative. Link to comment Share on other sites More sharing options...
Void Singer Posted March 10, 2011 Share Posted March 10, 2011 ::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 More sharing options...
Roadmap Writer Posted March 10, 2011 Author Share Posted March 10, 2011 Thank you all for your great help! Very much appreciated. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now