Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Multiple Writes to One Notecard?

Disraeli Calderwood
Registered User
Join date: 17 May 2006
Posts: 11
10-04-2007 06:28
I'm a beginning scriptor, and was wondering if there were any special concerns with having multiple scripts writing to one notecard by asset ID. Anything I should be aware of, regards open file or corruption potential?

Thanks in advance for any pointers to the wiki and other information. :)

Disraeli
Ilobmirt Tenk
Registered User
Join date: 4 Jun 2007
Posts: 135
10-04-2007 06:34
Notecards cannot be written to.

To save data in-word, you may feel free to either modify object properties like name or description, but that could be less secure solution than using a separate script to hold that data.

To store data off-world, you might want to look into using http requests to a web server.
Disraeli Calderwood
Registered User
Join date: 17 May 2006
Posts: 11
10-04-2007 06:41
Ouch. So is that what people do with systems that require storage and modification of data?
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
10-04-2007 07:08
From: Disraeli Calderwood
Ouch. So is that what people do with systems that require storage and modification of data?
Global variables (which--usually--persist until script reset), often in separate scripts dedicated to memory storage and accessed via link messages; or off-world (web/db) storage; or more limited-capacity and exotic "storage" like object description fields, hidden prim parameters, etc. (This last is really very special-purpose, and pretty much guarantees any re-use of the script will lead to hours of debugging puzzlement... but if one enjoys that sorta thing... ;) ).
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
10-04-2007 08:53
The programming model in SL is very different from most standard languages. (Run, open file, read data, process data, output data, exit).


x A script must be in a prim to run.

x Until reset, a script remembers it's state. That is, if you take the object into inventory, and later take it out again, it remembers exactly what it was doing and all it's data.

x Each script is limited to 16K data and code, combined.

In other words, they were conceived to be small, permanent self-contained properties of an object, not a general purpose software environment.

Nonetheless, people have done amazing things with them, but that usually requires numerous tricks, hacks, wizardry, or invocation of external tools such as HTTP or SQL.
Disraeli Calderwood
Registered User
Join date: 17 May 2006
Posts: 11
10-04-2007 09:22
Interesting. Well, I have the SQL db option, but was really hoping to make it more portable than that. Good to know the limits, and how everyone pushes 'em.
Darien Caldwell
Registered User
Join date: 12 Oct 2006
Posts: 3,127
10-04-2007 12:48
From: Disraeli Calderwood
Ouch. So is that what people do with systems that require storage and modification of data?


They mutter expletives and cry softly when noone is looking...
_____________________
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
10-04-2007 15:46
There's a sticky at the top of this forum which is a great resource for starting scripters.

Good luck!! :)
Disraeli Calderwood
Registered User
Join date: 17 May 2006
Posts: 11
10-05-2007 05:16
Thanks to all, and gotcha on the scripting tips!

One last question here... from what I'm reading, would it be better to offload a lot of the process on server-side php? It seems like putting as much of it in scripts right on my database server, and then just using LSL to massage the final output into SL instead of trying to get LSL do to fancy flips it is the way to go.
Ilobmirt Tenk
Registered User
Join date: 4 Jun 2007
Posts: 135
10-05-2007 06:15
A web server would be nice to get around the restrictions and delays that various lsl functions provide. For example, if you have a computationally expensive function, http can offload a scripts workload. It also can also lessen the time it takes to e-mail other objects in-world. Instead of being restricted to 1 e-mail per 20 seconds, you can e-mail at the rate of 1 per 5 seconds.