Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

reading from notecards

paulie Femto
Into the dark
Join date: 13 Sep 2003
Posts: 1,098
10-13-2005 17:03
You're kidding, right?

I have to call the llGetNotecardLine() function and then *wait* for a dataserver event to fire in order to recieve that line? Then, if the returned data isn't EOF, I have to repeat the cycle?

Instead of being able to call LLNotecard2List(string notecardname) and slurp the ENTIRE notecard into a sorted list with one function?

Or llNoteCard2List(string notecardname, integer start_line, integer end_line) to specify which lines need slurpin?
_____________________
REUTERS on SL: "Thirty-five thousand people wearing their psyches on the outside and all the attendant unfettered freakishness that brings."
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
10-13-2005 17:08
You got it. I think the contents of the notecard are stored on a different server somewhere, so your sim has to send a request out and wait for a response from that other server. And since the notecard can be arbitrarily large, you're only allowed to read one line at a time. This isn't like reading a file off a hard drive on a computer, the environment is totally different.
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
10-13-2005 19:45
I find reading 1 line at a time silly, and therefore never use it ...
and from a traffic standpoint if your gonna have a large notecard, you have already done it, so now instead of 1 lump of info being called and transfered, you have 20 llget cycles and a new session for each one.

dunno seems kinda dumb to me
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
10-13-2005 22:15
It's, technically, a backend database request. So no, it's not silly. If you want data that is immediately accessible, store it in the script or in the prim the script is in ;)
_____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.
paulie Femto
Into the dark
Join date: 13 Sep 2003
Posts: 1,098
...
10-13-2005 22:25
Store notecard data in the script? Umm, no. It seems like scripts hardly have enough memory for code / heap / stack, much less storing gobs of notecard data. Never mind that scripts often need to be locked down while the notecard remains editable.

How do we store notecard data in the prim, exactly? Convert it to a texture? Convert it to geometry? Thatd be a strange lookin prim.

The fact that we STILL have no persistent storage for scripts is just....grrrr.
_____________________
REUTERS on SL: "Thirty-five thousand people wearing their psyches on the outside and all the attendant unfettered freakishness that brings."
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
10-13-2005 23:02
For example, you could store quite a lot of raw data in seperate scripts, then retreive it using link messages. Just put it in strings stored in a list.
_____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
10-14-2005 12:01
thats what i do, make a dumb script with linked messages for the user to edit if need be

oh and its alot faster too
paulie Femto
Into the dark
Join date: 13 Sep 2003
Posts: 1,098
woot
10-14-2005 12:08
Sorry about my bitchy reply, Jes. The hour was late. Storin text in seperate scripts sounds like a great idea. Thanks!
_____________________
REUTERS on SL: "Thirty-five thousand people wearing their psyches on the outside and all the attendant unfettered freakishness that brings."
Sue Stonebender
Piano Craftsman
Join date: 7 Jan 2005
Posts: 219
Linked Messages ...
10-15-2005 21:17
Stoopid noob question -- but how might one go about doing this? Is there a small example? This may solve a problem I have with something I'm doing now.

Thanks a bunch!
_____________________
Cherry Hainsworth
Registered User
Join date: 31 Jul 2006
Posts: 125
How to store information & pass it to a script?
10-27-2006 18:59
From: Osgeld Barmy
thats what i do, make a dumb script with linked messages for the user to edit if need be

oh and its alot faster too


I know it's a whole year since Osgeld posted this, but I'm looking for the answer so I hope that reviving this thread will shed more light on the question ....

I have doors in a house (wow!!). They each have their own script - don't want all the access points to open every time someone goes in/out.

The owner of the building should be able to create a single 'allowed' list - ideally the list will reside in one prim; the owner can edit it; the doors will each consult this list when touched, to check whether they should open.

I thought this was a job for a notecard - something I haven't yet done from scratch - and, while looking for advice about how to do it properly, came across this thread.

It seems I should put the list in a 'control' script, then make the door scripts fetch the allowed list from there? Can anybody tell me how to do it and/or point me towards instructions, please?

Thank you .... :)
Cherry
_____________________
=================
My stuff on XSt:-
http://tinyurl.com/383mgh
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
10-27-2006 19:24
Hi Cherry

Some doors already have lists for admissable ppl (should that be certified?). You could write a control script that you interface with though a hud and which in turn relays your instruction to every door. Or you might update one notecard in the controller and then have it reiterate the notecard to the doors.

