aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/bin/assets/ScriptsAssetSet/GrafittiBoard.lsl
diff options
context:
space:
mode:
Diffstat (limited to 'bin/assets/ScriptsAssetSet/GrafittiBoard.lsl')
-rw-r--r--bin/assets/ScriptsAssetSet/GrafittiBoard.lsl148
1 files changed, 74 insertions, 74 deletions
diff --git a/bin/assets/ScriptsAssetSet/GrafittiBoard.lsl b/bin/assets/ScriptsAssetSet/GrafittiBoard.lsl
index d30e8f0..954e3ea 100644
--- a/bin/assets/ScriptsAssetSet/GrafittiBoard.lsl
+++ b/bin/assets/ScriptsAssetSet/GrafittiBoard.lsl
@@ -1,74 +1,74 @@
1// Grafitti board 0.0.2 for OpenSim 1// Grafitti board 0.0.2 for OpenSim
2// By Justin Clark-Casey (justincc) 2// By Justin Clark-Casey (justincc)
3// http://justincc.wordpress.com 3// http://justincc.wordpress.com
4 4
5// This script is available under the BSD License 5// This script is available under the BSD License
6 6
7string text = ""; 7string text = "";
8 8
9int LISTENING_CHANNEL = 43; 9int LISTENING_CHANNEL = 43;
10 10
11// XXX Only putting this here as well to get around OpenSim's int -> string casting oddness 11// XXX Only putting this here as well to get around OpenSim's int -> string casting oddness
12string LISTENING_CHANNEL_STRING = "43"; 12string LISTENING_CHANNEL_STRING = "43";
13 13
14// FIXME: Should be dynamic! 14// FIXME: Should be dynamic!
15int CHARS_WIDTH = 42; 15int CHARS_WIDTH = 42;
16 16
17default 17default
18{ 18{
19 state_entry() 19 state_entry()
20 { 20 {
21 llSetText( 21 llSetText(
22 "Say /" + LISTENING_CHANNEL_STRING + " <message> to add text." 22 "Say /" + LISTENING_CHANNEL_STRING + " <message> to add text."
23 + " Say /" + LISTENING_CHANNEL_STRING 23 + " Say /" + LISTENING_CHANNEL_STRING
24 + " !clear to clear board", 24 + " !clear to clear board",
25 <0.0, 1.0, 0.0>, 1.0); 25 <0.0, 1.0, 0.0>, 1.0);
26 26
27 llListen(LISTENING_CHANNEL, "", NULL_KEY, ""); 27 llListen(LISTENING_CHANNEL, "", NULL_KEY, "");
28 28
29 addGraffiti("justincc's graffiti board v0.0.2"); 29 addGraffiti("justincc's graffiti board v0.0.2");
30 addGraffiti("Now with primitive word wrap!"); 30 addGraffiti("Now with primitive word wrap!");
31 draw(); 31 draw();
32 } 32 }
33 33
34 listen(integer channel, string name, key id, string message) 34 listen(integer channel, string name, key id, string message)
35 { 35 {
36 if (message == "!clear") 36 if (message == "!clear")
37 { 37 {
38 clearGraffiti(); 38 clearGraffiti();
39 } 39 }
40 else 40 else
41 { 41 {
42 addGraffiti(message); 42 addGraffiti(message);
43 } 43 }
44 44
45 draw(); 45 draw();
46 } 46 }
47} 47}
48 48
49// Add some additional graffiti 49// Add some additional graffiti
50void addGraffiti(string message) 50void addGraffiti(string message)
51{ 51{
52 while (llStringLength(message) > CHARS_WIDTH) 52 while (llStringLength(message) > CHARS_WIDTH)
53 { 53 {
54 text += "\n\n" + llGetSubString(message, 0, CHARS_WIDTH - 1); 54 text += "\n\n" + llGetSubString(message, 0, CHARS_WIDTH - 1);
55 message = llDeleteSubString(message, 0, CHARS_WIDTH - 1); 55 message = llDeleteSubString(message, 0, CHARS_WIDTH - 1);
56 } 56 }
57 57
58 text += "\n\n" + message; 58 text += "\n\n" + message;
59} 59}
60 60
61// Clear the existing graffiti 61// Clear the existing graffiti
62void clearGraffiti() 62void clearGraffiti()
63{ 63{
64 text = ""; 64 text = "";
65} 65}
66 66
67// Actually fires the graffiti out to the dynamic texture module 67// Actually fires the graffiti out to the dynamic texture module
68void draw() 68void draw()
69{ 69{
70 //llSay(0, text); 70 //llSay(0, text);
71 string drawList = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text " + text + ";"; 71 string drawList = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text " + text + ";";
72 72
73 osSetDynamicTextureData("", "vector", drawList, "1024", 0); 73 osSetDynamicTextureData("", "vector", drawList, "1024", 0);
74} 74}