// Simulates a mirror reflexion in Second Life by changing camera position on sit, i.e. reflects the image of an avatar in a mirror.
// Put script 1 (mirror) in a prim resembling a mirror and put script 2 (looking_a_mirror) in a chair or stool. Put the stool in front of the mirror. Tip: to cover the camera trick, integrate the mirror in a dressing table.
// Script I: Mirror
//==========
// Made by Seagel Neville
// Retrieved from from Free SL Scripts on http://www.freeSLscripts.com or www.gendersquare.org/sl
// Retrieved from from Free SL Scripts on http://www.freeSLscripts.com or www.gendersquare.org/sl
// put me in a prim resembling a mirror. To cover the camera trick, do not forget to build a thin wall (i.e. a mirror with a mirror texture) behind the simulated reflexion of the avatar
default
{
state_entry()
{
llSay(0, "Hello, Avatar!");
}
touch_start(integer total_number)
{
llSay(0, "Touched.");
}
}
{
state_entry()
{
llSay(0, "Hello, Avatar!");
}
touch_start(integer total_number)
{
llSay(0, "Touched.");
}
}
/// Script II: Looking_a_mirror
//====================
// Made by Seagel Neville
// Retrieved from from Free SL Scripts on http://www.freeSLscripts.com or www.gendersquare.org/sl
string DISPLAY_TEXT = "Sit";
string ANIMATION;
string GESTURE;
integer is_sitting;
list GESTURE_BUTTON =
[
"point_you", "point_me", "peace",
"nyanya", "toungue out", "blowkiss",
"wink#1", "wink#2", "embarassed",
"laugh", "surprise", "cry"
];
list GESTURE_LIST =
[
"point_you", "point_me", "peace",
"nyanya", "express_tongue_out", "blowkiss",
"wink_hollywood", "express_wink", "express_embarrased",
"express_laugh", "express_surprise", "express_cry"
];
opendialog_gestures()
{
llDialog(llAvatarOnSitTarget(), "What do you want to do in front of this mirror?", GESTURE_BUTTON, 696543);
}
default
{
state_entry()
{
llListen(696543, "", NULL_KEY, "");
ANIMATION = llGetInventoryName(INVENTORY_ANIMATION, 0);
is_sitting = 0;
llSitTarget(<-0.63, 0, 0>,llEuler2Rot(<180, -90, 0>*DEG_TO_RAD));
llSetText(DISPLAY_TEXT,<1,1,1>,1);
llSetCameraEyeOffset(<-1, 0, 0>);
llSetCameraAtOffset(<-5, 0, -100>);
}
changed(integer change)
{
if(change & CHANGED_LINK)
{
key av = llAvatarOnSitTarget();
if(av != NULL_KEY)
{
llRequestPermissions(av, PERMISSION_TRIGGER_ANIMATION);
}
else
{
if((llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) && is_sitting)
{
llMessageLinked(LINK_SET, 0, "standing", NULL_KEY);
is_sitting = 0;
llStopAnimation(ANIMATION);
llSetText(DISPLAY_TEXT,<1,1,1>,1);
llUnSit(av);
llOwnerSay("Press \"Ignore\" button if you want to remove the menus.");
}
}
}
ANIMATION = llGetInventoryName(INVENTORY_ANIMATION, 0);
}
listen(integer channel, string name, key id, string message)
{
if (llListFindList(GESTURE_BUTTON, [message]) != -1) // verify dialog choice
{
opendialog_gestures(); // The dialog box keeps showing until you choose "Ignore".
GESTURE = llList2String(GESTURE_LIST, llListFindList(GESTURE_BUTTON, [message]));
llStartAnimation(GESTURE);
}
}
run_time_permissions(integer perm)
{
if(perm & PERMISSION_TRIGGER_ANIMATION)
{
llMessageLinked(LINK_SET, 0, "sitting", NULL_KEY);
is_sitting = 1;
llStopAnimation("sit_generic");
llStopAnimation("sit");
llStartAnimation(ANIMATION);
llSetText("",<1,1,1>,1);
opendialog_gestures();
}
}
on_rez(integer start_param)
{
llResetScript();
}
}