Jump to content
You are about to reply to a thread that has been inactive for 4872 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Posted

I have a script that reads a notecard with:

 

string _notecard = "name of notecard"

From there the code reads information from the notecard.

Is there a way to have multiple notecards in a script and let the user chose which to use?

Posted

if the script provides a way to select a different notecard and save that name to the variable, yes it is possible...

you can even automate the selection of the notecard in various ways (for instance, the resizer package I have placed in the LSL Libray forum, automatically tries to select the correct language card if it's available, based on what the users language is detected as)

past the script providing some means to select a different one, the only possibility is allowing the user to modify the script, or having them change the name of the notecard.

Posted

Here is a simple example for a dialog that lets you choose which nc to read.  It's simple and assumes that there aren't more than 12 ncs and that the nc names aren't any longer than 24 characters

list glNoteCards;integer giListener;integer giChannel = -1234567;integer giCurrLine;string gsCurrNC;key gkQuery;default{	touch_start(integer total_number)	{		glNoteCards = [];		integer i = llGetInventoryNumber(INVENTORY_NOTECARD);		while (i) {			glNoteCards += llGetInventoryName(INVENTORY_NOTECARD, --i);		}		llDialog(llDetectedKey(0), "Select a notecard to be read.", glNoteCards, giChannel);		giListener = llListen(giChannel, "", llDetectedKey(0), "");	}	listen(integer channel, string name, key id, string message)	{		integer index = llListFindList(glNoteCards, [message]);		if(index) {			gkQuery = llGetNotecardLine(gsCurrNC = llList2String(glNoteCards, index), giCurrLine = 0);		}		llListenRemove(giListener);	}	dataserver(key requested, string data)	{		if (gkQuery == requested) {			//do stuff here			if (data == EOF) {				//do stuff here after finishishing reading				return;			} else {				//do stuff here			}			gkQuery = llGetNotecardLine(gsCurrNC, ++giCurrLine);		}	}}

 

Posted

... and if its any use, the script here - http://kimmscripts.wordpress.com/2011/06/07/multiple-notecard-giver/ - does multipage dialog handling which could be combined with Darkie's script if you have more than 12 notecards.

Note that this gives out notecards, but if you replaced the llGiveInventory() call in give_notecard with the call to start the notecard reading, you'd be pretty much there.

Also note the comments on why I didn't open/close the listen on demand.  Aside, if anyone has a better way to handle multiple avs touching it, other than maintaining a stack of listens to open/close, I'd be interested in hearing about it :)

Kimm.

 

You are about to reply to a thread that has been inactive for 4872 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...