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 Log_chat_to_a_prim  

Log_chat_to_a_prim

Log_chat_to_a_prim

Category: Viewer 2
By : Qie Niangao
Created: 2010-09-02 Edited: 2010-09-02
Worlds: Second Life

the Zip file

Download all files for Log_chat_to_a_prim
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Log_chat_to_a_prim_1.lsl
1 integer SHOW_FACE = 4;
2 list log;
3 integer logCount;
4 integer logSlot;
5 integer LOG_LENGTH = 10;
6 key urlRequestID;
7 string myURL;
8 integer flipper;
9 saveLog(string logText)
10 {
11 if(logSlot == logCount)
12 log += logText;
13 else
14 log = llListReplaceList(log, [logText], logSlot, logSlot);
15 logCount++;
16 logSlot = logCount % LOG_LENGTH;
17 }
18 default
19 {
21 {
22 llListen(0, "", "", "");
23 urlRequestID = llRequestURL();
24 llClearPrimMedia(SHOW_FACE);
25 }
26 on_rez(integer num)
27 {
29 }
30 changed(integer change)
31 {
32 if((CHANGED_REGION_START | CHANGED_REGION) & change)
33 urlRequestID = llRequestURL();
34 }
35 http_request(key id, string method, string body)
36 {
37 if(method == URL_REQUEST_GRANTED)
38 {
39 if(myURL != "")
40 llReleaseURL(myURL);
41 myURL = body;
42 llSetPrimMediaParams
43 ( SHOW_FACE
44 , [ PRIM_MEDIA_CONTROLS, PRIM_MEDIA_CONTROLS_MINI
45 , PRIM_MEDIA_HOME_URL, myURL
46 , PRIM_MEDIA_AUTO_PLAY, TRUE
47 , PRIM_MEDIA_WIDTH_PIXELS, 500
48 , PRIM_MEDIA_HEIGHT_PIXELS, 500
49 , PRIM_MEDIA_AUTO_SCALE, TRUE
50 , PRIM_MEDIA_PERMS_CONTROL, PRIM_MEDIA_PERM_NONE
51 ]
52 );
53 }
54 else
55 if((method == URL_REQUEST_DENIED) && (urlRequestID == id))
56 llSay(DEBUG_CHANNEL, "Report URL denied. (This shouldn't happen.) "+body);
57 else
58 if(method == "GET")
59 {
60 if(logSlot == 0)
61 llHTTPResponse(id, 200, llDumpList2String(log, "\n"));
62 else
63 llHTTPResponse(id, 200,
64 llDumpList2String(llList2List(log, logSlot, LOG_LENGTH-1), "\n")
65 + "\n" +
66 llDumpList2String(llList2List(log, 0, logSlot-1), "\n")
67 );
68 }
69 else
70 llHTTPResponse(id, 405, "Unsupported method: "+method);
71 }
72 listen(integer channel, string name, key id, string message)
73 {
74 string timeStamp=llGetTimestamp();
75 string blankIfEmote=":";
76 if("/me " == llToLower(llGetSubString(message, 0, 3)))
77 {
78 blankIfEmote="";
79 message = llGetSubString(message, 4, -1);
80 }
81 string thisRecord
82 = "["
83 + llGetSubString(timeStamp, 5, 9) // MM-DD
84 + " "
85 + (string)((integer)llGetWallclock() / 3600) // Pacific timezone hour
86 + llGetSubString(timeStamp, 13, 15) // :mm
87 + "] "
88 + name
89 + blankIfEmote
90 + " "
91 + message
92 ;
93 saveLog(thisRecord);
94 llSetPrimMediaParams
95 ( SHOW_FACE
96 , [ PRIM_MEDIA_CURRENT_URL, myURL+"/?rand="+(string)(flipper = !flipper)
97 ]
98 );
99 }
100 }

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