Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Remove avatar name from chat?

Reno Katscher
Registered User
Join date: 2 Jun 2007
Posts: 18
01-27-2008 07:38
I got this really cool free attatchment on SLex. When you type on the specified channel, you do not see the avatar name. For example /7 Reno smiles would output Reno smiles, as apposed to Reno Katscher: Reno smiles

Can someone point me in the direction to start with this?
Day Oh
Registered User
Join date: 3 Feb 2007
Posts: 1,257
01-27-2008 07:52
integer hListen;

Listen()
{
llListenRemove(hListen);
hListen = llListen(7, "", llGetOwner(), "";);
}

default
{

state_entry()
{
Listen();
}
changed(integer change)
{
if(change & CHANGED_OWNER)
{
Listen();
}
}

listen(integer channel, string name, key id, string message)
{
string firstword;
string remainder;
integer firstspace = llSubStringIndex(message, " ";);
if(firstspace == -1)
{
firstword = message;
remainder = " ";
}
else
{
firstword = llGetSubString(message, 0, firstspace - 1);
remainder = llGetSubString(message, firstspace + 1, -1);
}
string name = llGetObjectName();
llSetObjectName(firstword);
llSay(0, "/me " + remainder);
llSetObjectName(name);
}

}
_____________________
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
01-27-2008 08:56
EDIT: Day Oh must have had more caffeine then me. All of that code and he still beat me :eek:

Per the wiki:

"Like avatars, objects can use "/me" on channel 0. Thus, if an object named "Your dog" had a script with the line:
llSay(0, "/me wants steak.";);

The chat output would be:
Your dog wants steak."

So using that as a guideline, you could see that if the name of the object was blank then that same line of script would output: "wants steak". Sooooooooooooo next logical step would be to do this:

CODE

string obj_name;

default {
state_entry() {
obj_name = llGetObjectName();
llListen(7, "", llGetOwner(), "");
}
listen(integer channel, string name, key id, string message) {
llSetObjectName("");
message = "/me " + message;
llSay(0, message);
llSetObjectName(obj_name);
}
}


That temporarily erases the name of the object so that when you type into chat:
"/7 Mary had a little lamb" it will output:
"Mary had a little lamb" with no object name preceding it.

Disclaimer: Don't use something like this for greifing. Anyone with half a brain can find where the text is coming from and can abuse report it
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
01-27-2008 09:21
But to be sim freindly, you don't really won't to be walking around with an open listen on a common channel like 7 all day long. It is better to so that when you touch it, it will open a listen for a set amount of time and then remove the listen when it times out:

CODE

string obj_name;
integer handle;

default {
state_entry() {
obj_name = llGetObjectName();
}
touch_start(integer n) {
llSetTimerEvent(20.0);
handle = llListen(7, "", llGetOwner(), "");
}
listen(integer channel, string name, key id, string message) {
llSetObjectName("");
message = "/me " + message;
llSay(0, message);
llSetObjectName(obj_name);
}
timer() {
llListenRemove(handle);
}
}
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Reno Katscher
Registered User
Join date: 2 Jun 2007
Posts: 18
01-27-2008 09:47
Thanks guys!

No worries...I won't be griefing...thinking more along the lines of some private emoting ;-)

And is there a way to make the text output not green? I know that is a client setting to have objects talk in green but anyway to set it to white?
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
01-27-2008 10:09
From: Jesse Barnett
But to be sim freindly, you don't really won't to be walking around with an open listen on a common channel like 7 all day long. It is better to so that when you touch it, it will open a listen for a set amount of time and then remove the listen when it times out:


An owner-only filtered listen on channel 7 wouldn't be a problem.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
01-27-2008 10:20
From: Talarus Luan
An owner-only filtered listen on channel 7 wouldn't be a problem.

An owner only message will still have to filter every message said on channel 7 in the simulator. 1st by distance and then by key.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Day Oh
Registered User
Join date: 3 Feb 2007
Posts: 1,257
01-27-2008 10:36
I lose though, for not just setting the object name to ""

:)
_____________________
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
01-27-2008 11:12
From: Reno Katscher
And is there a way to make the text output not green? I know that is a client setting to have objects talk in green but anyway to set it to white?

There's no way you can do so for other people, but I believe each user can do so in his/her preferences. That's a security measure, so that you can easily distinguish a resident from an object used to speak in someone else's name.