Scomac Hicks
Here is the text of the sound script:
integer MENU_CHANNEL = -198284; // Or ohther negative number: negative channels wont show AV saying!
list MENU_OPTIONS = ["sound1","sound2","sound3","sound4"];
integer channelControl;
default
{
state_entry()
{
// Not shown here but looping the menu_options you could use
// llPreloadSound() - see LSL wiki
channelControl = llListen(MENU_CHANNEL,"",NULL_KEY,""
; llListenControl(channelControl,FALSE); // Don't listen just yet
}
touch(integer num_detected)
{
llListenControl(channelControl,TRUE); // Start listening for response
llSetTimerEvent(60); // Make sure 60s from now channel is closed again
llDialog(llDetectedKey(0),"Select the sound:",MENU_OPTIONS,MENU_CHANNEL);
}
listen(integer channel,string who,key id,string message)
{
if (channel==MENU_CHANNEL)
{
// message = name of button
// assume button name = name of soundfile
llPlaySound(message,1.0);
// Done, stop timer and channel
llSetTimerEvent(0);
llListenControl(channelControl,FALSE);
}
}
timer()
{
// Timeout wiating for dialog response,stop timer and channel
llSetTimerEvent(0);
llListenControl(channelControl,FALSE);
}
}
