Page 1 of 1

Unable to use "ACTIVE" as a variable?

Posted: Mon Dec 09, 2013 10:14 pm
by Evans Love
Hello,

Please Help! For some reason I get this error when the word "ACTIVE" is used as an integer variable?

(0,0): Error: /usr/local/node/opensim2/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.dll (Location of the symbol related to previous warning)

I have done some bug testing and found out that if I replace the name of the variable "ACTIVE" with something else, for example, "IS_ACTIVE" it works! This is problematic, however, in that I have imported an .OAR file with a ton of prims that each have scripts using "ACTIVE" as a variable... unfortunately when I import the .OAR into the region, the scripts (which compile and work fine on OpenSim) stop working. Why is this happening, and can it be fixed? I would really not like to have to change hundreds of scripts.

Any advice would be helpful,
- Evans Love

Re: Unable to use "ACTIVE" as a variable?

Posted: Tue Dec 10, 2013 6:09 am
by Oren Hurvitz
"ACTIVE" is a predefined constant in LSL: see http://wiki.secondlife.com/wiki/ACTIVE .

For example, the following script says "ACTIVE = 2":

Code: Select all

default
{
    state_entry()
    {
        llSay(0, "ACTIVE = " + ACTIVE);
    }
}
So if a script is trying to redefine this constant then it's being very naughty. I'm afraid the solution IS to change the variable name, since it's a reserved name.

Re: Unable to use "ACTIVE" as a variable?

Posted: Tue Dec 10, 2013 6:19 am
by Oren Hurvitz
There's a trick you may be able to use to make this replacement quickly. First, you said you have an OAR file. So extract it on your hard disk, and go to its "assets" directory. Then, use the program "sed" to replace in all of the scripts at once. "sed" is included in most Linux distributions, and probably in OS X as well. If you're using Windows then this looks like a place where you can download sed: http://gnuwin32.sourceforge.net/packages/sed.htm

Once you have sed, run this command in the "assets" directory:

Code: Select all

cd (oar_directory)/assets
sed -i "s/\bACTIVE\b/IS_ACTIVE/g" *.lsl
Then, use tar to rebuild the OAR file. (You may need to download "tar" as well...):

Code: Select all

cd ..
tar cfz ../my_oar.oar *
Finally, use Replace World to upload the new OAR to Kitely.