Estate switch allowing only 1 media on a prim at a time?

Creating scripts
Post Reply
User avatar
Lunk Portal
Posts: 133
Joined: Wed Jan 26, 2022 10:03 am
Location: Northern Michigan
Has thanked: 92 times
Been thanked: 141 times
Contact:

Estate switch allowing only 1 media on a prim at a time?

Post by Lunk Portal »

Hey everyone,

My RPG TatooineRP is going live in a few days and I just realized an issue.

I have two media on a prims in the same building, once linked to audio and another to videos.

How do I create a trigger so that when either is active it sends the other back to the menu HTTP?

I cannot link them because of the way MOP works. It is annoying when one is on and the other is turned on and they are both going at once.

I was thinking I could create an estate counter and each player could check it when activated if it's 0 make it 1 if 1 leaves it one and send a trigger to send the other media to the menu HTTP address.

Does anyone out there do anything like this or have a direction to send my remedial Jawa rear-end to?
These users thanked the author Lunk Portal for the post:
Ilan Tochner
B. A. Shields (Lunk Portal)
TatooineRP Region
TatooineRP Website
Kitely Market - Lunk's Loot
My Novels and other Projects
https://linktr.ee/bashields
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1142 times

Re: Estate switch allowing only 1 media on a prim at a time?

Post by Graham Mills »

For some reason I never have much luck with MOAP so this may or may not work.

Rez a couple of prims, name them MOAP0 and MOAP1. Put the URL for the content to be displayed on each in their respective description fields. The HOME url is hard-coded in the script as is the display FACE used.

Code: Select all

integer CHAN = -727;
string HOME = "https://www.bbc.co.uk/";
string PLAY;
integer FACE = 2;
integer HNDL;

default
{
    state_entry()
    {
        PLAY = llGetObjectDesc();
        HNDL = llListen(CHAN, "", NULL_KEY, "");
    }
    
    listen(integer c, string name, key id, string msg)
    {
        llClearPrimMedia(FACE);
        if ((c == CHAN) && (msg == llGetObjectName()))//hears own name so plays url in object description
        {
            llSetPrimMediaParams(FACE,                             
            [PRIM_MEDIA_AUTO_PLAY,TRUE,                     
             PRIM_MEDIA_CURRENT_URL, PLAY,   
             PRIM_MEDIA_HOME_URL, HOME,      
             PRIM_MEDIA_HEIGHT_PIXELS,512,   
             PRIM_MEDIA_WIDTH_PIXELS,512]); 
        }
        else if ((c == CHAN) && (llSubStringIndex(msg, "MOAP") > -1))//hears other MOAP so reverts to HOME
        {
            llSetPrimMediaParams(FACE,              
            [PRIM_MEDIA_AUTO_PLAY,TRUE,                     
             PRIM_MEDIA_CURRENT_URL, HOME,  
             PRIM_MEDIA_HOME_URL, HOME,      
             PRIM_MEDIA_HEIGHT_PIXELS,512,    
             PRIM_MEDIA_WIDTH_PIXELS,512]); 
        }
    }      
}
Rez a prim, set Y taper = 1.0 and hopefully faces 1 and 3 should be uppermost and touchable to change which prim is playing. Add script. Texture faces as appropriate.

Code: Select all

integer CHAN = -727;

default
{
    touch_start(integer n)
    {
        if (llDetectedTouchFace(0) == 1)
        {
            llShout(CHAN, "MOAP0");
        }
        else if (llDetectedTouchFace(0) == 3)
        {
            llShout(CHAN, "MOAP1");
        }
    }
}
As ever, very basic but maybe get you started.
These users thanked the author Graham Mills for the post (total 2):
Ilan TochnerLunk Portal
Post Reply