Ingrid Ingersoll
Archived
Join date: 10 Aug 2004
Posts: 4,601
|
07-17-2005 08:35
I'm looking for a free radio tuner script that will work on group land. One that I can preset the music streams in a notecard. I saw one recently and forgot to bookmark it.
Thanks!
|
SteveR Whiplash
teh Monkeh
Join date: 24 Sep 2004
Posts: 173
|
07-17-2005 18:49
This doesn't use a notecard, but works just the same.
edit - In my haste, I made a few mistakes on this. Posting corrected (and more functional) code below.
|
Ingrid Ingersoll
Archived
Join date: 10 Aug 2004
Posts: 4,601
|
07-18-2005 06:42
THANK YOU STEVER! Works poifectly!
|
SteveR Whiplash
teh Monkeh
Join date: 24 Sep 2004
Posts: 173
|
07-24-2005 14:58
Ok, here's a much better version of the Radio script I posted above. Heh, it's maybe not quite so "simple" anymore, but for the user it's pretty easy. All you have to do is touch the radio to change stations, and when you do it tells you how to get the help menu for the other commands. Enjoy, // Simple Radio // --- SteveR Whiplash
// Directions: // --- Choose a listen channel below. // --- Make your default station list. // --- Put this script into your radio. // --- Click on the radio to cycle through the stations. // --- Say "/1 radio: help" to get a list of commands.
// --- Note that anyone with the same group tag as the radio can use it.
// --- Also note that if the land you're using the radio on is group owned, // --- you must deed the radio to that same group. // --- If you intend to change the listen channel, do so BEFORE you deed the radio to group.
// Listen Channel integer channel = 1;
// Stations list stations = [ // --- "Station Name", "Stream URL", "DI Psy Trance", "http://64.236.34.196:80/stream/2007", "OEM Radio", "http://lsac1-1-s02.shoutcast.net:8000/", "SomaFM Groove Salad", "http://207.200.96.228:8076",
// Do not edit below this line ----------------------------------------------- "Off", "" ];
string help1 = " - For Help type /"; string help2 = " radio: help";
integer sCurrent = 1; integer sNumber; list rMessage;
slen(){ sNumber = llGetListLength(stations); }
dsub(integer num){ rMessage = llDeleteSubList(rMessage, 0, num); }
default { on_rez(integer start_param){ llResetScript(); } changed(integer change){ if (change & 128){ llResetScript(); } } state_entry(){ llListen(channel, "", NULL_KEY, ""); slen(); string test = " " + " "; } touch(integer num_detected){ if (llDetectedKey(0) == llGetOwner() || llSameGroup(llDetectedKey(0))){ if (sCurrent == (sNumber - 1)){ sCurrent = 1; } else { sCurrent = sCurrent + 2; } llWhisper(0, llList2String(stations, sCurrent - 1) + help1 + (string)channel + help2); llSetParcelMusicURL(llList2String(stations, sCurrent)); } } listen(integer channel, string name, key id, string message){ if (id == llGetOwner() || llSameGroup(id)){ rMessage = llParseString2List(message, [" "], []); if (llToLower(llList2String(rMessage, 0)) == "radio:"){ string rCommand = llToLower(llList2String(rMessage, 1)); if (rCommand == "help"){ //help llWhisper(0, "To change stations simply click the radio. You can also type /" + (string)channel + " radio: StationName"); llWhisper(0, "If you'd like to hear the name of the currently playing station type /" + (string)channel + " radio: current"); llWhisper(0, "For a list of the available stations, type /" + (string)channel + " radio: list"); llWhisper(0, "To add or edit a station type /" + (string)channel + " radio: station: StationName = StationURL"); llWhisper(0, "To delete a station type /" + (string)channel + " radio: delete: StationName"); } else if (rCommand == "current"){ //say current llWhisper(0, llList2String(stations, sCurrent - 1)); } else if (rCommand == "list"){ //list stations integer x = 1; while (x <= sNumber){ string sList = llList2String(stations, x - 1) + " = " + llList2String(stations, x); if (llList2String(stations, x - 1) != "Off"){ llWhisper(0, sList); } x = x + 2; } } else if (rCommand == "station:"){ //edit/add station dsub(1); integer rSplit = llListFindList(rMessage, ["="]); list rMsg = [llDumpList2String(llDeleteSubList(rMessage, rSplit, -1), " ")]; rMsg = rMsg + [llDumpList2String(llDeleteSubList(rMessage, 0, rSplit), " ")]; if (llList2String(rMsg, 0) != "" && llList2String(rMsg, 1) != ""){ string rName = llList2String(rMsg, 0); integer rPos = llListFindList(stations, [rName]); if (rPos >= 0 && rPos % 2 == 0){ stations = llListReplaceList(stations, rMsg, rPos, rPos + 1); llWhisper(0, rName + " has been edited."); } else { stations = stations + rMsg; llWhisper(0, rName + " has been added."); slen(); } } } else if (rCommand == "delete:"){ //delete station dsub(1); string rName = llDumpList2String(rMessage, " "); integer rPos = llListFindList(stations, [rName]); if (rPos >= 0 && rPos % 2 == 0){ stations = llDeleteSubList(stations, rPos, rPos + 1); llWhisper(0, rName + " has been deleted."); slen(); } else { llWhisper(0, rName + " not found."); } } else { //change station dsub(0); string rName = llDumpList2String(rMessage, " "); integer rPos = llListFindList(stations, [rName]);
if (rPos >= 0 && rPos % 2 == 0){ sCurrent = rPos + 1; llWhisper(0, rName); llSetParcelMusicURL(llList2String(stations, sCurrent)); } } } } } }
|