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 Notecard_Text_on_a_Prim  

Notecard_Text_on_a_Prim

For people who want to play with the Sha...

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

the Zip file

Download all files for Notecard_Text_on_a_Prim
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Notecard_Text_on_a_Prim_1.lsl
1 // Notecard Text on a Prim
2 // Developed by: Pavcules Superior
3 // Developed on: February 2010
4 string g_strURL;
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 ReadNotecardData()
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 ReadNotecardData();
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 ReadNotecardData();
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 data.
53 g_strNotecardText += data + "\n";
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("Rendering Media image.");
63
64 // Refresh the URL again by setting a random URL parameter value.
65 llSetPrimMediaParams(0,[ PRIM_MEDIA_CURRENT_URL, g_strURL + "/?rand=" + (string)llGetTime() ]);
66 }
67 }
68 }
69
70
71 http_request(key id, string method, string body)
72 {
73
74 if(g_keyURLRequestID == id)
75 {
76 g_keyURLRequestID = "";
77
78 if(method == URL_REQUEST_GRANTED)
79 {
80 g_strURL = body;
81
82 // Set the URL.
83 llSetPrimMediaParams(0,[ PRIM_MEDIA_CURRENT_URL, g_strURL]);
84
85 llSay(0,"URL: " + body);
86 }
87 else if(method == URL_REQUEST_DENIED)
88 {
89 llSay(0, "Something went wrong, no url. " + body);
90 }
91 }
92 else
93 {
94 // If the page is requested, show the notecard text.
95 llHTTPResponse(id, 200, g_strNotecardText);
96 }
97 }
98
99
100 }

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