Radio Script

Written by Kitsune
list stations = [ ]; // add station URLs here between the [ ] in quotes seperated by commas "url1", "url2", "url3"....
list station_descriptions = [ ];  // add station descriptions here between the [ ] in quotes seperated by commas... they should be in the same order as the urls they describe, you can use "" for any of them if you do not wish to add a description.
list djs = [ ];  // add the names of those authorized to change stations here between the [ ] in quotes seperated by commas
integer current_station = -1;

default
{
    state_entry()
    {
        current_station = -1;
    }

    on_rez(integer start_param)
    {
        llResetScript();
    }
    
    touch_start(integer total_number)
    {
        if(llListFindList(djs, (list)llKey2Name(llDetectedKey(0))) != -1)
        {
            current_station++;
            if(current_station >= llGetListLength(stations))
                current_station = 0;
            llSetTimerEvent(3);
            llWhisper(0, "Now Playing Station " + (string)current_station + ": " + llList2String(station_descriptions, current_station));
        }
    }
    
    timer()
    {
        llSetParcelMusicURL(llList2String(stations, current_station));
        llSetTimerEvent(0);
    }
}