Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llSetParcelMusicURL jukethingy

Pol Tabla
synthpop saint
Join date: 18 Dec 2003
Posts: 1,041
03-10-2005 10:48
I'm setting up some music to play on my parcel using the llSetParcelMusicURL command. I'm not using an audio stream; I'm pointing directly at MP3 files.

Inexperienced as I am with LSL, I am trying to keep things as simple as possible. Right now I have three plywood boxes (buttons), each containing a variation of the following script:

CODE
default
{
touch_start(integer total_number)
{
llSetParcelMusicURL("http://www.whatever.com/mymusic.mp3");
}
}


Two of the box scripts point to different music files. The other box has a blank URL field:

CODE
llSetParcelMusicURL("");


And acts as a stop button. So far so good. Touch a box, music plays. Touch the stop box, music stops playing. Simple, works like a charm, jukeboxriffic.

However, I have one nagging issue I would like to resolve. I would like my parcel to default to silence, with no URL in the SetParcelMusic field. I'd like to have my visitors choose to turn on the music rather than be assaulted by it as soon as they enter the parcel. Of course, as soon as someone sets the ParcelMusicURL, it stays pointed at that URL unless they touch the stop box or I enter a blank value using the about land tool.

So, my question is this. How would you, as a scripter more knowledgeable than I, automatically return the SetParcelMusicURL to a blank field after someone was done listening to my llPhatTunes(yo)? Keep in mind that the final setup will have around 8 buttons you can press to listen to different songs, and a stop button. And we don't want to interrupt someone's blissful music listening session with a badly-timed llSetParcelMusicURL("";);

Bonus points for the simplest solution. Thanks in advance.
_____________________
Jack Lambert
Registered User
Join date: 4 Jun 2004
Posts: 265
03-10-2005 10:57
Wow,

Interesting delimma. I would probably set a timer event after you load the url, right after the touch_start(). Obviously, that requires you to hard-code the timeout, so you'd have to know how long your longest song is :(

CODE

default
{
state_entry()
{
llSetParcelMusicURL("");
}

touch_start (integer iTotalNumber)
{
llSetParcelMusicURL("http://www.whatever.com/mymusic.mp3");
llSetTimerEvent(600); // 10 minutes
}
timer()
{
llSetParcelMusicURL("");
llSetTimerEvent(0);
}
}


