integer Channel = 1; //Command Channel.
key Song;
key Picture;
default
{
state_entry()
{
llSetObjectName("Media Viewer");
Picture = llGetTexture(ALL_SIDES);
Song = llGetObjectDesc();
llListen(Channel, "", NULL_KEY, "");
}
touch_start(integer total_number)
{
llOwnerSay("\nSay commands on channel " + (string)Channel + ".\nSound: 'play <key>'/'stop'\nImage: 'show <key>'/'hide'");
}
listen(integer channel, string name, key id, string message)
{
list Cmd = llParseString2List(message, [" "], [""]);
if(llToUpper(llList2String(Cmd, 0)) == "PLAY")
{
llStopSound();
if(llList2String(Cmd, 1) != "")
{
Song = llList2String(Cmd, 1);
llSetObjectDesc(Song);
}
llLoopSound(Song, 1);
}
if(llToUpper(llList2String(Cmd, 0)) == "STOP")
{
llStopSound();
}
if(llToUpper(llList2String(Cmd, 0)) == "SHOW")
{
if(llList2String(Cmd, 1) != "")
{
Picture = llList2String(Cmd, 1);
}
llSetTexture(Picture, ALL_SIDES);
llSetColor(<1,1,1>, ALL_SIDES);
llSetAlpha(1, ALL_SIDES);
}
if(llToUpper(llList2String(Cmd, 0)) == "HIDE")
{
llSetAlpha(0, ALL_SIDES);
llSetColor(ZERO_VECTOR, ALL_SIDES);
llSetTexture("5748decc-f629-461c-9a36-a35a221fe21f", ALL_SIDES);
}
}
}