Difference between revisions of "Textbox2Hovertext"
Jump to navigation
Jump to search
(channel and handle numbers are different. I do not like how you use a slow loop to remove listens but it's a clever solution that should work.) |
m (<lsl> tag to <source>) |
||
(13 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
< | <source lang="lsl2"> | ||
// Textbox2Hovertext | // Textbox2Hovertext by Ackley Bing & Omei Qunhua | ||
// A simple script to allow hovertext | // A simple script to allow object owners to change the "hovertext" | ||
// on their prims using a text entry box (llTextBox). | |||
integer listenhandle; | integer listenhandle; | ||
default | default | ||
{ | { | ||
touch_start(integer num) | touch_start(integer num) | ||
{ | { | ||
key | key Writer = llDetectedKey(0); | ||
llSetTimerEvent( | if(Writer!=llGetOwner()) return; // remove this line to allow anyone to change the hover text | ||
listenhandle = llListen( | llListenRemove(listenhandle); | ||
llTextBox( | llSetTimerEvent(60.0); // Time to input text until script closes listener in case target doesnt enter anything into textbox | ||
listenhandle=llListen(-12345, "", Writer, ""); | |||
llTextBox( Writer, "Set Hovertext", -12345); | |||
} | } | ||
listen(integer channel, string name, key id, string message) | listen(integer channel, string name, key id, string message) | ||
{ | { | ||
llSetText(message, <1 | llSetText(message, <1, 1, 1>, 1); | ||
llListenRemove(listenhandle); | |||
llSetTimerEvent(0.0); | |||
} | } | ||
timer() | timer() | ||
{ | { | ||
llListenRemove(listenhandle); | |||
llSetTimerEvent(0.0); | |||
} | } | ||
} | } | ||
</ | </source> | ||
[[Category:LSL Library]] |
Latest revision as of 07:48, 25 January 2015
// 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 Writer = llDetectedKey(0);
if(Writer!=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 target doesnt enter anything into textbox
listenhandle=llListen(-12345, "", Writer, "");
llTextBox( Writer, "Set Hovertext", -12345);
}
listen(integer channel, string name, key id, string message)
{
llSetText(message, <1, 1, 1>, 1);
llListenRemove(listenhandle);
llSetTimerEvent(0.0);
}
timer()
{
llListenRemove(listenhandle);
llSetTimerEvent(0.0);
}
}