I have a concern regarding the availability of storage for scripts. Currently, there is no way to store any data so that it survives beyond the runtime of the script. There's also no way to store an arbitrary amount of data for any length of time at all. This prevents the creation of any large systems that need to maintain state over a long period of time.
Here's a demonstration of the problem:
CODE
string storage;
default
{
state_entry()
{
llSay(0, "Entering default state");
llListen(0, "", "", "");
}
state_exit()
{
llSay(0, "Exiting default state");
}
listen(integer channel, string name, key id, string msg)
{
if (name == "Bob Brightwillow")
{
llSay(0, "Stored: " + msg);
storage = msg;
}
}
touch(integer num)
{
llSay(0, "Storage: " + storage);
}
}
When I create this script on an object, and it compiles and saves, it prints out "Entering default state". I touch the object, and it prints out "Storage: ". I say Hello, and it says back "Stored: Hello". I touch the object again and it says "Stored: Hello". All's well and good.
Now I edit the script, typing in a space and erasing it again -- in effect doing nothing but flagging the script as modified -- and compile it and save it again. It prints out "Entering default state". I touch the object, and now it says "Stored: ". It has lost its memory.
Of course that's unsurprising, given the environment in which scripts run, but nonetheless frustrating. If I wanted to maintain a database of UUIDs for some reason, I would have to re-register every object every time I make the tiniest change in the database script. If I wanted to maintain a guestbook, I would lose all entries every time I change the script. Any sort of data storage is instantly vapourized whenever the script holding it is disturbed.
I'm also informed that scripts have a maximum space of 16kB in which to execute. That's not a lot of space to use to remember even a list of objects' keys, even if UUIDs are (assuming I counted correctly) only 16 bytes long a piece. And the script's bytecode, I'm sure, takes up plenty of that space by itself.
So I would like to make a request for any sort of persistent storage. One way to do this might be to allow a script to write to and read from a notecard attached to the same object. If methods could be provided to write to and read from a certain range of bytes stored on the notecard, a script could store arbitrary amounts of data, and rely on the same data to exist beyond its own runtime.
Thanks for your consideration.