Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help with a Video Collision Scipt

Patti Frye
Registered User
Join date: 25 Aug 2006
Posts: 60
07-21-2007 12:51
I wonder if someone could help me with this script.

I want to have the current video stream start playing when anyone enters my place.

Not for just group members either.

I'm thinking of some sort of a collision prim located at the entrance.

This script works well, but it must be clicked on before it plays and I would like it to be automated.

I would also like it to LOOP.

Thanks in advance

==============================================

float START_TIME = 30.0;
float RUN_LENGTH = 10.0;

default
{
state_entry()
{
if ( llParcelMediaQuery([PARCEL_MEDIA_COMMAND_TEXTURE]) == [] )
llSay(0, "Lacking permission to set/query parcel media. This object has to be owned by/deeded to the land owner.";);
llParcelMediaCommandList( [
PARCEL_MEDIA_COMMAND_URL, "http://enter_your.url/here",
PARCEL_MEDIA_COMMAND_TEXTURE, (key) llGetTexture(0) ] );
}

touch_start(integer num_detected)
{
llParcelMediaCommandList( [
PARCEL_MEDIA_COMMAND_AGENT, llDetectedKey(0),
PARCEL_MEDIA_COMMAND_TIME, START_TIME,
PARCEL_MEDIA_COMMAND_PLAY ] );
list Info = llParcelMediaQuery([PARCEL_MEDIA_COMMAND_URL, PARCEL_MEDIA_COMMAND_TEXTURE]);
llSay(0, "Playing '" + llList2String(Info, 0) + "' on texture '" + (string)llList2Key(Info, 1) + "' for agent " + llDetectedName(0));
llSetTimerEvent(RUN_LENGTH);
}

timer()
{
llParcelMediaCommandList( [ PARCEL_MEDIA_COMMAND_STOP ] );
llSetTimerEvent(0.0);
}
}

====================================================
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
07-21-2007 13:47
All the code is there, all you need is to put the code in your prim and use a collision_start event or whatever you wish to trigger it, and put the code from the touch_start in there instead.

Keep in mind they still have to press play on their client, you can't get around that to my knowledge.
Patti Frye
Registered User
Join date: 25 Aug 2006
Posts: 60
07-21-2007 14:05
Thank you
I have been to places where my movie player started up without me doing anything.
I'm sure there is a code somewhere that can do that.

Do you know where I would put the collision part of the code at?
I'm really new to this and I found this code in the Scripts Library.
I'm trying to make it work for my application.

So any help would be greatly appreciated.
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
07-22-2007 08:58
Well, this is a little messy because I'd guess that the entry-way "collision collecting" prim will be distinct from the prim showing the video. That's not inherently a problem--any prim can hold the parcel media control script--but this particular script uses the texture of face 0 of the prim it's in as the parcel media texture, so... either that needs to be the case for the collision-collecting prim, too, or there needs to be some inter-prim chat/listen... or just omit the part of this script that resets the parcel media texture (which is what I'd do).

To make it work for collision instead of touch, as Shadow suggested, just replacing the words "touch_start" with "collision_start" should do the trick. (Just to reduce "noise" collisions, I might make it a transparent phantom prim, in which case there'd need to be llVolumeDetect(TRUE); somewhere, like the state_entry().)

The script as-is starts 30 seconds into the video, plays 10 seconds, and then stops. If instead it's supposed to loop the whole video, one would remove all the timer logic and use PARCEL_MEDIA_COMMAND_LOOP instead of _PLAY. Oh, and remove the PARCEL_MEDIA_COMMAND_TIME, START_TIME, part of the command, to start at the beginning.

From: Patti Frye
I have been to places where my movie player started up without me doing anything.
I've seen this, too, but I'd have expected that the script as posted would do it, too. Not sure what we're missing there.