I realise it's ugly and that timers lag out when lots of people are around but I don't know how you are supposed to know when the music stops otherwise :(

--Jack Lambert
_____________________
----------------------------
Taunt you with a tree filled lot? hahahahahahaha. Griefer trees! Good lord you're a drama queen. Poor poor put upon you.

-Chip Midnight
Newfie Pendragon
Crusty and proud of it
Join date: 19 Dec 2003
Posts: 1,025
03-10-2005 10:58
In very basic terms:

- Put in a timer event - say, maybe once a minute (wouldn't think it's needed more than that)
- Perform a sensor sweep for all avatars. Check if they are over your land (so as not to count those on neighbour's land)
- If the # of avatars is zero, turn off the music.

Just a quick thought there.


- Newfie
_____________________
Jack Lambert
Registered User
Join date: 4 Jun 2004
Posts: 265
03-10-2005 11:01
Same thing can be accomplished with llSensorRepeat() ... even though we hate it :)

Be sure to turn off the sensor after you detect nobody...there's no sense for it to be running if the music hasn't been started.

Obviously, this doesn't address the issue of the URL still being associated with the property if the music stops and people ARE still there :)

--Jack Lambert
_____________________
----------------------------
Taunt you with a tree filled lot? hahahahahahaha. Griefer trees! Good lord you're a drama queen. Poor poor put upon you.

-Chip Midnight
Pol Tabla
synthpop saint
Join date: 18 Dec 2003
Posts: 1,041
03-10-2005 11:49
From: Newfie Pendragon
- Put in a timer event - say, maybe once a minute (wouldn't think it's needed more than that)

Hell, it could be once every five minutes. I don't get that many visitors.
From: Newfie Pendragon
- Perform a sensor sweep for all avatars. Check if they are over your land (so as not to count those on neighbour's land)

Is there a specific method to sweep your own parcel only? Or is the only option to center the sensor in the parcel and set the radius which best fits?

Seems like I have a choice:

EASY: I can have a single, independent sensor running all the time at five minute intervals, or
LESS EASY: I can put a timer/sensor code combo in each of the 8 music button scripts which, when activated by the touch action, checks for avs at five minute intervals and shuts both itself and the music down if the plot is empty. The risk is I could have as many as 8 of these scanners running at one time if someone presses all the buttons.

Any opinions on which of the above are less of an overall performance hit?

Wish there was a llGetParcelMusicURL function.
From: Jack Lambert
Obviously, this doesn't address the issue of the URL still being associated with the property if the music stops and people ARE still there

If people are on my plot, it is officially a par-tay zone, and they are fair game for my awesome grooves.

I believe at this point I am supposed to say WOOT or something.
_____________________
Annah Zamboni
Banannah Annah
Join date: 2 Jun 2004
Posts: 1,022
03-10-2005 12:34
Have you thought about using llLoadURL to point to your mp3 url when 1.6 comes out? This would let the user play the stream in whatever app they associate with it and not force anyone else to listen to it?
JustAnother Millhouse
Registered User
Join date: 26 Dec 2004
Posts: 31
03-10-2005 12:40
From: Pol Tabla

LESS EASY: I can put a timer/sensor code combo in each of the 8 music button scripts which, when activated by the touch action, checks for avs at five minute intervals and shuts both itself and the music down if the plot is empty. The risk is I could have as many as 8 of these scanners running at one time if someone presses all the buttons.


Linked prim that runs the timer/scanner, each button just sends out a "PLAYINGMUSIC" or "MUSICSTOPPED" type message, depending on that the link prim does its scan or not?

Run your sensor, pass all the found keys through llOverMyLand(key id) to make sure they are actually on your property, if no_sensor() then stop the music.

Gets around the multiple running at the same time, keeping the timers/sensors to a minimum.

JA
Pol Tabla
synthpop saint
Join date: 18 Dec 2003
Posts: 1,041
03-10-2005 13:13
From: Annah Zamboni
Have you thought about using llLoadURL to point to your mp3 url when 1.6 comes out? This would let the user play the stream in whatever app they associate with it and not force anyone else to listen to it?

Here's the context for this project:
In RL I'm a musician. Up until recently SL hasn't been a particularly good medium for music, but with llSetParcelMusicURL and the upcoming video capabilities, things are improving.

My plan is to develop an SL experience around the music, so I definitely want it to play in-world. However, llLoadURL will be very handy if a visitor wants to know more about a particular song or to download it to their computer.

What I would like to avoid is pelting some innocent bystander, flying over my parcel to get to their destination, with audio. I personally hate flying over a parcel and getting whacked with a big, loud wad of banal music. I hate it enough that I've turned off music streaming in my prefs. So this is my attempt to be a good citizen.
_____________________
Pol Tabla
synthpop saint
Join date: 18 Dec 2003
Posts: 1,041
03-10-2005 13:16
From: JustAnother Millhouse
Linked prim that runs the timer/scanner, each button just sends out a "PLAYINGMUSIC" or "MUSICSTOPPED" type message, depending on that the link prim does its scan or not?

Run your sensor, pass all the found keys through llOverMyLand(key id) to make sure they are actually on your property, if no_sensor() then stop the music.

Thanks JA. Figuring out exactly how to execute this will take me a little time, but it makes sense functionally. I was unaware of llOverMyLand.
_____________________
JustAnother Millhouse
Registered User
Join date: 26 Dec 2004
Posts: 31
03-10-2005 16:48
From: Pol Tabla
Thanks JA. Figuring out exactly how to execute this will take me a little time, but it makes sense functionally. I was unaware of llOverMyLand.


np, glad to help. if you're still stuck after a day or so, track me down i'll help you out.