Since LSL scripts are not meant for storing permanent data, the best way to achieve this, besides using a database, is using a notecard. This is widely used in a lot of products so the end user can easily configure some settings without the need to modify a script.

 

In this example I will show you how you can use a notecard to store some information and use it inside the script, in this case the script simply turns a light on off, thanks to the information stored in the notecard a user can set the color radius intensity and falloff values of the light:

 

The Script:

 

// www.lsleditor.org  by Alphons van der Heijden (SL: Alphons Jano)
// Configuration notecard example by Kahiro Watanabe (2009)

//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.

string notecardName;
integer notecardLine;

vector color;
float intensity;
float radius;
float falloff;

key query;

integer isLightOn;

lightOff()  // A simple function to turn light off
{
    llSetPrimitiveParams([PRIM_POINT_LIGHT,FALSE,ZERO_VECTOR,0,0.0,0.0]);
}

lightOn(vector color, float intensity, float radius, float falloff)  // A generic function to turn a light on with the given parameters (you can use this function in any script!)
{
    llSetPrimitiveParams([PRIM_POINT_LIGHT,TRUE,color,intensity,radius,falloff]);
}

switchLight(integer on)
{
    if (on)
    {
        lightOff();
    }
    else
    {
        lightOn(color,intensity,radius,falloff);
    }
}

default
{
    state_entry()
    {
        notecardLine = 0;
        notecardName = llGetInventoryName(INVENTORY_NOTECARD,0);
        if (notecardName != "")
        {
            llOwnerSay("Getting configuration data...");
            query = llGetNotecardLine(notecardName,notecardLine);
        }
        else
        {
            llOwnerSay("There is no notecard in object's inventory, please add a config notecard.");
        }
    }

    changed(integer change)
    {
        if (change & CHANGED_INVENTORY) // If notecard changes script is resetted.
        {
            llOwnerSay("Resetting script");
            llResetScript();
        }
    }

    on_rez(integer number)
    {
        llResetScript();
    }

    touch_start(integer total_number)
    {
        llSay(0, "Touched: "+(string)total_number);
    }

    dataserver(key requested, string data)
    {
        if (requested == query)
        {
            if (data != EOF)
            {
                //ignore lines that start with # and blank lines
                if ( (llGetSubString(data,0,0) != "#") && (data != "") )
                {
                    list tempData = llParseString2List(data,[":"],[]);
                    string command = llToLower(llList2String(tempData,0));

                    if (command == "color")
                    {
                        color = (vector)llList2String(tempData,1); // This converts a string to a vector 

                        // Set up the color vector properly (max should be 1 instead of 255)//
                        color.x = color.x / 255;
                        color.y = color.y / 255;
                        color.z = color.z / 255;
                        llOwnerSay(command + ": " + (string)color);
                    }
                    else if (command == "intensity")
                    {
                        intensity = llList2Float(tempData,1);
                        llOwnerSay(command + ": " + (string)intensity);
                    }
                    else if (command == "radius")
                    {
                        radius = llList2Float(tempData,1);
                        llOwnerSay(command + ": " + (string)radius);
                    }
                    else if (command == "falloff")
                    {
                        falloff = llList2Float(tempData,1);
                        llOwnerSay(command + ": " + (string)falloff);
                    }
                }
                notecardLine++;
                query = llGetNotecardLine(notecardName,notecardLine);
            }
            else
            {
                //End of notecard reached, we go to the ready state.
                state ready;
            }
        }
    }
}

state ready
{
    state_entry()
    {
        llOwnerSay("Ready!.");

        // Turn off lights as default;
        isLightOn = FALSE;
        lightOff();                      // Function call check line nº 14
    }

    on_rez(integer number)               // Reset script when object is rezzed;
    {
        llResetScript();
    }

    changed(integer change)
    {
        if (change & CHANGED_INVENTORY)  // If notecard changes script is resetted.
        {
            llResetScript();
        }
    }

    touch_start(integer totalNumber)
    {
        switchLight(isLightOn);
        isLightOn = !isLightOn;  // the "!" command is the logical "NOT" if the variable is true it will make it false and viceversa.
    }
}

 

The Notecard:

#Notecard Configuration Example
#Every line that starts with the ‘#’ symbol will be ignored by the script, empty lines will also be ignored
#This script will take data from this notecard to set light properties of the object. Then you will be able to turn on/off the light by touching it.
#The Information taken from the notecard is: Color,Intensity,Radius,Falloff the “:” symbol is used to separate the property name from the
#property value

Color:<0,255,0>
Intensity: 1
Radius: 10
Falloff: 0.9

The script is divided in two states: configuration and ready. I made it that way because the dataserver() method is asynchronous, this means that the script keeps running while the notecard is being read. Once the end of the notecard is reached then the script goes to the ready state where by touch the light can be turned on/off.