I'm trying to create a poseball where you can choose between multiple animations. I've got most of it down, but I'm having problems with two things:
1. When a person sits on the poseball, I want the script to call up an llDialog with the list of available animations. (In the following script this is done in the function fDialog.)
2. After a person chooses an animation, I want the script to call the llDialog AGAIN so the person can choose a new animation.
As the script is now, I can only get the llDialog to call if the person clicks on the (invisible) poseball. I'd really like the llDialog to launch upon sit, and again after the person chooses an animation. Here's the entirety of the script since I don't know where I'd need to place the calling code ...
CODE
// Testing script by Apryl Beaumont
string ANIMATION = "nyanya";
integer visible = TRUE;
integer channel = 1001;
key avatar;
key trigger;
show()
{
visible = TRUE;
llSetText("torment", <1,0,0>,1);
llSetAlpha(1, ALL_SIDES);
}
hide()
{
visible = FALSE;
llSetText("", <1,1,1>,0);
llSetAlpha(1, ALL_SIDES);
}
fDialog()
{
llDialog(llDetectedKey(0), "Test dialog", ["Yes", "No"], channel);
}
default
{
state_entry()
{
llSay(0, "Torment ball launching ...");
llSetText("torment", <1,0,0>,1);
llSetSitText("Torment");
llSetAlpha(1, ALL_SIDES);
llSitTarget(<0,0,0.001>, llEuler2Rot(<0,0,0>));
llListen(channel,"","","");
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
avatar = llAvatarOnSitTarget();
if (llKey2Name(avatar) != "")
{
hide();
llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION);
}
else
{
if (llKey2Name(llGetPermissionsKey()) != "" && trigger == llGetPermissionsKey())
{
llStopAnimation(ANIMATION);
trigger = NULL_KEY;
}
show();
}
}
}
listen(integer chan, string name, key id, string mes)
{
llSay(0, name + " chose option " + mes);
if (mes == "Yes")
{
llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION);
llStopAnimation(ANIMATION);
ANIMATION = "angry_fingerwag";
llStartAnimation(ANIMATION);
}
if (mes == "No")
{
llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION);
llStopAnimation(ANIMATION);
ANIMATION = "nyanya";
llStartAnimation(ANIMATION);
}
}
run_time_permissions(integer perm)
{
avatar = llAvatarOnSitTarget();
if (perm & PERMISSION_TRIGGER_ANIMATION && llKey2Name(avatar) != "" && avatar == llGetPermissionsKey())
{
trigger = avatar;
llStopAnimation("sit");
llStartAnimation(ANIMATION);
llSetAlpha(0,ALL_SIDES);
llSetText("",<1,1,1>,1);
}
}
touch_start (integer detected)
{
fDialog();
}
}
Any help anyone could give me would be most appreciated. Thanks!
