Jump to content

Select a notecard to use within a script


Mitzie Mohr
 Share

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

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

Recommended Posts

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.

Link to comment
Share on other sites

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);		}	}}

 

Link to comment
Share on other sites

... 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.

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4328 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
 Share

×
×
  • Create New...