Change font size
It is currently Sat Dec 15, 2018 2:16 pm

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 1   [ 6 posts ]
Author Message
 Post subject: Land/Parcel radio changer
PostPosted: Mon Nov 22, 2010 4:25 pm 
OSG Elite

Joined: Wed Aug 05, 2009 1:59 am
Posts: 417
Put the following script in a prim.
Create a notecard called stations.
Copy the example radio stations in this notecard. (Can be found waaay down this page)
Put the notecard in the prim.
Turn up the volume.
Kick your chair back.
Throw hands up in the air.
Have a good time.

The Script:
{L_CODE}:
////////////////////////////////////////////////////////////////////
// Please leave any credits intact in any script you use or publish.
// Please contribute your changes to the Internet Script Library at
// http://www.free-lsl-scripts.com
//
// Script Name: Radio_script.lsl
// Category: Radio
// Description: This Radio ist working into open grid too, changed and tested by me. On touch it will give you a dialog. Put this script into a object your choice! This script will change the media url of the owners parcel.
//NC "stations" with url`s of streams is needed! Write in this NC something like this "Radio1=http://....."
// Comment: The Script
//
// Downloaded from : http://www.free-lsl-scripts.com/freescripts.plx?ID=1431
//
// From the Internet LSL Script Database & Library of Second Life™ scripts.
// http://www.free-lsl-scripts.com  by Ferd Frederix
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the license information included in each script
// by the original author.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
//
////////////////////////////////////////////////////////////////////
string  _notecard = "stations";

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;
        list cmdPrevChunk;
        list cmdLsCur;
        list cmdLsAll;
        list cmdSearch;


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 += [url];
    _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 += "-";
       
        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(list theTerms) {
    integer i;
    string thePhrase = llToLower(llDumpList2String(theTerms, " "));
    llSay(0, "the term is " + thePhrase);
   
    for (i = 0; i < totalStations; i++) {
        string curString = llList2String(_radioStations, i);
        if (llSubStringIndex(llToLower(curString), thePhrase) != -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();
        cmdNextChunk = [">>", "next", "Next", NEXT_MSG];
        cmdPrevChunk = ["<<", "prev", "Prev", PREV_MSG];
        cmdLsCur     = ["ls", "list", LIST_MSG];
        cmdLsAll     = ["la", "listall"];
        cmdSearch    = ["s", "search"];
       
    }
   
    changed(integer change) {
        if (change & CHANGED_INVENTORY) {
            reset_radio();
        }
    }

    dataserver(key query_id, string data) {
        if (data != EOF) {
            add_station(data);
            _linenum++;
           
            if (_linenum % 3 == 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("Land Radio Demo\n Touch me.", <1,1,1>, 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(llList2List(words, 1, -1));
            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);
         }
    }
}
// Look for updates at : http://www.free-lsl-scripts.com/freescripts.plx?ID=1431
// __END__


And the example notecard (remember: name it: stations)

{L_CODE}:
Top 40 hits=http://188.72.209.73:80
Bellyup4Blues=http://64.62.252.134:5100/
Alternative rock=http://173.193.14.170:8006
Heavy Metal=http://64.34.187.144:8008
X-mas=http://174.133.111.21:80
R&B=http://216.59.35.39:8030


Oddy tip# 8871: How to find good music streams! <==LINK!!

Have fun,

Odd


Top
 Profile  
 
 Post subject: Re: Land/Parcel radio changer
PostPosted: Mon Mar 28, 2011 5:47 pm 
Furious Typer

Joined: Tue Mar 15, 2011 7:04 pm
Posts: 89
I installed this script into a Prim. The menu works beautifully and so does the stations text card BUT it does Not change the land stream. Am i missing something?
The station shows it has changed but the actual station never changes on the land.


Top
 Profile  
 
 Post subject: Re: Land/Parcel radio changer
PostPosted: Mon Mar 28, 2011 10:44 pm 
Furious Typer

Joined: Tue Mar 15, 2011 7:04 pm
Posts: 89
Ok it looks like this may be the Culprit... Is there any workaround for this?

llSetParcelMusicURL doesn't work on "deeded land to group"


Top
 Profile  
 
 Post subject: Re: Land/Parcel radio changer
PostPosted: Sat Apr 02, 2011 12:25 am 

Joined: Thu Mar 10, 2011 3:05 pm
Posts: 5
Any idea if this will work if you're not on the root sim of a megaregion? Just curious, I can test it later.


Top
 Profile  
 
 Post subject: Re: Land/Parcel radio changer
PostPosted: Sat Apr 02, 2011 8:26 pm 
Furious Typer

Joined: Tue Mar 15, 2011 7:04 pm
Posts: 89
Flux.. I have 6 sims and it works fine on the other 5 but as for the mega region I am not sure.


Top
 Profile  
 
 Post subject: Re: Land/Parcel radio changer
PostPosted: Sat Apr 02, 2011 10:46 pm 
Site Admin

Joined: Sun Nov 28, 2010 5:09 pm
Posts: 412
At this point in time, the only region you can control your audio is the South West region in a mega region. Has nothing to do with the particular script, it just only works in that one region. Now you can hear the audio in the other regions no problem with that, its just that they will all be the same source.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 6 posts ]


Who is online

Users browsing this forum: legacy_google [bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net