I also have the controller script lock all the doors at once after issueing a "close door" command. This might need shouting for some of the bigger houses that are not linkable as a single prim.

hth

Ed
Aakanaar LaSalle
Registered User
Join date: 1 Sep 2006
Posts: 132
10-27-2006 19:26
using the control script isn't difficult. Just have a script in a single prim that takes a name or other info, checks to see if it's on the list, and returns a "yes" or "no" appropriately. (or any other data you want to send back.)

The fun part with what you're describing, however, will be how to send and recieve the input. If the prims are linked (and i doubt they will be for a house full of doors) you can use MessageLinked. However, chances are, this house is not linked, so you're going to have to use llSay on some non-zero channel to pass the info back and forth. If the doors are far enough from the controlling prim, then use llShout.

As for using scripts versus notecard, though I do realize that this post is old, scripts are faster, though if you sell the item you have to make sure the new owners know not to edit the functioning part of the script and only edit the list of information. Perhaps you can provide an interface for them to add, or remove information from the list without getting into the script itself, though this adds the problem of the changes being lost on script resets.

A notecard is a better way to go for setting variables, or other settings that a script uses, as it only needs to read these on script reset.

I am looking to use a notecard for a script I am working on, but lukily all I need to do is pick a random line and read the one line, about once every 5 minutes or so when the script is active.
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
10-27-2006 20:31
since that time sims have changed, back when sim fps's were in the 15,000 range, and a average notecard line took 1 or 2 seconds the choice was obious

nowdays notecards are almost instant if stored in the objects inventory, and in most cases just a shade slower than linked messages

course the advantages are

not having to make a config script (and adding to overall sim stress)
and the user doesnt have to fool with a script
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
"There is another way..."
10-28-2006 00:17
There are other ways of storing small amounts of data, such as using the script name and description fields. Its limited but does work. And ist suprising how much data you can pack into 255 characters if you are careful.

More recently Squirrel Wood extended the idea by using multiple blank notecards where the name of the notecards was used as the data store. seehere for details.
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
10-28-2006 05:15
From: Newgate Ludd
There are other ways of storing small amounts of data, such as using the script name and description fields. Its limited but does work. And ist suprising how much data you can pack into 255 characters if you are careful.

Be carefull! I believe a name can only hold 63 and a description can only hold 127 or so characters.
Cherry Hainsworth
Registered User
Join date: 31 Jul 2006
Posts: 125
11-01-2006 10:51
Hello

I just wanted to say thanks for all the advice .... I've decided to code this dang thang from scratch (ie, without lifting chunks from other people's scripts) and it's going to take a while ;)
It'll be good for me!!

I'm not sure I'll make it as far as mastering Squirrel Wood's mystery blank-notecard technique but who knows? At my current rate of Wiki reading, anything could happen (including, but not limited to, a new glasses prescription).

Btw, the house I'm making isn't large but I am trying to work to best practice. When I've finally got the door scripts right, I hope you'll point out possible improvements :D

Cheers,
Cherry
_____________________
=================
My stuff on XSt:-
http://tinyurl.com/383mgh
Jopsy Pendragon
Perpetual Outsider
Join date: 15 Jan 2004
Posts: 1,906
11-01-2006 12:07
Some random suggestions:

Use "," instead of ";(return)" in your notecard and after getting the first line run it through llCSV2List(). :)

These days I try to keep the number of in-world scripts in my sim down to a minimum and have adopted a set of "do and die" utility scripts that clean up after themselves like:

CODE

default { state_entry() {

llSetText( llGetObjectDesc(), <1,1,1>, 1.0 );

// or llSetTextureAnim( blah, blah );
// or llSetTargetOmega( blah, blah );
// or llParticleSystem( blah, blah, BLAH, blah, blah );
// or whatever other persistent effects I want to configure...

llRemoveInventory( llGetScriptName() );
} }


Don't forget you can also use the NAMES of items in inventory to store data as well!

Unfortunately, there doesn't seem to be a way to query things like "for sale" status, orig/copy and sale price of prims or inventory, it'd be a useful ability for vendomat gizmos.

I don't mind reading notecard lines one at a time... what I DO mind is animation overriders having to actively poll for agent state instead of having a change in agent state trigger an event. :-/
_____________________
* The Particle Laboratory * - One of SecondLife's Oldest Learning Resources.
Free particle, control and targetting scripts. Numerous in-depth visual demonstrations, and multiple sandbox areas.
-
Stop by and try out Jopsy's new "Porgan 1800" an advanced steampunk styled 'particle organ' and the new particle texture store!
Cherry Hainsworth
Registered User
Join date: 31 Jul 2006
Posts: 125
11-01-2006 13:13
From: Jopsy Pendragon
Some random suggestions:

