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
Floating Text TypingName  

TypingName

TypingName.lsl

Category: Floating Text
By : Xylor
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for TypingName
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. TypingName_1.lsl
1
2 1// remove this number for the script to work.
3
4 //////////////////////////////
5 // Floating Name Script
6 //
7 // This script periodically updates
8 // the text above the object to
9 // display the name of the object
10 //
11 // Written by Xylor
12 ///////////////////////////////
13
14 vector OVERRIDE_COLOR = <0, 1, 1>; // Cyan
15 integer gUseOverride = FALSE;
16
17 integer SIDE_TO_CHECK_COLOR = 0;
18 string gFloatingText;
19 integer gStringPos;
20 integer gStringSize;
21
22 float gLetterDelayBase = 0.1;
23 float gLetterDelayVar = 1;
24
25 float gLineRepeatDelayBase = 2.5;
26 float gLineRepeatDelayVar = 1;
27
28 key gOwner;
29
30 UpdateText() {
31 string ObjName = llGetObjectName();
32 if(ObjName != gFloatingText) {
33 gFloatingText = ObjName;
34 gStringPos = 0;
35 gStringSize = llStringLength(gFloatingText);
36 }
37 }
38
39 vector GetTextColor() {
40 // Override color?
41 if(gUseOverride)
42 return OVERRIDE_COLOR;
43
44 vector RGB = llGetColor(SIDE_TO_CHECK_COLOR);
45
46 // Rotate the Hue 180 degrees, and
47 // invert the Luminance.
48 RGB.x = 1.0 - RGB.x;
49 RGB.y = 1.0 - RGB.y;
50 RGB.z = 1.0 - RGB.z;
51
52
53 return RGB;
54 }
55
56 default {
57 state_entry() {
58 gOwner = llGetOwner();
59 UpdateText();
60 llSetTimerEvent(0.1);
61
62 llListen(0, "", gOwner, "remove text");
63 }
64
65 on_rez(integer param) {
66 if(gOwner != llGetOwner())
68 }
69
70 listen(integer channel, string name, key id, string mesg) {
71 llSetText("", <1, 1, 1>, 1.0);
72 llSetTimerEvent(0.0);
74 }
75
76 changed(integer change) {
77 if(change == CHANGED_COLOR) {
78 UpdateText();
79 llSetTimerEvent(0.1);
80 }
81 }
82
83 timer() {
84 UpdateText();
85
86
87 llSetText(llGetSubString(gFloatingText, 0, gStringPos),
88 GetTextColor(), 1.0);
89
90 gStringPos++;
91 if(gStringPos >= gStringSize) {
92 gStringPos = 0;
93
94 llSetTimerEvent( gLineRepeatDelayBase +
95 llFrand(gLineRepeatDelayVar));
96 return;
97 }
98 llSetTimerEvent( gLetterDelayBase +
99 llFrand(gLetterDelayVar));
100 }
101 }
102 // END //

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