Jump to content

Reading a listen from notecards


CampSoup1988
 Share

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

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

Recommended Posts

I am trying to write a script that reads a list of keys into a list in the script from a notecard.

 

For an example, I have the notecards called CardA, CardB, & CardC, and I have a list called ListA, ListB, ListC, where CardA is copied into ListA, etc.

 

Thank you in advance,

CampSoup1988

Link to comment
Share on other sites

The easiest way to learn a new skill in scripting is to start with a sample script that already works.  Modify it a little bit at a time to see how it behaves and to understand its logic.   Gradually morph it into a script that does what you want.  If you get stuck, come back here and post your script (or at least the part that doesn't work right).  We won't usually write a script for you, but people in this forum will be glad to help you learn how to do it.

Link to comment
Share on other sites

This simple script can read note card data into a list.
It requires that all data are on the first line in the card and data are separated by commas, say:
key1,key2,key3...


list ListA;
string dataCard="CardA";
key cQuery;

default
{
state_entry()
{
cQuery = llGetNotecardLine(dataCard, 0);
}
dataserver(key query_id, string data)
{
if (query_id == cQuery) ListA = llCSV2List( data );
}
}

You just have to expand this script for all cards and lists.
As others has suggested: Look up the LSL functions in the wiki:)

 

Link to comment
Share on other sites

The first example under "Useful Snippets" in the wiki section to which Rolig directed you," Generic Multi Notecard reader by Brangus Weir," does, it seems to me, exactly what you asked about -- reads a list of names from a card called "One" into a list called "gOneCard", and then finds a card called "Two" and reads the list of names from that into "gTwoCard", and then finds a card called "Three" and reads that into "gThreeCard".

All you need to do, to my mind, with that script, is alter the bit of the user function there, initialize (string _action), to do what you want when the script has finished reading the three cards.   That's the bit,

else if ( _action == "finish"){  // read out all the lists to prove it works }

Change it to something like

else if ( _action == "finish"){  
    llOwnerSay("Right, read the cards; let's boogie");
    state running;
    }

and then open your listens and so on in state_entry of state running.

I'm a bit confused by the title of your post; you can't, unfortunately, have a listener that listens listen to all uuids on a list and to no one else.   You have to set up a listener on the lines of

 

list my_list;default{	state_entry(){		llListen(99,"","","");  //listen to anyone on channel 99	}		listen(integer channel, string name, key id, string message){		if(~llListFindList(my_list,[id])){//if the uuid of the person we heard from is to be found in my_list			//then do stuff		}		else{		llInstantMessage(id,"Sorry, "+name+",but you aren't on my list so I'm not listening to you");		}	}}

 

 

 

 

Link to comment
Share on other sites

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