Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Viewer 2 Displaying_a_notecard_beyond_124_ch  

Displaying_a_notecard_beyond_124_ch

The following LSL Script reads a notecar...

Category: Viewer 2
By : Pavcules Superior
Created: 2010-09-02 Edited: 2010-09-02
Worlds: Second Life

the Zip file

Download all files for Displaying_a_notecard_beyond_124_ch
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Displaying_a_notecard_beyond_124_ch_1.lsl
Get file # 2. Displaying_a_notecard_beyond_124_ch_2.lsl
1 string g_strURL;
2 string g_strNotecardName;
3 string g_strNotecardText;
4 integer g_intNotecardLine = 0;
5 key g_keyNotecardQueryID;
6 key g_keyURLRequestID;
7
8
9 // Start reading the notecard text.
10 ReadNotecardText()
11 {
12 llOwnerSay("Reading Notecard...please wait.");
13
14 g_intNotecardLine = 0;
15 g_strNotecardText = "";
16 g_strNotecardName = llGetInventoryName(INVENTORY_NOTECARD, 0);
17 g_keyNotecardQueryID = llGetNotecardLine(g_strNotecardName, g_intNotecardLine);
18
19 }
20
21
22 show(string html)
23 {
24
25 llOwnerSay(html + "\nSize: " + (string)llStringLength(html) );
26
27 llSetPrimMediaParams(0, // Side to display the media on.
28 [PRIM_MEDIA_AUTO_PLAY,TRUE, // Show this page immediately
29 PRIM_MEDIA_CURRENT_URL,html, // The url if they hit 'home'
30 PRIM_MEDIA_HOME_URL,html, // The url currently showing
31 PRIM_MEDIA_HEIGHT_PIXELS,1024, // Height/width of media texture will be
32 PRIM_MEDIA_WIDTH_PIXELS,1024]); // rounded up to nearest power of 2.
33 }
34
35 // This creates a data: url that will render the output of the http-in url
36 // given.
37 string build_url(string url)
38 {
39 return "data:text/html,
40 <html>
41 <head>
42 <script type=\"text/javascript\">
43
44 function makeRequest()
45 {
46 // " + (string)llGetUnixTime() + "
47 var oScript = document.createElement('script');
48 oScript.src = '" + url + "?part=0&sid='+Math.random();
49 document.body.appendChild(oScript);
50
51 var oScript= document.createElement('script');
52 oScript.src = '" + url + "?part=1&sid='+Math.random();
53 document.body.appendChild(oScript);
54 }
55
56 function callback(num, sText)
57 {
58 document.getElementById('d' + num).innerHTML = sText;
59 }
60
61 </script>
62 </head>
63 <body onload=\"makeRequest();\">
64 <div><div id=\"d0\" style=\"display:inline;\"></div><div id=\"d1\" style=\"display:inline;\"></div></div>
65 </body>
66 </html>";
67 }
68
69
70 string strReplace(string str, string search, string replace) {
71 return llDumpList2String(llParseStringKeepNulls((str = "") + str, [search], []), replace);
72 }
73
74 default
75 {
77 {
78 ReadNotecardText();
79
81 }
82
83 changed(integer change)
84 {
85 // If the inventory is updated, read the notecard data again.
86 if(change & CHANGED_INVENTORY)
87 {
88 ReadNotecardText();
89 }
90 }
91
92
93 dataserver(key query_id, string data)
94 {
95 if(query_id == g_keyNotecardQueryID)
96 {
97 if(data != EOF)
98 {
99 // Store the text.
100 g_strNotecardText += data;
101
102 // Read next notecard line.
103 ++g_intNotecardLine;
104 g_keyNotecardQueryID = llGetNotecardLine(g_strNotecardName, g_intNotecardLine);
105 }
106 else
107 {
108
109 // We have reached the end of the notecard.
110 llOwnerSay("Size: " + (string)llStringLength(g_strNotecardText));
111 show(build_url(g_strURL));
112 }
113 }
114 }
115
116 http_request(key id, string method, string body)
117 {
118 if(method == URL_REQUEST_GRANTED)
119 {
120 g_strURL = body + "/";
121
122 llOwnerSay(g_strURL);
123
124 // show(build_url(url));
125 }
126 else if(method == "GET")
127 {
128
129 string strParams = llGetHTTPHeader(id, "x-query-string");
130 llOwnerSay("url: " + strParams);
131 list lstParams = llParseStringKeepNulls(strParams, ["&"], []);
132
133 list lstParamID = llParseStringKeepNulls(llList2String(lstParams,0), ["="], []);
134
135 integer intPartNumber = llList2Integer(lstParamID,1);
136 integer intSize = 1900;
137 integer intStart = 0;
138 integer intFinish = intSize -1;
139
140
141 if(llList2String(lstParamID,0) == "part")
142 {
143 intStart = intSize * intPartNumber;
144 intFinish = intStart + intSize - 1;
145 }
146
147
148 llOwnerSay("Getting Notecard Contents:");
149 g_strNotecardText = strReplace(g_strNotecardText,"\"","'");
150
151 string strCallback = "callback(" + (string)intPartNumber + ",\"" +
152 llGetSubString(g_strNotecardText,intStart,intFinish) +
153 "\");";
154
155
156 llHTTPResponse(id,200,strCallback );
157 }
158 }
159 }

