Jump to content
  • 0

Apply a tag to a chat comment?


Syaoran Nyoki
 Share

You are about to reply to a thread that has been inactive for 4091 days.

Please take a moment to consider if this thread is worth bumping.

Question

I'm making a game in SL. I have a lot of avatar players and they are all sitting in chairs. I can't figure out a way to tag their comment so when they chat something, the tag will say what team they are on. For example in chat I want it to say:

AVATAR NAME

Team 1 - Comment

Anyone have any ideas?

 

Thank you!

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

That's not going to be easy, because there's no way to add a tag directly to what an avatar says.  You'll have to create a listener -- a repeater -- that picks up each person's chat, adds a tag, and then rebroadcasts it.  That part is not hard, but it will make chat extremely confusing, becuase each person will hear the original message (without the tag) followed immediately by the second one (with the tag).  The only way I can think of to beat that problem is to have each person broadcast public chat on a private channel that only the repeater can hear.  You can do that with certain third party viewers -- Firestorm, for example -- but not with V3 or most of the others.  So, it's technically possible, but it would be a real challenge to do in a crowd.  Not worth the trouble, if you ask me.

  • Like 1
Link to comment
Share on other sites

  • 0

Easy, use RLV. Redirect chat from local and push it through a listener/talker that prepends the Team Number in some easy-to-read format via its object name. This would make it look like:-

(Team 1) :     Freya Mokusei: Stuff!

Text colouring is not practical, but prepending the team name ahead of the Display Name would make things much clearer.

As Rolig says above though, it may cause issues with random players.

Link to comment
Share on other sites

  • 0

You can use this piece of code, but it requires that you enter the name of the persons in team 1 and team 2 into the lists (lTeam1 and lTeam2):

 

string sTag1 = ", Team 1: ";
string sTag2 = ", Team 2: ";
list lTeam1 = ["MartinRJ Fayray","name2"]; //add names here
list lTeam2 = ["MartinRJ Resident","name4"]; //add names here
default
{
    state_entry()
    {
        llListen(PUBLIC_CHANNEL, "", NULL_KEY, "");
    }
    listen(integer channel, string name, key id, string message)
    {
        string sTag;
        list keys = llGetAgentList(AGENT_LIST_PARCEL, []);
        integer iNumber;
            if (llListFindList(lTeam1, [llKey2Name(id)]) != -1)
            { //in team 1
                for (iNumber = 0; iNumber < llGetListLength(keys); iNumber++)
                {
                    if (llList2Key(keys, iNumber) != id)
                    {
                        llRegionSayTo(llList2Key(keys, iNumber), PUBLIC_CHANNEL, name + sTag1 + message);
                    }
                }
                return;
            }
            if (llListFindList(lTeam2, [llKey2Name(id)]) != -1)
            { //in team 2
                for (iNumber = 0; iNumber < llGetListLength(keys); iNumber++)
                {
                    if (llList2Key(keys, iNumber) != id)
                    {
                        llRegionSayTo(llList2Key(keys, iNumber), PUBLIC_CHANNEL, name + sTag2 + message);
                    }
                }
                return;
            }
    }
}

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4091 days.

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
 Share

×
×
  • Create New...