I've run into an annoying little bug with llGetScriptName.
Create a script named GSNTest in inventory with this code:
[pre]
default
{
state_entry()
{
llWhisper(0, llGetScriptName());
}
}
[/pre]
Now create a prim, go to contents, and drag a copy of the script into the object contents. It whispers "GSNTest." So far, so good.
Now drag another copy into the inventory. It will automatically be renamed to "GSNTest 1." BUT, when it compiles and enters the default state, it whispers "GSNTest." O.o
OK, now, drag a couple more of these scripts into the inventory. They all whisper "GSNTest."
OK, no biggy. They were probably renamed after the script compiled or something weird like that. We'll just recompile them all. Go to Tools|Recompile Scripts in Selection. Viola!
Oops. Only one script recompiles! AND, most likely, it's the last script dragged in. And even though it's named "GSNTest 4," it whispers "GSNTest" when it finishes recompiling and enters the default state!
The particular script I'm working on is intended to be used in multiples within an object. It uses the automatic renaming feature to auto-set the link_message "channel" that it listens on. But since it's reading the name incorrectly, that doesn't work. The failure of the dupes to recompile is an even larger issue.
The workaround is to go into each script, change something (add a space to a blank line, for instance) and save it IN THE OBJECT. Doing this multiple times in one object is somewhat of a pain. Even worse is if you make a code change to the script, and have to delete/re-copy the dupes back in. The more copies you need/have, the more aggravating it becomes.