Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: Bucky's Radio - 2.6.4

bucky Barkley
Registered User
Join date: 15 May 2006
Posts: 200
08-11-2006 15:12
This is a free radio, derived from Dianne's Radio. This is my first submission.

- easy configuration
- dialogs with extended station descriptions, prev & next pages
- chat commands (change station, list current chunk, list all, prev & next chunks)

Four files:
radio script
README
stations-short
Use of Dianne's Radio

Enjoy, and let me know of any bugs, custom work you want me to do, etc.

Bucky Barkley

-- radio script:

CODE

// -- Bucky's Radio - 2.6.4
// an update/expansion of an earlier script
// Bucky.Barkley@gmail.com - August 2006

// based on...
//=======Land Radio Script =======
//
// assembled for this purpose by
// sky Honey and Dianne Mechanique
// based on the work of others
//
//===========9/12/05==============

// which notecard would you like to use?
string _notecard = "stations-short";

integer chatChannel = 77;
string HELP_MSG = "touch for station dialog, or use ch 77 to change stations (example \"/77 3\")";

list _radioURLs;
list _radioStations;
list theStations;

integer _linenum = 0;
integer curStationOffset = 0;
integer stationChunk = 6;
integer curStationEnd = 5;
integer totalStations = 0;
integer dialogActive = 0;
integer curIdx = -1;
string dispStationStr = "";

string NEXT_MSG = "Next >>";
string PREV_MSG = "<< Prev";
string LIST_MSG = "List";

string CUR_SET = "c";
string ALL_SET = "a";

list cmdNextChunk = [">>", "next", "Next", NEXT_MSG];
list cmdPrevChunk = ["<<", "prev", "Prev", PREV_MSG];
list cmdLsCur = ["ls", "list", LIST_MSG];
list cmdLsAll = ["la", "listall"];
list cmdSearch = ["s", "search"];

string newURL;
string newDesc;

//-----------------------

reset_radio() {
llSetText("starting radio ....", // message to display
<1,0,0>, // color: <red,green,blue>
1.0 ); // 1.0 = 100% opaque, 0.0 = transparent
llListen(77, "", "", "");
curStationOffset = 0;
curStationEnd = 5;
_linenum = 0;
dialogActive = 0;
_radioURLs = [];
_radioStations = [];
totalStations = 0;
curIdx = -1;
dispStationStr = "";
llGetNotecardLine(_notecard, _linenum);
}

add_station(string line) {
list words = llParseString2List(line, [" ", " ", "="], []);
if (llGetListLength(words) < 2) {
return;
}
string url = llList2String(words, llGetListLength(words) - 1);
string station = "";
integer i;

for (i=0; i<llGetListLength(words) - 1; i++) {
if (llStringLength(station) > 0) {
station += " ";
}
station += llList2String(words, i);
}

_radioURLs += ;
_radioStations += [station];
}


curStations() {
theStations = [PREV_MSG, LIST_MSG, NEXT_MSG];

integer i;
dispStationStr = "";

// llWhisper(0, "offset: " + (string)curStationOffset);
// llWhisper(0, "end: " + (string)curStationEnd);

for (i = curStationOffset; i <= curStationEnd; i++) {
if (curIdx == i) {
dispStationStr += "*";
} else {
dispStationStr += " ";
}
dispStationStr += (string) (i + 1) + ") ";
dispStationStr += llList2String(_radioStations, i);
dispStationStr += "\n";

theStations += (string)(i + 1);
}
}


doNextSet() {
curStationOffset += stationChunk;
curStationEnd = curStationOffset + (stationChunk - 1);

if (curStationOffset >= totalStations) {
curStationOffset = 0;
curStationEnd = curStationOffset + (stationChunk - 1);
}

if (curStationEnd >= totalStations) {
curStationEnd = totalStations - 1;
}
}


