Jump to content
Sign in to follow this  
Sarrah12

script issue

Recommended Posts

Hello. Can anyone please tell me what's wrong with this script. After i click on "Female", the animation doesnt start.

 

 

string animation;
string text = "touch more";
vector target = <-0.5,0,0>;// 0.5 wayy down in the ground,-0.6 left side of ball , 4..behind the ball
vector rot = <0,0,180>;
list MENU_MAIN = ["Default", "Male", "Female", "More..."]; // the main menu
list MENU_2 = ["Dance", "BB", "CC" , "...Back"]; // menu 2
string msg = "Please make a choice:";
key ToucherID;
integer CHANNEL; // dialog channel
integer listen_id;
float Timeout=20.0;
integer handle;
integer on = FALSE;
integer spaz = 0;
integer trap = 0;
key agent;

 

default{
state_entry()
{
CHANNEL = llRound(llFrand(1) * 100000);
llListenRemove(1);
llSetTimerEvent(Timeout);
llSetText(text,<1,1,1>,1);

}

on_rez(integer start)
{
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
animation = llGetInventoryName(INVENTORY_ANIMATION,0);
llListen(3,"",llGetOwner(),"");
llSetText(text,<1,1,1>,1);
llSetAlpha(1.0,ALL_SIDES);
llSitTarget(target,llEuler2Rot(rot*DEG_TO_RAD));



}

 

touch_start(integer total_number)
{
llOwnerSay("Listener Turned On");
integer handle = llListen(CHANNEL, "",agent, ""); // listen for dialog answers
llListenControl(handle, TRUE); // ...enable listen
integer perm = llGetPermissions();
llDialog(llDetectedKey(0), "What do you want to do?", MENU_MAIN, CHANNEL); // present dialog on click
}

run_time_permissions(integer perm)
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
llStartAnimation(animation);
}
}

listen(integer CHANNEL, string name, key id, string message)
{
if (llListFindList(MENU_MAIN + MENU_2, [message]) != -1) // verify dialog choice

{
// llOwnerSay(name + " picked the option '" + message + "'."); // output the answer
if (message == "More...")
llDialog(id, "Pick an option!", MENU_2, CHANNEL); // present submenu on request
else if (message == "...Back")
llDialog(id, "What do you want to do?", MENU_MAIN, CHANNEL); // present main menu on request to go back


else if (message == "Female")
{

integer perm = llGetPermissions();
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
if (llToUpper(message) == "OFF")
{
llStopAnimation(animation);
}
else if (llToUpper(message) == "ON")
{
// setup_pose();
llStartAnimation(animation);
}

}
}


}


}

timer()
{
llSetTimerEvent(0);
llOwnerSay("Listener Turned Off");
llListenControl(handle, FALSE);
}
}

Share this post


Link to post
Share on other sites

The problem is that you've set an impossible condition:

	else if (message == "Female")			{				integer perm = llGetPermissions();				if (perm & PERMISSION_TRIGGER_ANIMATION)				{					if (llToUpper(message) == "OFF")					{						llStopAnimation(animation);					}					else if (llToUpper(message) == "ON")					{						// setup_pose();						llStartAnimation(animation);					}				}			}

If the message is "Female" then llToUpper(message) is never going to be either "ON" or "OFF", so nothing can happen.

 

Share this post


Link to post
Share on other sites

The script that you've posted doesn't actually make a lot of sense, I'm afraid -- it looks to me as if someone has put together  bits from various examples.

What do you want to happen?  It looks, as it stands, as if it's supposed to give you a main menu of categories of dances ("Default", "Male" and "Female") and then, when you pick one of those, you get a second menu showing the actual dances in that category.   That's just my guess though,

Describe what you want it to do, and I'll try to help you make it do it.

  • Like 1

Share this post


Link to post
Share on other sites

I want to make a dialog menu. If you click on the "more" option from first menu , it gives you a second menu, and if you click on "back" option from second menu, it brings you back to the first menu. i also want to connect animations in all the options.

 

So say in menu 1 i have " danceA, dance B, more"... and in menu 2 i have "dance C, dance D, back". If i click on dance A, it shuld start playin a specific anaimation attached to it and same for dance B, etc.

 

Thank you.

Share this post


Link to post
Share on other sites

Try this.  You will need to get the names exactly right in the script -- the spelling and capitalisation must be exactly as the animation names in the prim's inventory -- and the names must be no longer than 24 characters.

There's still some issues I can see with the script (I'm not sure whether it's supposed to be in a hud or a rezzed prim, or if the owner only should use it or anyone can -- it it's a rezzed prim, that is.   But this is one way to do what you describe:

	run_time_permissions(integer perm)	{		if (perm & PERMISSION_TRIGGER_ANIMATION)		{ // this is all precautionary -- normally the animations should start and stop in the listen event			if (animation){//shorthand for "if i know what animation to play"				if ("Stop"==animation){					llStopAnimation();				}				else{					llStartAnimation(animation);				}			}		}	}	listen(integer CHANNEL, string name, key id, string message)	{		if (llListFindList(MENU_MAIN + MENU_2, [message]) != -1) // verify dialog choice		{			// llOwnerSay(name + " picked the option '" + message + "'."); // output the answer			if (message == "More..."){				llDialog(id, "Pick an option!", MENU_2, CHANNEL); // present submenu on request			}			else if (message == "...Back"){				llDialog(id, "What do you want to do?", MENU_MAIN, CHANNEL); // present main menu on request to go back			}						else if (llGetInventoryType(message)==INVENTORY_ANIMATION || "Stop"==message){// if it's animation in my inventory or the message is "Stop"				animation = message;				if(llGetPermissions()&PERMISSION_TRIGGER_ANIMATION){					if ("Stop"==animation){						llStopAnimation();					}					else{						llStartAnimation(animation);					}				}				else{					llRequestPermissions(id,PERMISSION_TRIGGER_ANIMATION);				}			}		}	}

 

  • Like 1

Share this post


Link to post
Share on other sites

Please don't post the same question in several places at once.  I gave you the answer to this one twice when you posted it in Answers, and it's the same answer you got here. 

Share this post


Link to post
Share on other sites

its giving me an error for this part:

if ("Stop"==animation){
llStopAnimation();

 

It says no overload for method '//stopAnimation' takes 0 argumnts

Share this post


Link to post
Share on other sites

I have a question abt the script that you wrote.   For this part :

else if (llGetInventoryType(message)==INVENTORY_ANIMATION || "Stop"==message){// if it's animation in my inventory or the message is "Stop"
animation = message;
if(llGetPermissions()&PERMISSION_TRIGGER_ANIMATION){
if ("Stop"==animation){
llStopAnimation(animation);
}
else{
llStartAnimation(animation);
}
}
else{
llRequestPermissions(id,PERMISSION_TRIGGER_ANIMATION);
}

 

How will it know which options will play which animations?Because i wanna put different animations for different options

 

Share this post


Link to post
Share on other sites

I was assuming you were going to use the names of the animations for the option values.  So rather than "AA", "BB" and so on, you would have "Slow Dance 1", "Caramel" and and so on,.   Then, assuming those dances are in the prim's inventory, the script will find them and play them.

How do you want to do it?

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...