User:Dz/ShoutCast

From OpenSimulator

< User:Dz
Revision as of 14:02, 31 August 2015 by Dz (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

dzShoutCast

As with all OpenSimian projects posted here, You are free to copy/modify/and IMPROVE the functionality to fit your needs.

If you have feedback on script errors, please post it to the page discussion User_talk:Dz/ShoutCast


The script

I'm not going to write a lot about this script. It is relatively simple and I haven't really spent a ton of time refining it. Read the comments for information about use and distribution..

 

Group Land add-on

When you try and change the URL on group owned land, you need to use an object deeded to the group.. If you deed the ShoutCast board, you will probably lose the ability to edit the config note card...

Place this script in a small prim somewhere on the parcel and then deed the prim to the proper group. It will relay the original ShoutCast board message....

//  dzShoutCast group land add on   BETA
 
// Doug Osborn   MOSES grid   9/17/2014
// Copyright (c) 2014, 2015 Douglas Osborn
// All rights reserved.
 
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
 
// 1. Redistributions of source code must retain the above copyright notice, this
//    list of conditions and the following disclaimer. 
// 2. Redistributions in binary form must reproduce the above copyright notice,
//    this list of conditions and the following disclaimer in the documentation
//    and/or other materials provided with the distribution.
 
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS   
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 
//  This scipt is designed to listen for a shoutcast board on the current parcel
//  to send a "Change URL" message.  It is useful on group owned land.
//  Instead of deeding the shoutcast board to the group,..  Place this script in a prim,
//  leave the prim somewhere on the parcel,  and then deed the prim to the group.  
 
integer listen_handle = 0; // Initialize handler to register listener
string ParcelName = "";
integer listen_channel = -142356;
 
default
{       
    state_entry()   // Set the parcel Name  and start listening for messages on the designated channel
    {
        ParcelName = llList2String(llGetParcelDetails(llGetPos(), [PARCEL_DETAILS_NAME]),0);
 
        listen_handle = llListen( listen_channel, "", "", "");
    }
 
    listen( integer channel, string name, key id, string message )   //  Wait for incoming messages... 
    {
        if(llGetSubString(name, 0, 6) == "dzShout")  // Check to see they are from an object name we expect
        {
            list msg_list = llParseString2List(message,["|"],[""]); // parse the listen message
            string msgParcel = llList2String(msg_list ,0);          //  Looking for the parcel name it was sent from
            string msgHttp = llList2String(msg_list ,1);            //  and  double checking it sent us an URL
 
            if (llGetSubString(msgHttp, 0, 3) == "http"  && msgParcel == ParcelName)
            {
                llSetParcelMusicURL(msgHttp);       //  if  everyhting looks  good,   set the new  URL
 
//                llSay(0,"Setting url to : " + msgHttp);     //  and squawk about it  Or not
            }
        } 
    }
 
    on_rez(integer param)           //Triggered when the object is rezed
    {   
        llResetScript();            // By resetting the script on rez it forces the listen to re-register.
    }
 
    changed(integer mask)
    {   
        if(mask & CHANGED_OWNER)   // Triggered when the object containing this script changes owner.
        {
            llResetScript();        //  should reset when deeded to group in place.
        }
    }
}

Configuration Notecard

This is how URLs are added to the menus and grouped into Genres.

 
Personal tools
General
About This Wiki