Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Problem with llGetScriptName()

Grim Lupis
Dark Wolf
Join date: 11 Jul 2003
Posts: 762
07-23-2004 19:31
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.
_____________________
Grim

"God only made a few perfect heads, the rest of them he put hair on." -- Unknown
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
07-24-2004 11:47
I sooo hate this bug. It seems like its a result of the scripts having the same UUID. Recompile all scripts in selection *should* cure it, but apparently, it skips scripts with equal UUIDs, which SUCKS.

I actually remember when it *did* work right, compiling all scripts in an object's inventory, with the correct names, and checking the run checkbox as a *good* sideeffect. This is a bug that was introduced with a recent update.
==Chris