Jump to content

Radio


Melita Magic
 Share

You are about to reply to a thread that has been inactive for 4167 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hello

I would like to make a Christmas radio.

I don't know if older scripts would work, since everything has been updated. 

I would like to make a radio with a pop up menu. It should be compatible with any viewer, including the old one. 

I want to make a one prim box with textures on it. Then, the type of script where someone clicks the prim, it pops up a window, the person can click which number for the station they choose.

Do those scripts exist? Are they 2 different scripts? 

Thanks.

Link to comment
Share on other sites

There are loads of freebie radio scripts out there, and it's not hard to write at least a simple one either.  The heart of a radio is the llSetParcelMusicURL function.   What you have to do is build a basic notecard reader script to read the URLs from a notecard and then drop them into a dialog.  Use the llDialog responses to trigger a llSetParcelMusicURL statement with the right URL.  You can do the whole thing in a single script with a handful of events.

  • Like 1
Link to comment
Share on other sites

In fact --- I'm a little slow tonight --- I wrote a script that's almost exactly what I just described above.  :smileysurprised::smileytongue: 

Take a look at http://community.secondlife.com/t5/LSL-Library/Dialog-Choices-from-Numbered-Buttons/m-p/786825#M131 .  You only need to change one line to convert it into exactly what you asked for.   Change this line ...

            llLoadURL(id,llList2String(Sites,Choice),llList2String(URLs,Choice));

which you'll find near the bottom of the script, into this ...

            llSetParcelMusicURL(llList2String(URLs,Choice));

 Then all you need is a notecard with your station choices on it. It should look like this ...

Piano=http://sl.magnatune.com/Piano
SmoothJazz = http://207.200.96.226:8052
More Jazz=http://207.200.96.227:8008
Guitar=http://205.188.215.232:8014
Beatles=http://beatlesradio.com:8088
WGLT=http://wgltmedia.ilstu.edu:8002
Leonard Cohen=http://208.86.251.144:9141

Be sure that your radio is owned by whoever owns the parcel it's on.  If that's a group, you'll have to deed it to the group.  That should do the trick.

 

 

  • Thanks 1
Link to comment
Share on other sites

Oops, I broke it already.

I substituted the line you said. I copied and pasted the whole thing into 'new script.' Then I hit 'save.' I got the error message. 

Maybe I shouldn't put the entire thing? Where do I begin with the copy and paste, please?

Here is what I have:

//URL Chooser -- Rolig Loon -- February 2011

 

// Reads web site information from a notecard in the format   Site name = http://www.a_great_URL.com

// and presents result in a URL prompt.

 

// Multipage dialog function uDlgBtnLst by Void Singer ( http://community.secondlife.com/t5/LSL-Scripting-Library/Dynamic-Multi-page-Dialog-AKA-Pagination/m-...

 )

list uDlgBtnLst( integer vIntPag )

{

    integer vIdxBeg = 10 * (~-vIntPag);          //-- 10 * (vIntPag - 1), enclose "~-X" in parens to avoid LSL bug

    integer vIdxMax = -~(~([] != gLstMnu) / 10); //-- (llGetListLength( gLstMnu ) - 1) / 10 + 1

    list vLstRtn =

      llListInsertList(

        llList2List( gLstMnu, vIdxBeg, vIdxBeg + 9 ), //-- grab 10 dialog buttons

        (list)("  <<---(" + (string)(vIntPag + (-(vIntPag > 1) | vIdxMax - vIntPag)) + ")"), //-- back button

        -1 ) + //-- inserts back button at index 9, pushing the last menu item to index 10

      (list)("  (" + (string)(-~((vIntPag < vIdxMax) * vIntPag)) + ")--->>"); //-- add fwd button at index 11

   

    return //-- fix the order to L2R/T2B

      llList2List( vLstRtn, -3, -1 ) + llList2List( vLstRtn, -6, -4 ) +

      llList2List( vLstRtn, -9, -7 ) + llList2List( vLstRtn, -12, -10 );

}

 

//--                       Anti-License Text                         --//*/

//     Contributed Freely to the Public Domain without limitation.     //*/

