Need some help with a script for RfL Heroes tribute
|
|
Dumisani Ah
Pass me the hammer
Join date: 2 Dec 2006
Posts: 95
|
07-16-2008 13:33
Hi everyone, I am pressed for time so need to ask here quickly - does anyone know of a script opensource or commercial that will allow ppl to touch a prim and then 'chat' a name of an avatar that will then be added to floating text above the prim? We want to use it for our tribute to those who have died fighting cancer and in anothe tribute to those who fought and survived or are fighting cancer.
_____________________
Screwdrivers are so 90's...
|
|
Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
|
07-16-2008 14:06
I didn't test this inworld, but TextMate says the syntax is ok...  This script will listen to an AV for 30 seconds after being touched and then add the said Text to the Hovertext of the Prim. On the first line, you can add a title...
string hoverTitle = "Add a title here";
integer listener; // Always set up a handler for a listener
string hovertext; key toucher;
default{ state_entry{ // We don't do anything here :) } touch_start(integer x) { toucher = llDetectedKey(0); llSay(0, toucher, "Say the name of the person you want to add to the list. You've got 30 seconds to add a name."); listener = llListen(0, "", toucher, ""); llSetTimerEvent(30); } }
listen(integer chan, string name, key id, string msg) { if(chan == 0 && id == toucher){ hovertext += message + "\n"; llSetText(hoverTitle + "\n"+ hovertext, <255, 255, 255>, 1.0); } }
timer(){ llSetTimerEvent(0); llListenRemove(listener); } }
|
|
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
|
07-16-2008 14:59
Just remember that hovertext is limited to 255 charecters
|
|
Dumisani Ah
Pass me the hammer
Join date: 2 Dec 2006
Posts: 95
|
07-16-2008 15:16
Thanks Haruki, I've got it down to the following changes as SL gave me some errors: string hoverTitle = "Fallen Heroes:";
integer listener; // Always set up a handler for a listener
string hovertext; string message; key toucher;
default { state_entry() { } // We don't do anything here : touch_start(integer x) { toucher = llDetectedKey(0); llSay(0, "Say the name of the person you want to add to the list. You've got 30 seconds to add a name."); listener = llListen(0, "", toucher, ""); llSetTimerEvent(30); }
listen(integer chan, string name, key id, string msg) { if(chan == 0 && id == toucher){ hovertext += message + "\n"; llSetText(hoverTitle + "\n"+ hovertext, <255, 255, 255>, 1.0); } } timer() { llSetTimerEvent(0); llListenRemove(listener); } }
The problem I have is that the script does not add the given text that the toucher has 'chatted' to the prim. Am I missing something fundamental in line 24 to 28? Thanks for the warning, Beverly, I'll keep that in mind. Might be a squeeze, but without web to SL facilities to media stream something it becomes darn hard to do this any other way for me in my basic understanding of lsl 
_____________________
Screwdrivers are so 90's...
|
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
07-16-2008 15:42
Replace:
hovertext += message + "\n";
With:
hovertext += msg + "\n";
"msg" contains the stuff spoken in chat, that's sent in to the listen event. "message" is a string variable you've defined up at the top of the script, that doesn't contain anything. So the script in its current form adds an empty string to the hover text, which gives you the effect you're seeing.
You can delete the:
string message;
Near the top of the script, it won't serve any purpose after this change.
Disclaimer - not in-world, can't test.
|
|
Dumisani Ah
Pass me the hammer
Join date: 2 Dec 2006
Posts: 95
|
07-17-2008 05:17
Hi Ziggy, yes I missed something THAT obvious - /me hangs head in shame... In honour of you all who helped me, this is the completed script (mostly Haruki's work), a nice touch-the-prim-to-add-text-through-chat-to-its-floating-text thingy - I use it to put some names down for those who have died to cancer in our SL groups, to honor them on the Bishara Resorts parcel on the Heroes sims for the RfL Relay events on the 19th and 20th of this month. So many thanks to you all for the help.
string hoverTitle = "Fallen Heroes:";
integer listener; // Always set up a handler for a listener
string hovertext; key toucher;
default { state_entry() { } // We don't do anything here : touch_start(integer x) { toucher = llDetectedKey(0); llSay(0, "Say the name of the person you want to add to the list. You've got 30 seconds to add a name."); listener = llListen(0, "", toucher, ""); llSetTimerEvent(30); }
listen(integer chan, string name, key id, string msg) { if(chan == 0 && id == toucher){ hovertext += msg + "\n"; llSetText(hoverTitle + "\n"+ hovertext, <255, 255, 255>, 1.0); } } timer() { llSetTimerEvent(0); llListenRemove(listener); } }
_____________________
Screwdrivers are so 90's...
|
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
07-17-2008 11:21
Heh, I had to look at it for a few minutes too because at first everything looked right 
|