Join us in Phaze Demesnes

LSL Script Library Home   Add a script Show All
Category: Contributor: Description
Notecard Reader Encog Dod NotecardReader
NotecardReader
NotecardReader

Download this script - Please use this link to get this script. If you see all the code on one long line, please use Wordpad or another editor, such as LSLEdit.exe. The .LSL file you will download is an ordinary text file.

1 // From the book:
2 //
3 // Scripting Recipes for Second Life
4 // by Jeff Heaton (Encog Dod in SL)
5 // Copyright 2007 by Heaton Research, Inc.
6 //
7 // This script may be freely copied and modified so long as this header
8 // remains unmodified.
9 //
10 // For more information about this book visit the following web site:
11 //
12 // http://www.heatonresearch.com/articles/series/22/
13
14 integer index;
15 key query;
16
17
18 default
19 {
21 {
22 llSetText("Touch me to\nHear me read from a notecard.",<0,1,1>,1);
23 }
24
25 touch_start(integer total_number)
26 {
27 index = 0;
28 query = llGetNotecardLine("MarkAntony",index++);
30 }
31
32 timer()
33 {
34 query = llGetNotecardLine("MarkAntony",index++);
35 }
36
37 dataserver(key query_id, string data)
38 {
39 if (query == query_id)
40 {
41 // this is a line of our notecard
42 if (data == EOF)
43 {
45
46 } else
47 {
48 // increment line count
49 llSay(0, data);
50 }
51 }
52 }
53 }