這是改寫自 Riz Radio
http://www.ichigo-ongakudou.com/riz/hp/index.php?RiZ%E8%89%B2Radio
另外 Linden 有個 radio stream 電台列表 :
http://wiki.secondlife.com/wiki/Music_streams
其中用到重要函式:
(1) Function: llDialog( key avatar, string message, list buttons, integer channel );
• key | avatar | – | avatar UUID that is in the same region | |
• string | message | – | message to be displayed in the dialog box | |
• list | buttons | – | button labels | |
• integer | channel | – | output channel, any integer value |
key avatar : 對哪個主角顯示 Dialog
string message : 顯示的對話文字
list : 選擇的項目, 以 按鈕 表示.
channel : 通訊的 channel, 用 listen() 來收
--
Example :
string title = "Which radio stations : ";
dialoglist = [ "ROCK" , "RIZ" ];
llDialog(id, title, dialoglist, channel);
(2) Function: llSetParcelMusicURL( string url );
將這塊土地的音樂 stream 設為該 url.
完整 script 如下.
integer handle;
integer channel;
list dialoglist=[];
key id;
radio_select(key id)
{
string title = "Which radio stations : ";
dialoglist = [ "ROCK" , "RIZ" ];
llDialog(id, title, dialoglist, channel);
}
get_handle()
{
llListenRemove(handle);
channel = (integer)llFrand(555555) + 100000;
handle = llListen(channel, "", id, "");
}
default
{
on_rez(integer start_param)
{
llResetScript();
}
state_entry()
{
get_handle();
llSetText("Neo Radio",<0.88,0.26,0.0>,1.0);
}
touch_start(integer total_number)
{
id = llDetectedKey(0);
get_handle();
radio_select(id);
}
listen(integer channel, string name, key id, string message)
{
llSetTimerEvent(30.0);
if (message == "RIZ")
{
llSetParcelMusicURL( "http://www.ichigo-ongakudou.com/riz/riz_iro_radio_archive/mp3/riz_iro_radio_latest.mp3") ;
}
else if ( message == "ROCK" )
{
llSetParcelMusicURL( "http://de.slstreaming.com:10560") ;
}
}
timer()
{
llListenRemove(handle);
llSetTimerEvent(0.0);
}
}