Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llGetObjectName help

Epilort Byrne
Registered User
Join date: 6 Jul 2004
Posts: 30
06-27-2007 07:25
Hi I posted a thread yesterday about this but turns out what I thought was working properly isn't anymore. My question is about llGetObjectName (and i suspect llGetObjectDesc works the same way). I have the following script which I keep in my inventory:


integer rp_channel = -49023937;

default
{
state_entry()
{
string msg = llGetObjectName() + ":::" + (string)llGetKey() + ":::" + (string)llGetOwner() + ":::" + llGetObjectDesc();
llSay(rp_channel, msg);
}
}

The problem is llGetObjectName() returns the script's name rather than the object I placed the script in. Does anyone know why and how I can avoid this?

EDIT:

The problem seems to be in the script that listens to the the above llSay. It parses the list at ":::" and sends to it to a mod_python script. However, it appears that sometimes the name part is incorrect and it seems like it saves it from a previous listen. I know this problem is a bit vague, and it seems to be fixed every time I recompile the listener script but anyway I will try to post output if it happens again.
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
06-27-2007 07:48
I suspect if you put an
llSay(0, msg);

in the above code near your other llSay, for debugging, you'll see at this point it does indeed print out the objects name, not the scripts name (unless the object and script name are the same, which could get confusing). The problem is probably in the listen code.
Milambus Oh
Registered User
Join date: 6 Apr 2007
Posts: 224
06-27-2007 07:56
Without looking at your listener's script... are you by chance using multiple variables labeled "name"?

Such as:

string name = ""; // global name variable... where you want to store the name of the object

default {
listen( integer channel, string name, key id, string message ) {
// local name variable in the listen code.. which is in fact the name of the object that spoke
}
}
Epilort Byrne
Registered User
Join date: 6 Jul 2004
Posts: 30
06-27-2007 14:54
you're right the problem is in the listen code thanks!