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