Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

notecards for configuring non mod items

Zaplok Riggles
Registered User
Join date: 25 Feb 2008
Posts: 119
04-16-2008 19:59
I am creating an object that will be non mod. I want folks to be able to use a notecard to configure it. What I've found, is if its non mod, the notecard in the object can actually be copied out of the object into inventory (the object is copy/no mod). The user can then edit the notecard. The issue is, he can't then delete the original notecard and replace it with his (the no mod coming into play).

I can set the object to allow inventory drop, and I know how to respond to the event, and then cause the notecard to be read. The problem with this approach is ANYONE can drop inventory into the object. Secondly, the drop occurs without me being able to process prior to the drop. Meaning, if they drop a second or 3rd notecard in, I would have to clean up the older notecards and rename the new one. (not even sure a script can do this on a non mod object)

So, anyone have any advice on how to make notecard configured objects easy to configure when the object will be distributed as no mod/copy?

Thanks
Zaplok
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
04-16-2008 20:42
On determining who dropped the notecard, or at any rate dealing with the situation, you'll find plenty of threads if you simply search for llAllowInventoryDrop. It is probably the most painful and much debated issue with that mechanism.

As for the notecard name, you'll probably just have to deal with differing names. Look at the inventory items after the drop, and find the name that does NOT equal the last one used (if you are deleting them), or that wasn't seen the last time a drop/change happened (if you aren't deleting). No, you cannot arbitrarily rename an item in object inventory via script.
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
04-16-2008 21:54
you might want to consider NOT using a notecard.

Memory scripts can store quite a few variables in lists, so as long as the scripts aren't reset, the data is reasonably safe, and worst case scenario, iut defaults back to factory settings and they have to reconfigure.

Or you could try making your object moddabble, and your scripts nomod.

OR!!!

You can create a system whereby you have a "settings box" that rezzes. The person mods the notecard inside the box, and on inventory change (notecard save), the settings box GIVES the notecard to the device in question.
_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
04-16-2008 23:16
If the notecard in the object is full perms (and it will need to be) then what speaks against editing the notecard right inside the object and saving it?

If you are concerned about not receiving an inventory change event, then you need to worry not. Changing and saving a notecard will trigger such an event as the notecard receives a new asset uuid.
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
04-17-2008 02:41
Also, a notecard can be edited right in the object, no need to remove the notecard, edit, delete, and replace, just edit the notecard in place.

And.. you can sense a changed notecard, so instead of having a dialog choice to re-read the notecard, you can use the changed event...

CODE


default
{
// your code...

changed (integer change)
{
if (change & CHANGED_INVENTORY)
{
// someone edited the NC...
NCQuery = llGetNotecardLine ("your notecard name", 0); // get first line of NC....
}
}

datatserver (key query, string data)
{
if (query = NCQuery)
{
if (data != EOF) // still more data in NC
{
NC_list += data; // add the data to a list
++count;
NCQuery = llGetNotecardLine ("your notecard name", count); // get next NC line (retrigger dataserver event);
}
}
}
}


Also, instead of using notecards at all, depending on how much configuration data you need to save, you can achieve persistent data storage by simply scripting your script to store the settings in the object's description field. Object descriptions persist data if the sim crashes, or if you take/re-rez an object. So, if you're just saving settings, I'd recommend going that route. To do it, you must come up with a storage/retrieval convention, such as:

setting 1:setting 2:setting 3:setting 4

and write your data as a string, with some sort of separator, such as a colon in my example, then write it with llSetObjectDescription()

then, code your script so that on state_entry, it checks the object description, and reads the data in from the object description in the same order as it was written, and (I personally) usually parse the data to a list, then read the items off the list, for example

string settingsString = llGetObjectDesc();
settingsList = llParseString2List (settingsString, [":"], []);

then...
string setting1 = llList2String (settingsList,0);
integer setting2 - llList2Integer (settingsList1);

etc...

I use this to store the timezone offset, hours and minutes, and the state of the chime (on or off). It works great.

One used to be able to store upwards of 8k of data, but that was too good of a thing, so LL chopped it down to 127 measly bytes. Still, 127 bytes is plenty if you're just storing a handful of settings. So, if you can assemble a string of 127 bytes or less including separators for your settings, its the easiest for the end user, as they simply need to make menu choices, and that's it, and there's no fussing with notecards, especially for just a few measly settings. Bear in mind, object descriptions are visible to anyone who edits the object, so as far as storing information, you'd never want to store sensitive information, like email addresses, passwords, etc, using this exploit, or hack, or whatever you want to call it.

One last bit of advice using this sort of system.. create two functions, one called readSettings() one called writeSettings(), because when you're coding, you may find that you need to read/write the settings more then once. For example, a patrol bot I'm working on stores it's current next-waypoint in the object description (and the fact that the bot is up and running), in the object description after it hits each waypoint, so I'm reading/writing quite often. Also, it's good to read the current set, make the change you need to, then write the set. That way, you'll keep the other settings the same, as you're reading/writing the settings as a whole.
Darien Caldwell
Registered User
Join date: 12 Oct 2006
Posts: 3,127
04-17-2008 12:06
Making items moddable will make your life, and your customer's life, so much easier. My two cents.
_____________________
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
04-18-2008 23:15
From: Darien Caldwell
Making items moddable will make your life, and your customer's life, so much easier. My two cents.


Making an object moddable doesnt always solve the problem though...