I was helping someone out with a simple request. He wanted a prim to change it's hover text to display messages from a note card. Once you reach the end of the note card, it needed to start from the beginning again. It took about 10 minutes, but i came up with a pretty strait forward example of how it can be done.integer noteCardLine; integer noteCardCount; string noteCardName; key noteCardCountRequestId; key noteCardLineRequestId; init() { // reset to read first line noteCardLine = 0; // find the note card name noteCardName = llGetInventoryName(INVENTORY_NOTECARD, 0); // if note card is missing if(noteCardName == "") { // notify owner llOwnerSay("I don't have a note card to read!"); } // count number of lines in note card noteCardCountRequestId = llGetNumberOfNotecardLines(noteCardName); } default { state_entry() { init(); } on_rez(integer start_param) { init(); } changed(integer change) { // did note card change? if(change & CHANGED_INVENTORY) { // initialize again init(); } } touch_start(integer total_number) { // no note card? if(noteCardName == "") { // do nothing return; } // empty note card? if(noteCardCount == 0) { // do nothing return; } // if already past end of available note card lines if(noteCardLine >= noteCardCount) { // reset to read first note card line noteCardLine = 0; } // read the next line (and incriment to next line) noteCardLineRequestId = llGetNotecardLine(noteCardName, noteCardLine++); } dataserver(key queryid, string data) { if(queryid == noteCardLineRequestId) { // if no more lines if(data == EOF) { // note card count changed? reinitialize init(); } else { // we have something from the note card! // display the text llSetText(data, , 1); } } // got feedback for the number of lines in the note card? if(queryid == noteCardCountRequestId) { // save number of lines noteCardCount = (integer)data; // no lines? if(noteCardCount == 0) { // notify owner of problem llOwnerSay("Hey, this note card is empty"); } else { // request first line noteCardLineRequestId = llGetNotecardLine(noteCardName, noteCardLine++); } } } } <strong>Posted by Second Life Resident <a href="http://www.koinup.com/dedricmauriac/" rel="noreferrer nofollow">Dedric Mauriac</a> – Visit <a href="http://www.koinup.com/sims/in-second-life/coolest/?q=Nowhereville" rel="noreferrer nofollow">Nowhereville</a></strong> ––– Crosspost by <a href="http://www.koinup.com" rel="noreferrer nofollow">Koinup</a> – original <a href="http://www.koinup.com/dedricmauriac/work/229566/" rel="noreferrer nofollow">here</a>
Original Details
- Original on Flickr: https://www.flickr.com/photos/dedric-mauriac/4352251037/