doPrevSet() {
if (curStationOffset > 1 && ((curStationOffset - stationChunk) < 1)) {
curStationOffset = 0;
} else {
curStationOffset -= stationChunk;
}

curStationEnd = curStationOffset + (stationChunk - 1);

if (curStationEnd >= totalStations) {
curStationEnd = totalStations - 1;
}

if (curStationOffset < 0) {
curStationEnd = totalStations - 1;
curStationOffset = totalStations - (stationChunk - 1);
}
}

doListStations(string mode) {
integer i;
integer startPos;
integer endPos;

if (mode == "a") {
startPos = 0;
endPos = totalStations - 1;
} else {
startPos = curStationOffset;
endPos = curStationEnd;
}

for (i = startPos; i <= endPos; i++) {
string newURL = llList2String(_radioURLs, i);
string newDesc = llList2String(_radioStations, i);
llSay(0, (string)(i + 1) + ": " + newDesc + " = " + newURL);
}
}


doSearch(string theTerm) {
integer i;

llSay(0, "the term is " + theTerm);

for (i = 0; i < totalStations; i++) {
string curString = llList2String(_radioStations, i);
if (llSubStringIndex(curString, theTerm) != -1) {
string newURL = llList2String(_radioURLs, i);
llSay(0, (string)(i + 1) + ": " + curString + " = " + newURL);
}
}
}

//-----------------------

default {
on_rez(integer start_param) {
reset_radio();
}

state_entry() {
reset_radio();
}

changed(integer change) {
if (change & CHANGED_INVENTORY) {
reset_radio();
}
}

dataserver(key query_id, string data) {
if (data != EOF) {
add_station(data);
_linenum++;

if (_linenum % 5 == 0) {
llSetText("starting: \n" + (string)_linenum + " stations ...", // message to display
<1,0,0>, // color: <red,green,blue>
1.0 ); // 1.0 = 100% opaque, 0.0 = transparent
}
llGetNotecardLine(_notecard, _linenum);
return;
}
llListen(93, "", NULL_KEY, "");

totalStations = llGetListLength(_radioURLs);
llSay(0, HELP_MSG);
dialogActive = 1;
llSetText("", <1,0,0>, 1.0 );
}

touch_start(integer touchNumber) {
curStations();

llDialog(llDetectedKey(0),
dispStationStr,
theStations, 93);
}

listen(integer channel, string name, key id, string message) {

if (dialogActive == 0) {
llWhisper(0, " ... still loading stations ...");
return;
}

if (message == "") {
message = "cur";
}


list words = llParseString2List(message, [" ", " ", "="], []);
list testFind = llList2List(words, 0, 0);

if (llListFindList(cmdNextChunk, testFind) != -1) {
doNextSet();
curStations();
if (channel == chatChannel) {
doListStations(CUR_SET);
} else {
llDialog(id, dispStationStr,theStations, 93);
}
return;
}

else if (llListFindList(cmdPrevChunk, testFind) != -1) {
doPrevSet();
curStations();
if (channel == chatChannel) {
doListStations(CUR_SET);
} else {
llDialog(id, dispStationStr, theStations, 93);
}
return;
}

else if (llListFindList(cmdSearch, testFind) != -1) {
doSearch(message);
return;
}

else if (llListFindList(cmdLsAll, testFind) != -1) {
doListStations(ALL_SET);
return;
}


else if (llListFindList(cmdLsCur, testFind) != -1) {
doListStations(CUR_SET);
return;
}


else if ((integer)message > 0 && (integer)message < 256) {
curIdx = (integer)message - 1;

string newURL = llList2String(_radioURLs, curIdx);
string newDesc = llList2String(_radioStations, curIdx);

llSay(0, "setting station " + message + ":");
llSay(0, newDesc + " = " + newURL);
llSetParcelMusicURL(newURL);
}
}
}


-- README

CODE


Bucky's Radio - the free version 2.6.4

Please see the notecard "Use of Diane's Radio" for OPEN SOURCE terms.

This radio script drops into your favorite object. It provides dialog & chat interfaces, and you can throw a lot of stations at it!

Configuration

