Jump to content

Control music stream (URL)


Isobeast
 Share

You are about to reply to a thread that has been inactive for 974 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

The parcel audio stream can be set by a script owned by the same account that owns the land. (That means on group-owned land, the script needs to be in a group-deeded object.)

Then it's up to the script to get stream links from wherever it's handy in the application. If, for example, literally anybody should be able to set the stream to anything at all, the script could take input from llTextBox() perhaps in a touch_start() event handler, then maybe llEscapeURL() of the response string it gets in listen(), and llSetParcelMusicURL() with that tidied-up string.

Another common scenario is for the stream-changing script, owned by the landowner, to communicate with "remote control" scripted objects owned by tenants; there are surely commercial products that do this, and maybe some open source scripts.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

1 hour ago, Isobeast said:

Hey! how can a landowner allow others to control (change) the music stream on their land using a script?

can anyone add their own streams in this case?

is it possible?

 

the method to do this is: http://wiki.secondlife.com/wiki/LlSetParcelMusicURL

if you want the others to be able to set the parcel music to anything they want then the script can offer a llTextBox for them to type in the url

edit: what Qie said

Edited by Mollymews
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

3 hours ago, Qie Niangao said:

The parcel audio stream can be set by a script owned by the same account that owns the land. (That means on group-owned land, the script needs to be in a group-deeded object.)

Then it's up to the script to get stream links from wherever it's handy in the application. If, for example, literally anybody should be able to set the stream to anything at all, the script could take input from llTextBox() perhaps in a touch_start() event handler, then maybe llEscapeURL() of the response string it gets in listen(), and llSetParcelMusicURL() with that tidied-up string.

Another common scenario is for the stream-changing script, owned by the landowner, to communicate with "remote control" scripted objects owned by tenants; there are surely commercial products that do this, and maybe some open source scripts.

 

3 hours ago, Mollymews said:

 

the method to do this is: http://wiki.secondlife.com/wiki/LlSetParcelMusicURL

if you want the others to be able to set the parcel music to anything they want then the script can offer a llTextBox for them to type in the url

edit: what Qie said

Thank you very much! Definite progress has been made on this issue, thanks to you!

 

Could you please also help to make the text box activate when the avatar is sitting on a prim?

And how to determine the moment when the avatar gets up to change the URL to the default one?

Link to comment
Share on other sites

This script looks very useful!

https://community.secondlife.com/forums/topic/32812-basic-pose-ball-script/

... But how do you prevent the error message from appearing if there is no animation in the prim or the animation is named incorrectly?

Is it possible to simply pop up a message in the chat instead of it stating that "the animation is missing or is incorrectly named ... "

 

Oh, and what to do if the URL entered is invalid, or the text is not a URL at all?

Edited by Isobeast
Link to comment
Share on other sites

40 minutes ago, Isobeast said:

Could you please also help to make the text box activate when the avatar is sitting on a prim?

And how to determine the moment when the avatar gets up to change the URL to the default one?

changed(integer change)
{
if( change & CHANGED_LINK)
	{
		key avatar = llAvatarOnSitTarget();
		if( avatar != NULL_KEY)
		{
			llTextBox(avatar, "Type in your wishes", channel);		// you will need to have pre-defined channel
		}
		else
		{
			// the avatar previously sitting has just this minute leeft
			// do your tifyups here
		}

	}

}

 

Edited by Profaitchikenz Haiku
  • Thanks 1
Link to comment
Share on other sites

2 hours ago, Isobeast said:

Oh, and what to do if the URL entered is invalid, or the text is not a URL at all?

On this matter, I have no experience at all. If there's a channel playing Buxtehude I'll experiment.

Just a guess, but you could try passing such an invalid string and seeing hat the function return codes are, that' most likely where youre going to get some indication of what didn't agree with the recieveer.

  • Thanks 1
Link to comment
Share on other sites

1 hour ago, Profaitchikenz Haiku said:

On this matter, I have no experience at all. If there's a channel playing Buxtehude I'll experiment.

Just a guess, but you could try passing such an invalid string and seeing hat the function return codes are, that' most likely where youre going to get some indication of what didn't agree with the recieveer.

Thank you very much! Now it is clear!

Link to comment
Share on other sites

small example of checking for animation..

key sitter; // global
string animation;
default
{
    state_entry()
    { animation = llGetInventoryName( INVENTORY_ANIMATION,0 ); 
      vector scale = llGetScale();
      llSitTarget( <scale.x/2, 0.0, scale.z + 0.01>, ZERO_ROTATION );
      llSetClickAction(CLICK_ACTION_SIT);
    }   
    changed(integer change)
    {
        if (change & CHANGED_LINK)
        {   sitter = llAvatarOnSitTarget();
        
            if(sitter != NULL_KEY)
            { llRequestPermissions(sitter , PERMISSION_TRIGGER_ANIMATION);
            }
            else
            {  if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)
               {  if( animation) llStopAnimation(animation);  
               }             
            }
        }
    }
    run_time_permissions(integer perm)
    {
        if ( perm & PERMISSION_TRIGGER_ANIMATION )
        {  if( animation )
           {  llStartAnimation(animation);
              llStopAnimation("sit");
           }
           else
           { llRegionSayTo( sitter,0, "the animation is missing or is incorrectly named ... " );
           }
        }
    }
}

 

  • Thanks 1