//   2009 (CC0) [ http://creativecommons.org/publicdomain/zero/1.0 ]   //*/

//  Void Singer [ https://wiki.secondlife.com/wiki/User:Void_Singer ]  //*/

//--

 

list gLstMnu;

integer gLine;

string gCard;

integer gDChan;

integer gDLisn;

key gQuery;

integer gCount;

list Sites;

list URLs;

list gDlabels;

 

default

{

    state_entry()

    {

        if (llGetInventoryNumber(INVENTORY_NOTECARD) > 0)

        {

            gCard = llGetInventoryName(INVENTORY_NOTECARD,0);

            gQuery =llGetNotecardLine(gCard,0);

            gCount = 1;

        }

        else

        {

            llOwnerSay("No URL notecard detected.");

        }

    }

    

    changed (integer change)

    {

        if (change & CHANGED_INVENTORY)

        {

            llResetScript();

        }

    }

    

    dataserver(key qID, string data)

    {

        if (qID == gQuery)

        {

            if (data != EOF)

            {

                integer idx = llSubStringIndex(data,"=");

                if (~idx)

                {

                    Sites += [llStringTrim(llGetSubString(data,0,idx-1),STRING_TRIM)];  //Site names from NC

                    URLs += [llStringTrim(llGetSubString(data,idx+1,-1),STRING_TRIM)];  //URLs from NC

                    gDlabels += [(string)gCount + ". " +llStringTrim(llGetSubString(data,0,idx-1),STRING_TRIM) + " \n"]; //Dialog text

                    gLstMnu += [(string)gCount]; // Button labels

                    ++gCount;

                }

                gQuery = llGetNotecardLine(gCard,++gLine);

            }

            else

            {

                llSay(0,"Initialized.");

                state running;

            }

        }

    }

}

                

state running

{

    changed (integer change)

    {

        if (change & CHANGED_INVENTORY)

        {

            llResetScript();

        }

    }

    

    touch_start(integer num)

    {

        llSetTimerEvent(10.0);

        gDChan = (integer)("0xF" + llGetSubString(llDetectedKey(0),0,6));

        gDLisn = llListen(gDChan,"","","");

        string temp = "";

        integer i;

        //Display the first 10 sites in dialog

        for (i=0;i<10;++i)

        {

            temp += llList2String(gDlabels,i);

        }

        llDialog(llDetectedKey(0),"Which site do you want to visit? \n"+ temp, uDlgBtnLst(1) ,gDChan);

    }

    

    listen (integer channel, string name, key id, string msg)

    {

        llSetTimerEvent(0.0);

        llListenRemove(gDLisn);

        // Has the user clicked either the ">>" or "<<" button?

        if (!llSubStringIndex( msg, "  " ))  //-- detects 2 (hidden) leading spaces

        {

            llSetTimerEvent(10.0);

            gDLisn = llListen(gDChan,"","","");

            string temp = "";

            integer menu =  (integer)llGetSubString( msg, -~llSubStringIndex( msg, "(" ), -1 );

            integer i;

            for (i=(10*(menu-1)-1);i<(10*menu);++i)

            {

                temp += llList2String(gDlabels,i);

            }

            llDialog( id, "Which site do you want to visit? \n"+ temp, uDlgBtnLst(menu), gDChan );

        }

        else // If user has clicked a numbered button

        {

            integer Choice = (integer) msg -1;

            llSetParcelMusicURL(llList2String(URLs,Choice));

        }

    }

    

    timer()

    {

        llSetTimerEvent(0.0);

        llWhisper(0,"Timeout. Please close the dialog box on your screen.");

        llListenRemove(gDLisn);

    }      

}

 

Link to comment
Share on other sites

It looks 99.99% fine to me (OK, slightly ugly) and it works too.  There's just one tiny copying error at the very top of the script.  There's a stray parenthesis,  ) , just before the line that says

list uDlgBtnLst( integer vIntPag )

Get rid of it and you're in good shape.  I edited it out in the original just now.  Dunno what it was doing there.

 

Link to comment
Share on other sites

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4167 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...