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 HTML_Rendering_from_Notecard  

HTML_Rendering_from_Notecard

This script puts the data in the URL, and can render the HTML tags from the notecard. Note, the URL limit is 1024 characters. This script below does not need HTTP-IN to work, and is much simpler.

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

the Zip file

Download all files for HTML_Rendering_from_Notecard
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. HTML_Rendering_from_Notecard_1.lsl
Get file # 2. HTML_Rendering_from_Notecard_2.lsl
1 // Notecard Text on a Prim
2 // Developed by: Pavcules Superior
3 // Developed on: March 2010
4
5 string g_strNotecardName;
6 string g_strNotecardText;
7 integer g_intNotecardLine = 0;
8 key g_keyNotecardQueryID;
9 key g_keyURLRequestID;
10
11
12 // Start reading the notecard text.
13 ReadNotecardText()
14 {
15 llOwnerSay("Reading Notecard...please wait.");
16
17 g_intNotecardLine = 0;
18 g_strNotecardText = "";
19 g_strNotecardName = llGetInventoryName(INVENTORY_NOTECARD, 0);
20 g_keyNotecardQueryID = llGetNotecardLine(g_strNotecardName, g_intNotecardLine);
21
22 }
23
24
25 default
26 {
28 {
29
30 ReadNotecardText();
31
32 g_keyURLRequestID = llRequestURL();
33
34 }
35
36 changed(integer change)
37 {
38 // If the inventory is updated, read the notecard data again.
39 if(change & CHANGED_INVENTORY)
40 {
41 ReadNotecardText();
42 }
43 }
44
45
46 dataserver(key query_id, string data)
47 {
48 if(query_id == g_keyNotecardQueryID)
49 {
50 if(data != EOF)
51 {
52 // Store the text.
53 g_strNotecardText += data;
54
55 // Read next notecard line.
56 ++g_intNotecardLine;
57 g_keyNotecardQueryID = llGetNotecardLine(g_strNotecardName, g_intNotecardLine);
58 }
59 else
60 {
61 // We have reached the end of the notecard.
62 llOwnerSay("Size: " + (string)llStringLength(g_strNotecardText));
63 llOwnerSay("Rendering Media image...please wait.");
64
65 // Refresh the URL again by setting a random URL parameter value.
66 llSetPrimMediaParams(0,[ PRIM_MEDIA_CURRENT_URL,
67 "data:text/html," + g_strNotecardText ]);
68 }
69 }
70 }
71
72 }

HTML_Rendering_from_Notecard

Notecard text I used to render the text in the image:

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

1 <html>
2 <head>
3 </head>
4 <body
5 style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 204);">
6 <title></title>
7 <table style="text-align: center; height: 1008px; width: 100%;"
8 background="http://www.spiralgraphics.biz/packs/metal_robust/previews/Basketweave%20Plates.jpg">
9 <tbody>
10 <tr>
11 <td><span style="font-weight: bold; font-size: 40pt;">
12 This is a demo webpage using the 'data:text/html'.<br>
13 <br>
14 <span style="color: rgb(0, 0, 153);">
15 Hi Slack....well at least 1024 characters
16 </span><br style="color: rgb(0, 0, 153);">
17 <span style="color: rgb(0, 0, 153);">
18 is better than 254!</span><br>
19 <br>
20 <span style="font-style: italic; color: rgb(0, 102, 0);">
21 So good enough for the majority of people! :-)<br>
22 </span>
23 </span> </td>
24 </tr>
25 </tbody>
26 </table>
27 </body>
28 </html>
29

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