Link to comment
Share on other sites

to check for a valid stream, you might do something like...

 listen(integer channel, string name, key id, string message)
    {   string stream = llStringTrim( message, STRING_TRIM );
        if( llGetSubString( stream, 0, 3) != "http")
        {   llSay(0, "Invalid Stream URL: " + message);
        }
        else
        {   llSay(0, "Setting Stream to:  " + message);
        }
    }

 

  • Like 1
Link to comment
Share on other sites

we can check the current url with

4 hours ago, Isobeast said:

Oh, and what to do if the URL entered is invalid, or the text is not a URL at all?

as Prof suggested try sticking some random text in with llSetParcelMusicUrl

i haven't got a own parcel at the moment to test it but I think that llGetParcelMusicUrl returns a empty string in the invalid/random case

http://wiki.secondlife.com/wiki/LlGetParcelMusicURL

Edited by Mollymews
  • Thanks 1
Link to comment
Share on other sites

18 hours ago, Isobeast said:

how can a landowner allow others to control (change) the music stream on their land

I recommend against allowing visitors to enter arbitrary URLs; it's a big security hole. (Not all internet sound streams are G-rated.) Instead, allow them to select stations from a menu. You can collect a few dozen radio stations, store them on a notecard as "name = URL" lines, retrieve them using llGetNotecardLine() and dataserver(), parse each line to name and URL using llParseString2List(), store the station names and URLs into lists (or into a strided list), present station names on dialog-box menu pages using llDialog(), and set media using llSetParcelMusicURL().

 

 

 

Edited by LoneWolfiNTj
added more pointers
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Just now, LoneWolfiNTj said:

Ah, OK. Well, then he'll just have to write his own script. 🙂

is all good, but just be aware is quite a few forum police on there.  The report button gets a lot of love

and yes thats what we are trying to encourage in the scripting forum. Have a go at doing themselves

 

  • Like 1
Link to comment
Share on other sites

1 minute ago, Mollymews said:

Have a go at doing themselves

Well, I did give the OP some pointers. But depending on how elaborate he/she wants to get, and depending on their prior experience, a script could take anything from 5 minutes to 20 hours to get working right. (I spent dozens of hours getting my own radio scripts working right. If I had it to do over again, it would now be much faster, but at the time I was much more of a noob, so it was a struggle. Ah, the joys and pains of getting a big script working right in a language one barely knows.)

  • Like 2
Link to comment
Share on other sites

11 minutes ago, Mollymews said:

a little bit too involved

Or in a regulatory grey area. 🙂  Alas, it's as you say, some people in internet groups (including site employees, forum mods, local residents, and random visitors) have inflexible views on "prevailing rules" and iron fists on "report" buttons. And me being a naughty son-of-a-gun who sees "rules" as being "flexible things which should be stretched as far as possible until I start getting suspended", well, I sometimes do get into trouble for that. 🙂  But you're right, some things should be taken private, in-part to avoid just that kind of problem.

  • Like 1
Link to comment
Share on other sites

19 hours ago, Xiija said:

to check for a valid stream, you might do something like...

 listen(integer channel, string name, key id, string message)
    {   string stream = llStringTrim( message, STRING_TRIM );
        if( llGetSubString( stream, 0, 3) != "http")
        {   llSay(0, "Invalid Stream URL: " + message);
        }
        else
        {   llSay(0, "Setting Stream to:  " + message);
        }
    }

 

Thank you very much! Your examples were very useful to me!

 

Another question. I'm trying to add a group check if (llDetectedGroup(0)), and to use llUnSit() if not in group, but none of the events seem to work for this: changed, listen and run_time_permissions ... What to do in this case?

 

  • Like 1
Link to comment
Share on other sites

Not that I know of.

Go back to where you were going to add the group-check and have another go.

If the toucher is also the sitter, then do the llDetectedGroup() check. If that check is false, unsit the sitter.

If nobody is sitting but you get a touch, what is your plan? Ignore the touch? Tell them to sit? 

  • Thanks 1
Link to comment
Share on other sites

42 minutes ago, Profaitchikenz Haiku said:

Not that I know of.

Go back to where you were going to add the group-check and have another go.

If the toucher is also the sitter, then do the llDetectedGroup() check. If that check is false, unsit the sitter.

If nobody is sitting but you get a touch, what is your plan? Ignore the touch? Tell them to sit? 

The plan was this: the avatar clicks on the prim, and if the group matches, then the avatar has, say, ten seconds to sit down. if the group does not match, then there is no way to sit. and then I realized that the avatar can also sit with the right mouse button ... and then I got stuck.

 

Edited by Isobeast
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 974 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...