Displaying_a_notecard_beyond_124_ch

Example notecard, text copied from Wiki (http://en.wikipedia.org/wiki/Second_Life), adjusted to fit 255 characters per line, with some HTML tags added.

Category: Viewer 2
By : Pavcules Superior
Created: 2010-09-02 Edited: 2010-09-02
Worlds: Second Life

1 <strong>
2 Second Life (SL) is a virtual world developed by Linden Lab that launched on June 23, 2003 and is accessible via the Internet. A free client program called the Second Life Viewer[1] enables its users, called Residents, to interact with each other through
3 avatars. Residents can explore, meet other residents, socialize, participate in individual and group activities, and create and trade virtual property and services with one another, or travel throughout the world (which residents refer to as "the grid").
4 Second Life is for people aged 18 and over, while Teen Second Life is for people aged 13 to 17.
5 Built into the software is a three-dimensional modeling tool based around simple geometric shapes that allows a resident to build virtual objects. This can be used in combination with the Linden Scripting Language which can be used to add functionality
6 to objects. More complex three-dimensional sculpted prims (colloquially known as sculpties), textures for clothing or other objects, and animations and gestures can be created using external software. The Second Life Terms of Service ensure that users
7 retain copyright for any content they create, and the server and client provide simple digital rights management functions.
8 </strong>
9
10 n 1999, Philip Rosedale (known as Philip Linden[2] inworld) formed Linden Lab. His initial focus was on the development of hardware that would enable computer users to be fully immersed in a virtual world experience. In its earliest form, the company
11 struggled to produce a commercial version of the hardware, known as "The Rig", which was realized in prototype form as a clunky steel contraption with several computer monitors that users could wear on their shoulders.[3] That vision soon morphed into
12 the software application Linden World, in which users could participate in task-based games and socialization in a three-dimensional online environment.[4]
13 <br><br>
14 <em>
15 That effort would eventually transform into the better known, user-centered Second Life.[5]
16 Although he was familiar with the metaverse of Neal Stephenson's novel Snow Crash, Rosedale has said that his vision of virtual worlds predates that book, and that he conducted some early virtual world experiments during his college years at the
17 University of California San Diego, where he studied physics.[6]
18 On December 11, 2007, Cory Ondrejka, who helped program Second Life, was forced to resign as chief technology officer .[7]
19 In January 2008, residents (including bots used to simulate traffic for better search rankings) spent a total of 28,274,505 hours "inworld", and, on average, 38,000 residents were logged in at any particular moment. The maximum concurrency (number of
20 avatars inworld) recorded is 88,200 in the 1st qtr. 2009 [8]
21 On March 14, 2008, Rosedale announced plans to step down from his position as Linden Lab CEO and to become chairman of Linden Lab's board of directors.[9] Rosedale announced Mark Kingdon as the new CEO effective May 15, 2008.[10]
22 In 2008, Second Life was honored at the 59th Annual Technology & Engineering Emmy Awards for advancing the development of online sites with user-generated content. Rosedale accepted the award.[11]
23 In January 2010, 18 million accounts were registered, although there are no reliable figures for actual long term consistent usage.[12]
24 </em>

Back to the Best Free Tools in Second Life and OpenSim.