* As shipped, the radio looks for the notecard "stations-short"

* each line of the notecard takes the format:

<station description> = <url>

example:

Secret Agent = http://somafm-sc.streamguys.com:8082

* if you want to change the chat channel or notecard name, see the top of the "radio script" file. I ship it with channel 77 enabled.

Group Land

* make sure you are currently set to be in the same group as the land you are putting the radio on

* edit the radio object, under "General": set the group to be that of the land. Share the radio with the group, and Deed it.

Commands & Notes -- Dialog

* station descriptions are in a list, click the number of the station to change the channel

* the "Next" and "Prev" buttons will take you forwards and backwards through the list. They wrap around.

* "List" will echo the current chunk of stations to your chat history

* The currently selected station is preceded with a '*'

Commands -- Chat

As shipped, commands take the form of "/77 <command>"

* <number> - change the station - example: "/77 3" to change to channel 3 (without quotes...)

* "ls", "list" - same as "List" in dialog - echo current chunk of stations

* "la", "listall" - dump all stations to chat history

* "<<", "prev" - go backwards in station listing

* ">>", "next" - go forwards in station listing

This radio is derived from the one done by Dianne Mechanique & sky Honey.



-- stations-short
(I believe the stations in this list are all public knowledge]

CODE

BRITISH INVASION The Beatles.=http://64.40.99.2:8080
BeBop Radio = http://213.251.136.72:8800
BeatBlender [SOMAFM] =http://207.200.96.232:8006
Chillout,The Chillout Lounge = http://64.71.145.130:8010
European Trance, Techno, Hi-NRG =http://64.236.34.196:80/stream/1003
DavidByrne = http://www.live365.com/play/321397
Digitally Imported House silky sexy deep house = http://64.236.34.196:80/stream/1007
Frequence3 -- www.Frequence3.org - Une Rafale De Tubes =http://193.251.154.243:8000
Groove Salad - SOMA FM = http://somafm-sc.streamguys.com:8066
Jazz SKY - Absolutely Smooth Jazz 24/7 = http://64.236.34.196:80/stream/1010
Lounge,Digitally Imported Lounge = http://64.236.34.67:80/stream/1009
CLASSICAL =http://64.236.34.196:80/stream/1006
SOMA Groove Salad = http://64.202.98.91:8066
SOMA Illinois Street Lounge = http://207.200.96.231:8014
Salsa = http://194.79.31.246:7180
Secret Agent = http://somafm-sc.streamguys.com:8082
The Chillout Lounge = http://64.71.145.130:8010
TokyoNinja = http://211.9.44.188:8020
dance trance,Music One - Today's Dance = http://64.236.34.97:80/stream/1011
lounge - SmoothLounge.com = http://66.28.209.20:80
psy chillout -Chillout ambient psy chillout = http://64.236.34.67:80/stream/1035



-- Use of Dianne's Radio

(I am including this, as I used her code as a starting point)

CODE

March 6th, 2006
=================================
THIS RADIO IS PROVIDED FREE OF CHARGE TO ALL. =================================
IF YOU HAVE PAID MONEY FOR THIS RADIO PLEASE
"ABUSE REPORT" THE SELLER AS THEY HAVE *CHEATED*
YOU ON PURPOSE AND DESERVE TO BE PUNISHED.

The script is also provided as an OPEN SOURCE script and
is intended to allow you to make your own Radio and to
understand how the Radio and scripting works, NOT to
provide you with a means to rip-off others by re-using it
in a "closed" COMMERCIAL product.

IF YOU USE THIS SCRIPT IN ANOTHER RADIO, PLEASE LEAVE
IT SIMILARLY OPEN SOURCE FOR ALL TO SEE AND TO USE.

To work effectively, a Land Radio needs to be both copy-
able and transferable, so there is nothing to stop
copying and reselling of products like this except your
own sense of RIGHT and WRONG. Please use it. :-)
=================================

INSTRUCTIONS:

If you own the land:

