Sarrah12 Posted May 14, 2013 Share Posted May 14, 2013 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 ballvector rot = <0,0,180>;list MENU_MAIN = ["Default", "Male", "Female", "More..."]; // the main menulist MENU_2 = ["Dance", "BB", "CC" , "...Back"]; // menu 2string msg = "Please make a choice:";key ToucherID;integer CHANNEL; // dialog channelinteger 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 answersllListenControl(handle, TRUE); // ...enable listeninteger 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 answerif (message == "More...")llDialog(id, "Pick an option!", MENU_2, CHANNEL); // present submenu on requestelse if (message == "...Back")llDialog(id, "What do you want to do?", MENU_MAIN, CHANNEL); // present main menu on request to go backelse 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);}} Link to comment Share on other sites More sharing options...
Innula Zenovka Posted May 14, 2013 Share Posted May 14, 2013 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. Link to comment Share on other sites More sharing options...
Sarrah12 Posted May 14, 2013 Author Share Posted May 14, 2013 how do i fix that. sorry im new to scripting Link to comment Share on other sites More sharing options...
Innula Zenovka Posted May 14, 2013 Share Posted May 14, 2013 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. 1 Link to comment Share on other sites More sharing options...
Sarrah12 Posted May 14, 2013 Author Share Posted May 14, 2013 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. Link to comment Share on other sites More sharing options...
Innula Zenovka Posted May 14, 2013 Share Posted May 14, 2013 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); } } } } 1 Link to comment Share on other sites More sharing options...
Rolig Loon Posted May 14, 2013 Share Posted May 14, 2013 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. Link to comment Share on other sites More sharing options...
Sarrah12 Posted May 14, 2013 Author Share Posted May 14, 2013 sorry about that. i was told i posted in the wrong section n to repost it in LSL scripting Link to comment Share on other sites More sharing options...
Sarrah12 Posted May 14, 2013 Author Share Posted May 14, 2013 its giving me an error for this part: if ("Stop"==animation){ llStopAnimation(); It says no overload for method '//stopAnimation' takes 0 argumnts Link to comment Share on other sites More sharing options...
Innula Zenovka Posted May 14, 2013 Share Posted May 14, 2013 Sorry, that was a typo -- llStopAnimation(animation); 1 Link to comment Share on other sites More sharing options...
Sarrah12 Posted May 14, 2013 Author Share Posted May 14, 2013 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 Link to comment Share on other sites More sharing options...
Innula Zenovka Posted May 14, 2013 Share Posted May 14, 2013 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? 1 Link to comment Share on other sites More sharing options...
Sarrah12 Posted May 14, 2013 Author Share Posted May 14, 2013 OMG IT WORKS!!! thank you SO MUCH!!! Link to comment Share on other sites More sharing options...
Recommended Posts
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