Use "," instead of ";(return)" in your notecard and after getting the first line run it through llCSV2List(). :)

These days I try to keep the number of in-world scripts in my sim down to a minimum and have adopted a set of "do and die" utility scripts that clean up after themselves like:

CODE

default { state_entry() {

llSetText( llGetObjectDesc(), <1,1,1>, 1.0 );

// or llSetTextureAnim( blah, blah );
// or llSetTargetOmega( blah, blah );
// or llParticleSystem( blah, blah, BLAH, blah, blah );
// or whatever other persistent effects I want to configure...

llRemoveInventory( llGetScriptName() );
} }


Don't forget you can also use the NAMES of items in inventory to store data as well!


Those are all really good ideas! Thanks!

With regards to removing the script after it's done its job - I've only just discovered that scripts use up sim memory & time, even when inactive :o

Are they still wasteful if set to 'Not Running'?
This has implications for items that are to be transferred: it might make sense to include the delete line in animation/loop/particle scripts, then provide a control prim to start the script - which will then delete itself.

What do you think?

Cherry
_____________________
=================
My stuff on XSt:-
http://tinyurl.com/383mgh
Llauren Mandelbrot
Twenty-Four Weeks Old.
Join date: 26 Apr 2006
Posts: 665
Not Enough To Bother About
11-01-2006 13:40
With regards to removing the script after it's done its job - I've only just discovered that scripts use up sim memory & time, even when inactive :o

Are they still wasteful if set to 'Not Running'?
To the best of my understanding: They still take up some memory and time, but a negligible amount even compared to an empty running script. Almost certainly nothing we can measure. So: Technically yes, but effectively no.This has implications for items that are to be transferred: it might make sense to include the delete line in animation/loop/particle scripts, then provide a control prim to start the script - which will then delete itself.

What do you think?
I`m not entirely sure what you`re suggesting here, but if you can make it work, great!
Dimentox Travanti
DCS Coder
Join date: 10 Sep 2006
Posts: 228
11-01-2006 13:45
In the case of offsite data, i tend to set a var to true or false. so unless the script is reset it should keep the data, including logging off. but if it looses it it grabs it from the http server for that person. and they can also issue a save state which pushes back to the outside server but i try to limit my calls.
_____________________
LSL Scripting Database - http://lsl.dimentox.com
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
11-01-2006 18:53
From: ed44 Gupte
Be carefull! I believe a name can only hold 63 and a description can only hold 127 or so characters.


names can hold upto 255
discriptions are 127
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
11-01-2006 19:22
From: Llauren Mandelbrot
To the best of my understanding: They still take up some memory and time, but a negligible amount even compared to an empty running script. Almost certainly nothing we can measure. So: Technically yes, but effectively no
QUOTE]
Just checked and a default "Hello Avatar" uses 0.003 ms of script time. Turn off the script and it will no longer show up in the top scripts. So definitely a YES, turning off a script does save on sim resources. The next question would be how often it would have to turn off and on and how much script time it takes to toggle it. I have started to use this and it does have an accumulative affect. Most any sim you go to it seems has about 15.0 ms of scripts running with nobody in the sim. Such a waste of processor power. Hopefully one day all the scripters will start using every trick available to scrimp on this as much as possible. Don't feel bad thou about just learning about this problem Cherry. You are not alone. Kind of wish I didn't know all of this now. I finally took a much needed break from scripting and testing to go to a Halloween dance the other night. All I thought about the whole time was all the bling, flash, AO's and waste around me. Finally left in disgust.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
11-02-2006 05:31
From: Cherry Hainsworth
Hello

I just wanted to say thanks for all the advice .... I've decided to code this dang thang from scratch (ie, without lifting chunks from other people's scripts) and it's going to take a while ;)
It'll be good for me!!

Well I originally picked up Hank Ramos's free dataserver example script and have pretty much used it ever since. No point reinventing the wheel , unless you like triangular wheels...

From: Cherry Hainsworth
I'm not sure I'll make it as far as mastering Squirrel Wood's mystery blank-notecard technique but who knows? At my current rate of Wiki reading, anything could happen (including, but not limited to, a new glasses prescription).



Squirrel's Idea is very nice and simple. It removes the need for any understanding of the more arcane Dataserver event. Its drawback is that it requires a number of empty/unused notecards to be added to the object.