- Click on the Radio to get the dialogue box and change stations.
- Put new stations in by editing the notecard inside

On group land the Radio must be owned by the group so:
- Make sure you have your Group Title showing
(the same group as the land you are on)
- Select "Share with Group" in the Radio properties
- Select "Deed to Group"

The Radio is now owned by the group and should be able to
change the land URL.

***ONCE THE RADIO IS DEEDED TO THE GROUP YOU CANT GET
IT BACK NOR ALTER THE STATIONS CARD INSIDE****

If you want to change the list of stations you have to res
another radio, change the notecard and then deed *that* Radio
to the group as before.

You can res and delete as many radios as you like.

Have fun :-)

Dianne Mechanique
sky Honey
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Original Thread
08-11-2006 19:32
/15/d6/129329/1.html
_____________________
i've got nothing. ;)
Macphisto Angelus
JAFO
Join date: 21 Oct 2004
Posts: 5,831
08-13-2006 02:13
Sweeeet!! thanks for this script. :) I have been looking for a radio script for awhile.
_____________________
From: Natalie P from SLU
Second Life: Where being the super important, extra special person you've always been sure you are (at least when you're drunk) can be a reality!


From: Ann Launay
I put on my robe and wizard ha...
Oh. Nevermind then.
Teddy Qinan
Registered User
Join date: 10 Mar 2007
Posts: 34
Updated Station list
06-10-2007 08:53
SomaFM: Groove Salad (128k mp3) = http://64.236.34.97:80/stream/1018
SomaFM: Secret Agent (128k mp3) = http://64.236.34.97:80/stream/1021
SomaFM: Drone Zone (128k mp3) = http://64.236.34.97:80/stream/1032
SomaFM: Doomed (128k mp3) = http://160.79.128.242:8300
SomaFM: Space Station Soma (128k mp3) = http://207.200.96.231:8012
SomaFM: Indie Pop Rocks! (128k mp3) = http://64.236.34.97:80/stream/1073
SomaFM: Illinois Street Lounge (128k mp3) = http://160.79.128.242:8500
SomaFM: Beat Blender (128k mp3) = http://207.200.96.232:8006
SomaFM: Tag's Trance Trip (128k mp3) = http://205.188.215.230:8012
SomaFM: cliqhop idm (128k mp3) = http://207.200.96.231:8014
SomaFM: Boot Liquor (128k mp3) = http://207.200.96.232:8014
Radio Paradise modern & classic rock = http://64.236.34.97:80/stream/1048
.997 The Hitz Channel = http://64.236.34.97:80/stream/1074
.997 The 80s Channel = http://64.236.34.97:80/stream/1040
SKY.FM - 80s, 80s, 80s! = http://64.236.34.97:80/stream/1013
SKY.FM - Top Hits Music = http://64.236.34.97:80/stream/1014
SKY.FM - Absolutely Smooth Jazz = http://64.236.34.97:80/stream/1010
SKY.FM - Mostly Classical = http://64.236.34.97:80/stream/1006
SKY.FM - Classical & Flamenco Guitar = http://207.200.96.229:8016
Dioxide DeSantis
Registered User
Join date: 2 Feb 2007
Posts: 63
06-10-2007 14:38
Ok pretty much anyone that touches it can change the URL it seems is there a way this script can be adapted to only let certain people change the url?

So I could have my DJ change it when needed but not let the average guy come in and mess up the stream during an event?

Thanks in advance
Ace Albion
Registered User
Join date: 21 Oct 2005
Posts: 866
06-11-2007 01:12
in the touch or listens, you could get the key of whoever touched/spoke, and then check that against either a specific avatar key, or check for the same group or whatever.

