Radio Script...
|
|
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
|
10-18-2005 11:40
So I've built a simple radio script that relies on llDialog to change stations on my parcel...not a big deal. I'm posting not 'cause I need help with the script, but 'cause all the radio station URLs I have seem to have suddenly disappeared off the face of the earth 2 days ago. I'm sure it's a normal occurance...but am wondering where people go to find URLs to listen to? I have my own Shoutcast station still on my radio and one or two other stations that work--but hey, I've got 12 station buttons  Anyway...sorry for posting under Scripting Tips...just no more appropriate forum area that I can see...and it does...sorta...relate to scripting. Maybe when I get back on SL this evening I'll post up the radio script...not that people don't already have 'em everywhere 
|
|
Riann Maltese
!@%$#
Join date: 20 Jul 2005
Posts: 35
|
10-18-2005 14:04
http://www.shoutcast.com/directory/ has a list of radio stations in almost any genre you can think of.
|
|
Testament Languish
Tainted Soul
Join date: 18 Sep 2005
Posts: 43
|
10-18-2005 14:35
I know I'd like a radio script for my land...the silence is driving me over the edge 8P
_____________________
One of the unforgiven roaming the land.
|
|
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
|
10-18-2005 20:04
Thanks...and here's a simple radio script for people to play with: //------------------------RADIO STATION CHANGER------------------------------ // // By: Kenn Nilsson // Updated: 10/17/05 // Version: 0.1 // //---------------------------------------------------------------------------
string station1 = ""; //fill each station string with the URL for your desired station. string station2 = ""; string station3 = ""; string station4 = ""; string station5 = ""; string station6 = ""; string station7 = ""; string station8 = ""; string station9 = ""; string station10 = ""; string station11 = ""; string station12 = "";
string name1 = ""; //Name each station--this name will be your button name. string name2 = ""; string name3 = ""; string name4 = ""; string name5 = ""; string name6 = ""; string name7 = ""; string name8 = ""; string name9 = ""; string name10 = ""; string name11 = ""; string name12 = "";
integer group;
key id;
list stationlist = [];
default { state_entry() { llListen(13, "", NULL_KEY, ""); stationlist = [name1, name2, name3,name4, name5,name6,name7,name8,name9,name10,name11,name12]; }
touch_start(integer total_number) { group = llDetectedGroup(0); if(group == TRUE) { id = llDetectedKey(0); llDialog(id, "Choose a Radio Station.", stationlist, 13); } } listen(integer channel, string name, key id, string message) { if(message == name1) { llSetParcelMusicURL(station1); } if(message == name2) { llSetParcelMusicURL(station2); } if(message == name3) { llSetParcelMusicURL(station3); } if(message == name4) { llSetParcelMusicURL(station4); } if(message == name5) { llSetParcelMusicURL(station5); } if(message == name6) { llSetParcelMusicURL(station6); } if(message == name7) { llSetParcelMusicURL(station7); } if(message == name8) { llSetParcelMusicURL(station8); } if(message == name9) { llSetParcelMusicURL(station9); } if(message == name10) { llSetParcelMusicURL(station10); } if(message == name11) { llSetParcelMusicURL(station11); } if(message == name12) { llSetParcelMusicURL(station12); } } }
There it is...with set-up needed in the globals. It'd be easy enough to write a script that could rip 12 lines off a notecard...just haven't done it yet. The llDetectedGroup is not necessary...but my land is group-owned and I just put it in as a hard-check on parcel ownership (radio-station cannot be changed by someone who does not own the land on which they are trying to change the station).
|
|
Testament Languish
Tainted Soul
Join date: 18 Sep 2005
Posts: 43
|
Thanks!
10-19-2005 03:40
Thanks for the script! You my friend rule!
_____________________
One of the unforgiven roaming the land.
|
|
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
|
10-19-2005 05:11
I tweaked the script a bit, now you put the stations' names and URLS in a notecard and drop it in the radio. Also, it supports almost any number of station. Format of the notecard: My station=http://the.server.address:port/ Script (needs testing, there might be some typos left): //------------------------RADIO STATION CHANGER------------------------------ // // By: Kenn Nilsson and Jesrad Seraph // Updated: 10/17/05 // Version: 0.2 // //---------------------------------------------------------------------------
string card; integer line; key query;
integer group; integer part; integer handle; integer channel;
list stationlist = []; list stationnames = [];
menu(key id) { list b; if (llGetListLength(stationnames) < 13) { b = stationnames; } else { if (part > llGetListLength(stationnames)) part = 0; b = llList2List(stationnames, part * 11, part * 11 + 9) + ["More"]; } llDialog(id, "Choose a station:", b, channel); }
default { state_entry() { if (llGetInventoryNumber(INVENTORY_NOTECARD) == 0) { llOwnerSay("No notecard found for loading station URLs, please drop one in."); } else { card = llGetInventoryName(INVENTORY_NOTECARD, 0); query = llGetNotecardLine(card, line = 0); } }
changed(integer c) { if (c & CHANGED_INVENTORY) llResetScript(); }
dataserver(key id, string data) { if (query != id) return; if (data == EOF) return; integer i = llSubStringIndex(data, "="); if (i >= 0) { stationnames += [llGetSubString(data, 0, i - 1)]; stationlist += [llDeleteSubString(data, 0, i)]; } query = llGetNotecardLine(card, ++line); }
touch_start(integer total_number) { id = llDetectedKey(0); if(llSameGroup(id) { llListenRemove(handle); channel = (integer)llFrand(555555) + 10000; handle = llListen(channel, "", id, ""); menu(id); llSetTimerEvent(30.0); } }
timer() { llListenRemove(handle); llSetTimerEvent(0.0); }
listen(integer channel, string name, key id, string message) { if (message == "More") { part += 1; llSetTimerEvent(30.0); menu(id); return; } integer index = llListFindList(stationnames, [message]); if (index < 0) return; llSetParcelMusicURL(llList2String(stationlist, index)); llListenRemove(handle); llSetTimerEvent(0.0); } }
_____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.
|
|
Logan Bauer
Inept Adept
Join date: 13 Jun 2004
Posts: 2,237
|
10-19-2005 09:52
Also, just FYI, it's not free but Alondra LeFay makes "SLAmp" which is what I use and is just friggin' awesome. SLAmp at SLExYou can search for a particular genre or artist on the fly and find some really good stations that way.
|
|
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
|
10-19-2005 12:26
Nice Jesrad...thanks. Just halved my work for me 
|
|
Sydney Alexander
Registered User
Join date: 19 Feb 2005
Posts: 69
|
02-23-2006 07:12
Hmmm I am receiving an error when I compile this script... seems to be around the group land check I think, but I onlyu had 30 seconds to look.. any ideas? thanks From: Jesrad Seraph I tweaked the script a bit, now you put the stations' names and URLS in a notecard and drop it in the radio. Also, it supports almost any number of station. Format of the notecard: My station=http://the.server.address  ort/ Script (needs testing, there might be some typos left): //------------------------RADIO STATION CHANGER------------------------------ // // By: Kenn Nilsson and Jesrad Seraph // Updated: 10/17/05 // Version: 0.2 // //---------------------------------------------------------------------------
string card; integer line; key query;
integer group; integer part; integer handle; integer channel;
list stationlist = []; list stationnames = [];
menu(key id) { list b; if (llGetListLength(stationnames) < 13) { b = stationnames; } else { if (part > llGetListLength(stationnames)) part = 0; b = llList2List(stationnames, part * 11, part * 11 + 9) + ["More"]; } llDialog(id, "Choose a station:", b, channel); }
default { state_entry() { if (llGetInventoryNumber(INVENTORY_NOTECARD) == 0) { llOwnerSay("No notecard found for loading station URLs, please drop one in."); } else { card = llGetInventoryName(INVENTORY_NOTECARD, 0); query = llGetNotecardLine(card, line = 0); } }
changed(integer c) { if (c & CHANGED_INVENTORY) llResetScript(); }
dataserver(key id, string data) { if (query != id) return; if (data == EOF) return; integer i = llSubStringIndex(data, "="); if (i >= 0) { stationnames += [llGetSubString(data, 0, i - 1)]; stationlist += [llDeleteSubString(data, 0, i)]; } query = llGetNotecardLine(card, ++line); }
touch_start(integer total_number) { id = llDetectedKey(0); if(llSameGroup(id) { llListenRemove(handle); channel = (integer)llFrand(555555) + 10000; handle = llListen(channel, "", id, ""); menu(id); llSetTimerEvent(30.0); } }
timer() { llListenRemove(handle); llSetTimerEvent(0.0); }
listen(integer channel, string name, key id, string message) { if (message == "More") { part += 1; llSetTimerEvent(30.0); menu(id); return; } integer index = llListFindList(stationnames, [message]); if (index < 0) return; llSetParcelMusicURL(llList2String(stationlist, index)); llListenRemove(handle); llSetTimerEvent(0.0); } }
|
|
Sydney Alexander
Registered User
Join date: 19 Feb 2005
Posts: 69
|
02-23-2006 07:17
I own SLAMP and have to admit the functions are wonderful. I am not crazy about the big ol' display since the song does not update. seems to be over kill at 14 prims to just display the station name... The search abilities and the ease of use are very very cool. Wish it was 1 prim with a rotating llSetText would be awesome! From: Logan Bauer Also, just FYI, it's not free but Alondra LeFay makes "SLAmp" which is what I use and is just friggin' awesome. SLAmp at SLExYou can search for a particular genre or artist on the fly and find some really good stations that way.
|
|
Sydney Alexander
Registered User
Join date: 19 Feb 2005
Posts: 69
|
02-23-2006 20:11
After taking the time I found the little buggers... Her eis a version that will compile. //------------------------RADIO STATION CHANGER------------------------------ // // By: Kenn Nilsson and Jesrad Seraph // Updated: 10/17/05 // Version: 0.2 // //---------------------------------------------------------------------------
string card; integer line; key query;
integer group; integer part; integer handle; integer channel;
list stationlist = []; list stationnames = [];
menu(key id) { list b; if (llGetListLength(stationnames) < 13) { b = stationnames; } else { if (part > llGetListLength(stationnames)) part = 0; b = llList2List(stationnames, part * 11, part * 11 + 9) + ["More"]; } llDialog(id, "Choose a station:", b, channel); }
default { state_entry() { if (llGetInventoryNumber(INVENTORY_NOTECARD) == 0) { llOwnerSay("No notecard found for loading station URLs, please drop one in."); } else { card = llGetInventoryName(INVENTORY_NOTECARD, 0); query = llGetNotecardLine(card, line = 0); } }
changed(integer c) { if (c & CHANGED_INVENTORY) llResetScript(); }
dataserver(key id, string data) { if (query != id) return; if (data == EOF) return; integer i = llSubStringIndex(data, "="); if (i >= 0) { stationnames += [llGetSubString(data, 0, i - 1)]; stationlist += [llDeleteSubString(data, 0, i)]; } query = llGetNotecardLine(card, ++line); }
touch_start(integer total_number) { key id = llDetectedKey(0); if(llSameGroup(id)); { llListenRemove(handle); channel = (integer)llFrand(555555) + 10000; handle = llListen(channel, "", id, ""); menu(id); llSetTimerEvent(30.0); } }
timer() { llListenRemove(handle); llSetTimerEvent(0.0); }
listen(integer channel, string name, key id, string message) { if (message == "More") { part += 1; llSetTimerEvent(30.0); menu(id); return; } integer index = llListFindList(stationnames, [message]); if (index < 0) return; llSetParcelMusicURL(llList2String(stationlist, index)); llSetText((llList2String(stationlist, index)), <1,1,1>, 1); llListenRemove(handle); llSetTimerEvent(0.0); } }
From: Sydney Alexander Hmmm I am receiving an error when I compile this script... seems to be around the group land check I think, but I onlyu had 30 seconds to look.. any ideas?
thanks
|
|
Krystalline Rosewood
Registered User
Join date: 9 Feb 2006
Posts: 3
|
03-25-2006 12:19
I am still learning to script in SL and I decided to play with this script.
I have a question. Is there a way to make the script reset when you reach the last station on the notecard? Currently, it will just give blank menu pages until you go in and edit either the notecard or the script.
I am sure there is a way to make this happen but I just haven't been able to figure it out yet. Could someone not just tell me what to do but explain why? I really am trying to learn how to do this.
|
|
Gryphon Stonebender
Registered User
Join date: 25 Jan 2005
Posts: 24
|
01-08-2007 21:03
THis is a great little radio script. Any way to make it read a user list from a notecard so it is not public?
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
01-09-2007 01:48
From: Gryphon Stonebender THis is a great little radio script. Any way to make it read a user list from a notecard so it is not public? Add a dataserver event. Look at some of the door lock scripts previously posted, they use the same mechanism.
|