|
Nickolas Goodman
Registered User
Join date: 19 May 2006
Posts: 19
|
03-07-2007 09:28
Hello everyone. I am still working on that collar script and was wondering if there is a way to create a menu system for the 60 animations I include in the collar. I would like the owner(s) be able to type a command on the channel to activate the menu then choose one of the 60 animations (I know 12 per menu page) and have it activate. The command to activate an animation now is /<channel#> <animation name>. ie /2 nadu. Thanks!  Nick
|
|
Elsewhere Essex
Registered User
Join date: 8 Sep 2006
Posts: 50
|
03-07-2007 10:31
use this along with the DialogModule in the script libaray it will work for an infinite amount of inventory held animations integer page_num = 1; list anims = []; integer DialogComm = 12; string sepchar = "|"; integer handleAnimate = 1100;
string playing_anim;
dialog(key user, string message, float timeout, list buttons, integer buttonmask, integer retchan, list ret) { llMessageLinked(llGetLinkNumber(), DialogComm, dump([retchan] + ret, sepchar), dump([user, message, timeout, buttonmask] + buttons, sepchar)); }
string dump(list a, string b) { string c = (string)a; if(1+llSubStringIndex(c,b) || llStringLength(b)!=1) { b += "|\\/?!@#$%^&*()_=:;~{}[],\n qQxXzZ"; integer d = -llStringLength(b); while(1 + llSubStringIndex(c,llGetSubString(b,d,d)) && d) d++; b = llGetSubString(b,d,d); } return b + llDumpList2String(a, b); }
list parse(string a) { string b = llGetSubString(a,0,0);//save memory return llParseStringKeepNulls(llDeleteSubString(a,0,0), ,[]); }
list AnimationsList(integer page) { anims = []; integer i = 0; integer num = llGetInventoryNumber(INVENTORY_ALL); for( i = 0; i <= num; ++i) { if(llGetInventoryType(llGetInventoryName(INVENTORY_ALL, i)) == INVENTORY_ANIMATION) { string name = llGetInventoryName(INVENTORY_ALL, i); if (name != "" { integer length = llStringLength(name) - 1; if(length < 23) { name = llGetSubString(name, 0, 23); } anims = (anims = []) + anims + name; } } } integer length = (anims != []) - 1; integer index = (page * 10) - 10; integer index2 = index + 9; list extra = []; if(index >= length){ index = index2 = length; } if(index2 >= length){ index2 = length; } if (page >= llCeil((float)length / 10.0) ){ extra = ["Back"]; } else if(page == 1){ extra = ["Close", "More"]; } else { extra = ["Back", "More"]; } return llList2List(anims, index, index2) + extra; }
dialog_Animate(key who, integer page) { string question = "Chose an animation to play"; list Answers = AnimationsList(page); integer AnswerMask = 0xf0fff; list ExtraPassback = [""]; dialog(who, question, 120,Answers, AnswerMask , handleAnimate, ExtraPassback); }
PlayAnimation(integer num, integer page){ if(llGetAttached() > 0){ if(playing_anim != "" { llStopAnimation(playing_anim); } integer index = (page * 10) - 10; string anim = llGetInventoryName(INVENTORY_ANIMATION, (index + num)); llStartAnimation(anim); playing_anim = anim; } }
default { state_entry(){ page_num = 1; AnimationsList(page_num); if(llGetAttached() > 0){ llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); } } touch_start(integer num) { if(llGetAttached() > 0){ page_num = 1; dialog_Animate(llDetectedKey(0), page_num); } link_message(integer s, integer n, string m, key i){ if(n == handleAnimate){ integer answer = (integer)llList2String(parse(i), 0); key user = llList2Key(parse(i), 2); string answer_text = llList2Key(parse(i), 1); if(answer_text == "Back" { if(page_num > 1) { page_num = page_num - 1; dialog_Animate(user, page_num); } else { return; } } if(answer_text == "More" { page_num = page_num + 1; dialog_Animate(user, page_num); } else if((answer >= 0) && (answer_text != "Back" && (answer_text != "More" ) { PlayAnimation(answer, page_num); dialog_Animate(user, page_num); } else if(answer_text == "Close" { return; } } } attach(key i){ if(llGetAttached() > 0){ llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); } } changed(integer change){ if(change & CHANGED_OWNER){ llResetScript(); } if(change & CHANGED_INVENTORY) { AnimationsList(1); } } }
|
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
03-07-2007 10:32
From: Nickolas Goodman I would like the owner(s) be able to type a command on the channel to activate the menu then choose one of the 60 animations (I know 12 per menu page) and have it activate. If it's going to be a static number like that (and a round one, even better), I'd set up each dialog menu with 10 buttons for a numbered list of anims on that particular "page", and the remaining two for "previous" and "next" page navigation. Would look something like: Anim Collar Menu, page #
1. Anim #1 2. Anim #2 [...] 9. Anim #9 10. Anim #10
( 1 ) ( 2 ) ( 3 ) ( 4 ) ( 5 ) ( 6 ) ( 7 ) ( 8 ) ( 9 ) ( << ) ( 10 ) ( >> )
|
|
Nickolas Goodman
Registered User
Join date: 19 May 2006
Posts: 19
|
03-07-2007 13:53
wow thank you Elsewhere for the script and Deanna for the tip!! I will put them to use and see if I can get it to work properly. Thanks again! <grins>
Nick
|
|
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
|
03-07-2007 14:21
From: Deanna Trollop ( 1 ) ( 2 ) ( 3 ) ( 4 ) ( 5 ) ( 6 ) ( 7 ) ( 8 ) ( 9 ) ( << ) ( 10 ) ( >> )
Damn that's nice.. I love it. Could replace 10 with "none" as well. That has a really nice look, and gives you an offswitch on every page. The temptation though is to replace (<<  with (none).. but once you do that, the nice look of the 10 in the button layout falls apart. Of course.. when the numbers are replaced with animation names.. that (none) (dead sleep) (>>  on the bottom row would look weird. If the bottom row is "controls" and the top 9 are "options on this page" I think that it has a bit more of a "finished" feel to it. 
_____________________
 ● Inworld Store: http://slurl.eclectic-randomness.com ● Website: http://www.eclectic-randomness.com ● Twitter: @WinterVentura
|
|
Darien Caldwell
Registered User
Join date: 12 Oct 2006
Posts: 3,127
|
03-07-2007 15:02
ehhe that's exactly how Amethyst's collar anim menu is laid out.
|
|
Thraxis Epsilon
Registered User
Join date: 31 Aug 2005
Posts: 211
|
03-07-2007 15:21
In my menu's the It is [ <- PREV ] [ MENU ] [ NEXT -> ] Or [ <- PREV ] [ - ] [ NEXT -> ]
|
|
Dustin Widget
Script Monkey for hire
Join date: 15 Feb 2006
Posts: 101
|
03-07-2007 18:34
In one of my last projects, the photosphere, I used (Previous)(Menu)(Next) as the bottom line, with 1-9 above it. Also came up with a really interesting way to handle large numbers of buttons.
|
|
Nickolas Goodman
Registered User
Join date: 19 May 2006
Posts: 19
|
03-08-2007 04:45
That is awesome Winter. Thank you so much! Thanks to everyone who responded. I will let you know how it looks when I finish unless I have any major difficulty. Thanks again!!!
Nick
|