The quick and dirty way is to get the key of anyone you want to use it, and paste them into the code in a big dirty If(... ) thing. The snazzier way would be a notecard list, that would take more work, but would be more flexible in future.
_____________________
Ace's Spaces! at Deco (147, 148, 24)
ace.5pointstudio.com
Dioxide DeSantis
Registered User
Join date: 2 Feb 2007
Posts: 63
06-11-2007 06:29
Yeah a note card would be a good way to do it but I am not at that point where I understand how to implement those just yet. :(

I am still in the beginning phases of learning the language.
poopmaster Oh
The Best Person On Earth
Join date: 9 Mar 2007
Posts: 917
06-11-2007 08:24
The main problem is that Streams go up and down so fast, is there a way to automaticly update the list of stations?


I have about 100 in my 'radio' only like 4 are still up :)
_____________________
InSL u find every kind of no-life retard you could possibly imagine as well as a few even Tim Burton couldnt imagine u find 12yr-olds claiming to be 40 men claiming 2 be women, women claiming 2 make sense and every1 claiming 2 have ideas that are actually worth a damn if only someone would just listen to their unique innovative and exceptionally important idea
Ace Albion
Registered User
Join date: 21 Oct 2005
Posts: 866
06-12-2007 03:03
Well I think it's up to you to find and list your stations, the bucky radio just had a bunch with it to help start it off.

I'm sure someone technical could do some web-magic and get lists of working stations from somewhere, but the whole thing would be a completely different radio script.
_____________________
Ace's Spaces! at Deco (147, 148, 24)
ace.5pointstudio.com
AWM Mars
Scarey Dude :¬)
Join date: 10 Apr 2004
Posts: 3,398
06-12-2007 03:27
I am interested in having a radio script made, one thats not open source as I intend to combine it with other media products, and will NOT abuse the hard work and talents of anyone giving their time freely. If anyone is interested, please IM me ingame.
_____________________
*** Politeness is priceless when received, cost nothing to own or give, yet many cannot afford -

Why do you only see typo's AFTER you have clicked submit? **
http://www.wba-advertising.com
http://www.nex-core-mm.com
http://www.eml-entertainments.com
http://www.v-innovate.com
Dioxide DeSantis
Registered User
Join date: 2 Feb 2007
Posts: 63
07-08-2007 19:47
Would anyone be interested in adding a users notecard to the script? I can't for the life of me figure it out I am sure its not all that hard but I'll be damned I cant figure out were to add it?

This is what I have come up with looking at other scripts.

//Define the notecard?
string userc = "users";

//call the card?
uquery = llGetNotecardLine(userc, uline);

but I have no idea where to place them in the script? Any help would really be appreciated
Dioxide DeSantis
Registered User
Join date: 2 Feb 2007
Posts: 63
07-12-2007 17:25
From: Dioxide DeSantis
Would anyone be interested in adding a users notecard to the script? I can't for the life of me figure it out I am sure its not all that hard but I'll be damned I cant figure out were to add it?

This is what I have come up with looking at other scripts.

//Define the notecard?
string userc = "users";

//call the card?
uquery = llGetNotecardLine(userc, uline);

but I have no idea where to place them in the script? Any help would really be appreciated



I would even be willing to pay someone to add the ability to this script.
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
07-12-2007 18:44
I have a radio that syncs multiple consoles. That is, if you have two or more on your land, and you change the channel on one, then all of them show the new channel in the floating text.
Dioxide DeSantis
Registered User
Join date: 2 Feb 2007
Posts: 63
07-12-2007 21:08
Now that I set one up in my club a bit ago I wanted to sell the item and I did sell some but it was brought to my attention that I could not do so because I did not make it open source. Basically I made the script no modify. So I promptly took them off and stopped selling it as I am not interested in getting rich off someone else's work. But I would like to make at least something off the photoshop work I did on the textures and the chasing down of the urls for working radios stations.

Well I guess what I am really looking for is a script that I can place in an item to sell with the radio textures I made and the urls as well. But I need a notecard for users as well.

I am fairly sure if I keep the script in the radio open source I can sell the box as long as the end user is able to edit and make any changes to the script but I really want to be sure before I do anything like that. Like I said I want to give credit where credit is due.

If someone is interested in creating a script I can use or has one that they resell please let me know and what the cost would be.