Difference between revisions of "Textbox2Hovertext"
Jump to navigation
Jump to search
Ackley Bing (talk | contribs) |
Ackley Bing (talk | contribs) |
||
Line 1: | Line 1: | ||
<lsl> | <lsl> | ||
// Textbox2Hovertext | // Textbox2Hovertext by Ackley Bing & Omei Qunhua | ||
// A simple script to allow object owners to change the "hovertext" | // A simple script to allow object owners to change the "hovertext" | ||
// on their prims using a text entry box (llTextBox). | // on their prims using a text entry box (llTextBox). | ||
integer listenhandle; | |||
default | default | ||
{ | { | ||
touch_start(integer num) | touch_start(integer num) | ||
{ | { | ||
key target = llDetectedKey(0); | |||
if(target!=llGetOwner()) return; // remove this line to allow anyone to change the hover text | |||
llListenRemove(listenhandle); | |||
llSetTimerEvent(60.0); // Time to input text until script closes listener in case owner doesnt enter anything into textbox | |||
listenhandle=llListen(-12345, "", target, ""); | |||
llTextBox( target, "Set Hovertext", -12345); | |||
} | } | ||
listen(integer channel, string name, key id, string message) | listen(integer channel, string name, key id, string message) | ||
{ | { | ||
llSetText(message, <1.0,1.0,1.0>, 1.0); | llSetText(message, <1.0,1.0,1.0>, 1.0); | ||
llListenRemove( | llListenRemove(listenhandle); | ||
llSetTimerEvent(0.0); | llSetTimerEvent(0.0); | ||
} | } | ||
timer() | timer() | ||
{ | { | ||
llListenRemove( | llListenRemove(listenhandle); | ||
llSetTimerEvent(0.0); | llSetTimerEvent(0.0); | ||
} | } | ||
Line 32: | Line 33: | ||
Here is a further improved and corrected version by Omei Qunhua, removing the confusion between toucher and owner, and simplifying the listen removal. | Here is a further improved and corrected version by Omei Qunhua, removing the confusion between toucher and owner, and simplifying the listen removal. | ||
:I have updated my script to avoid any confusions about listeners and non-owner touches. Your version is slightly different and works just as well but is it really necessary to have duplicated information on the same page? --[[User:Ackley Bing|Ackley Bing]] 10:51, 13 February 2013 (PST) | :I have updated my script to avoid any confusions about listeners and non-owner touches. Your version is slightly different and works just as well but is it really necessary to have duplicated information on the same page? --[[User:Ackley Bing|Ackley Bing]] 10:51, 13 February 2013 (PST) | ||
:I merged our versions into one. Makes sense ok? --[[User:Ackley Bing|Ackley Bing]] 12:15, 28 February 2013 (PST) | |||
Revision as of 12:15, 28 February 2013
<lsl> // Textbox2Hovertext by Ackley Bing & Omei Qunhua // A simple script to allow object owners to change the "hovertext" // on their prims using a text entry box (llTextBox).
integer listenhandle;
default {
touch_start(integer num) { key target = llDetectedKey(0); if(target!=llGetOwner()) return; // remove this line to allow anyone to change the hover text llListenRemove(listenhandle); llSetTimerEvent(60.0); // Time to input text until script closes listener in case owner doesnt enter anything into textbox listenhandle=llListen(-12345, "", target, ""); llTextBox( target, "Set Hovertext", -12345); } listen(integer channel, string name, key id, string message) { llSetText(message, <1.0,1.0,1.0>, 1.0); llListenRemove(listenhandle); llSetTimerEvent(0.0); } timer() { llListenRemove(listenhandle); llSetTimerEvent(0.0); }
} </lsl>
Here is a further improved and corrected version by Omei Qunhua, removing the confusion between toucher and owner, and simplifying the listen removal.
- I have updated my script to avoid any confusions about listeners and non-owner touches. Your version is slightly different and works just as well but is it really necessary to have duplicated information on the same page? --Ackley Bing 10:51, 13 February 2013 (PST)
- I merged our versions into one. Makes sense ok? --Ackley Bing 12:15, 28 February 2013 (PST)