|
Kuh Kenzo
Registered User
Join date: 18 Dec 2005
Posts: 1
|
02-19-2009 19:58
Ok, silly question and maybe it's just something stupid I'm missing.
I have a prim with a script in it... I want a notecard in it that you can put names on say starting at line 2, for an 'owner' and each subsequent line would be another owner.
How do I get the script to read the note card, get the lines, save them to the script(so it can access them later) and then HAVE it access them later?
Thanks in advance!
|
|
WhiteStar Magic
Build it+Script it=RUN!
Join date: 24 Jul 2008
Posts: 36
|
02-19-2009 20:18
From: someone I have a prim with a script in it... I want a notecard in it that you can put names on say starting at line 2, for an 'owner' and each subsequent line would be another owner.
How do I get the script to read the note card, get the lines, save them to the script(so it can access them later) and then HAVE it access them later?
Here is a Good dataserver API from the wiki that would read the data in as required. http://wiki.secondlife.com/wiki/Dataserver_APIThe question is now, what do you want to do with it ? Reading in the data is simple enough but depending on what you want to do, it might be best to store it in a List that can then be manipulated either via a Dialog Menu to show the list or to perform an action based on the selection.
_____________________
Build it, Script it & Enjoy It, then Share it !!!
|
|
Lain Serf
Registered User
Join date: 13 Jun 2006
Posts: 3
|
02-21-2009 11:40
The plan was to have it be used through a menu via touch.
So you touch the item, and it pops up a menu if you have owner priviledges, and it pops up a 'You do not have owner abilities' if you don't.
|
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
02-21-2009 12:08
Several possible ways .... (1) Unless you really like notecards, just hard code the names into a list in the script itself. This is maybe the easiest way, provided that your owner list doesn't change often. (2) Put all the names on a notecard and have the script read the list from the notecard and put it into an internal list that it compares to llDetectedName in a touch_start event. Write a change event to trigger reading the card again if the script detects that you have replaced it with a new card. (3) Forget the notecard. Create a SL group for the owners and check each person who touches the object with llSameGroup to see if they're in the group. That's a start, anyway.....
|
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
02-21-2009 12:50
If you really want to use a notecard approach (#2 in my last post), try something like this..... integer gNotecardLine; string gName; key gQueryID = NULL_KEY; list gOwners = []; default { state_entry() { gNotecardLine = 0; gName = llGetInventoryName(INVENTORY_NOTECARD, 0); gQueryID = llGetNotecardLine(gName, gNotecardLine); } dataserver(key query_id, string data) { if (query_id == gQueryID) { if (data != EOF) { gOwners = gOwners + [data]; ++gNotecardLine; gQueryID = llGetNotecardLine(gName, gNotecardLine); } } } changed (integer change) { if(change && CHANGED_INVENTORY) { llResetScript(); } } touch_start(integer total_number) { string Avatar = llDetectedName(0); integer index = llListFindList(gOwners,[Avatar]); if (index != -1) { llSay (0, "Welcome, Owner " + Avatar + " !"); // Insert other stuff to do if person Avatar really is an owner. } else { llSay(0, "Sorry, " + Avatar + ". You are not an owner."); // Again, insert other stuff here if Avatar is not an owner. } } }
I haven't tried this in world, but it compiles and it ought to do the trick.
|
|
Lain Serf
Registered User
Join date: 13 Jun 2006
Posts: 3
|
02-24-2009 04:34
Thank you very much! 
|