diff options
-rw-r--r-- | 1AOor2.lsl | 163 |
1 files changed, 158 insertions, 5 deletions
@@ -658,9 +658,77 @@ d("RLV command requested " + llList2String(dt, 0)); | |||
658 | addEvent(llList2Float(dt, 1), "RLV " + llDumpList2String(llList2List(dt, 2, -1), "|")); | 658 | addEvent(llList2Float(dt, 1), "RLV " + llDumpList2String(llList2List(dt, 2, -1), "|")); |
659 | } | 659 | } |
660 | else if ("URL" == cmd) | 660 | else if ("URL" == cmd) |
661 | else if ("BUILTINS" == cmd) | ||
661 | { | 662 | { |
662 | URL = data; | 663 | integer l = llGetListLength(ANIMATIONS); |
663 | d("New URL " + URL); | 664 | integer i; |
665 | string opts = ""; | ||
666 | string cmds = ""; | ||
667 | for (i = 0; i < l; i++) | ||
668 | { | ||
669 | string anim = llList2String(ANIMATIONS, i); | ||
670 | opts += anim + "|"; | ||
671 | cmds += "SINGLE_POSE " + anim + "," + anim + "|"; | ||
672 | } | ||
673 | dynamicMenu(id, menu, menu, "Choose a built in animation: ", | ||
674 | llGetSubString(opts, 0, -2), llGetSubString(cmds, 0, -2), 2); | ||
675 | return FALSE; | ||
676 | } | ||
677 | else if ("OTHERS" == cmd) | ||
678 | { | ||
679 | integer l = llGetListLength(leftOvers); | ||
680 | integer i; | ||
681 | string anim; | ||
682 | |||
683 | if (0 == l) | ||
684 | { | ||
685 | i = llGetInventoryNumber(INVENTORY_ANIMATION); | ||
686 | while (i-- > 0) | ||
687 | { | ||
688 | integer j; | ||
689 | integer left = TRUE; | ||
690 | |||
691 | anim = llGetInventoryName(INVENTORY_ANIMATION, i); | ||
692 | if (-1 == llListFindList(usedAnims, [anim])) | ||
693 | { | ||
694 | leftOvers += (list) anim; | ||
695 | l++; | ||
696 | } | ||
697 | } | ||
698 | } | ||
699 | leftOvers = llListSort(leftOvers, 1, TRUE); | ||
700 | if (0 != l) | ||
701 | { | ||
702 | string opts = ""; | ||
703 | string cmds = ""; | ||
704 | for (i = 0; i < l; i++) | ||
705 | { | ||
706 | anim = llList2String(leftOvers, i); | ||
707 | opts += anim + "|"; | ||
708 | cmds += "SINGLE_POSE " + anim + "," + anim + "|"; | ||
709 | } | ||
710 | dynamicMenu(id, menu, "", "Choose a pose: ", | ||
711 | llGetSubString(opts, 0, -2), llGetSubString(cmds, 0, -2), 2); | ||
712 | return FALSE; | ||
713 | } | ||
714 | else | ||
715 | s("No left over poses."); | ||
716 | } | ||
717 | else if ("SINGLE_POSE" == cmd) | ||
718 | { | ||
719 | list p = llParseStringKeepNulls(data, [","], []); | ||
720 | if ("" != Posed) | ||
721 | animEnd(Owner, Posed); | ||
722 | Posed = llList2String(p, 1); | ||
723 | animSwitch(Owner, Posed); | ||
724 | } | ||
725 | else if ("STOP_ALL" == cmd) | ||
726 | { | ||
727 | nextPose = ""; | ||
728 | Posed = ""; | ||
729 | Pose = ""; | ||
730 | State = ""; | ||
731 | stopAnims(Owner); | ||
664 | } | 732 | } |
665 | else if ("▲" == cmd) | 733 | else if ("▲" == cmd) |
666 | { | 734 | { |
@@ -779,14 +847,22 @@ list AOspeedNames = | |||
779 | list flyStates; | 847 | list flyStates; |
780 | list initialStates; // "Taking Off", "hover_up", | 848 | list initialStates; // "Taking Off", "hover_up", |
781 | list ANIMATIONS; | 849 | list ANIMATIONS; |
850 | list usedAnims; | ||
851 | list leftOvers; | ||
782 | 852 | ||
783 | integer checkAnim(string a) | 853 | integer checkAnim(string a, integer add) |
784 | { | 854 | { |
785 | if (("" != a) && (NULL_KEY == llGetInventoryKey(a)) && (-1 == llListFindList(ANIMATIONS, [a]))) | 855 | if (("" != a) && (INVENTORY_ANIMATION != llGetInventoryType(a)) |
856 | && (-1 == llListFindList(ANIMATIONS, [a]))) | ||
786 | { | 857 | { |
787 | s(Owner, "Missing animation - " + a + "!"); | 858 | S("Missing animation - " + a + "!"); |
788 | return FALSE; | 859 | return FALSE; |
789 | } | 860 | } |
861 | if (add) | ||
862 | { | ||
863 | if (-1 == llListFindList(usedAnims, [a])) | ||
864 | usedAnims += [a]; | ||
865 | } | ||
790 | return TRUE; | 866 | return TRUE; |
791 | } | 867 | } |
792 | 868 | ||
@@ -887,6 +963,82 @@ readPos(list cards) | |||
887 | 963 | ||
888 | integer findPose(string name) {return listFindString(Poses, name, psSTRIDE);} | 964 | integer findPose(string name) {return listFindString(Poses, name, psSTRIDE);} |
889 | 965 | ||
966 | list splitEmote(string anim) | ||
967 | { | ||
968 | integer p = llSubStringIndex(anim, "::"); | ||
969 | |||
970 | if (-1 != p) | ||
971 | return [llGetSubString(anim, 0, p - 1), llGetSubString(anim, p + 2, -1)]; | ||
972 | else | ||
973 | return [anim, ""]; | ||
974 | } | ||
975 | |||
976 | list collectEmotes(string anim) | ||
977 | { | ||
978 | list anims = []; | ||
979 | list emotes = []; | ||
980 | list nA = llParseStringKeepNulls(anim, ["|"], []); | ||
981 | integer m = llGetListLength(nA); | ||
982 | integer j; | ||
983 | for (j = 0; j < m; ++j) | ||
984 | { | ||
985 | list an = llCSV2List(llList2String(nA, j)); | ||
986 | integer n = llGetListLength(an); | ||
987 | integer k; | ||
988 | string anms = ""; | ||
989 | string emts = ""; | ||
990 | for (k = 0; k < n; ++k) | ||
991 | { | ||
992 | list ae = splitEmote(llList2String(an, k)); | ||
993 | string a = llList2String(ae, 0); | ||
994 | string e = llList2String(ae, 1); | ||
995 | integer er = FALSE; | ||
996 | |||
997 | // Coz LSL doesn't short circuit, and we don't want to checkAnim("~") | ||
998 | if ("~" == a) | ||
999 | er = TRUE; | ||
1000 | else if (checkAnim(a, TRUE)) | ||
1001 | er = TRUE; | ||
1002 | if (er) | ||
1003 | { | ||
1004 | anms += "," + a; | ||
1005 | if ("" != e) | ||
1006 | emts += "," + e; | ||
1007 | } | ||
1008 | } | ||
1009 | anims += [llGetSubString(anms, 1, -1)]; | ||
1010 | emotes += [llGetSubString(emts, 1, -1)]; | ||
1011 | } | ||
1012 | return [llDumpList2String(anims, "|"), llDumpList2String(emotes, "|")]; | ||
1013 | } | ||
1014 | |||
1015 | doEmote(string pose, integer f) | ||
1016 | { | ||
1017 | integer i = findPose(pose); | ||
1018 | |||
1019 | if (-1 != i) | ||
1020 | { | ||
1021 | list e = llParseStringKeepNulls(llList2String(Poses, i + psEMOTE), ["|"], []); | ||
1022 | if ([] != e) | ||
1023 | { | ||
1024 | string em = llList2String(e, llList2Integer(Avs, f + aNUM)); | ||
1025 | if ("" != em) | ||
1026 | { | ||
1027 | // NOTE - this one is splitting emote::time | ||
1028 | list s = splitEmote(em); | ||
1029 | string t = llList2String(s, 1); | ||
1030 | key k = llList2Key(Avs, f + aKEY); | ||
1031 | |||
1032 | animEnd(k , llList2Key(s, 0)); | ||
1033 | animBegin(k , llList2Key(s, 0)); | ||
1034 | if ("" == t) | ||
1035 | t = "1.0"; | ||
1036 | addEvent((float) t, "EMOTE " + k); | ||
1037 | } | ||
1038 | } | ||
1039 | } | ||
1040 | } | ||
1041 | |||
890 | savePose(string name, string anim, string exp, string posRot) | 1042 | savePose(string name, string anim, string exp, string posRot) |
891 | { | 1043 | { |
892 | integer f = findPose(name); | 1044 | integer f = findPose(name); |
@@ -902,6 +1054,7 @@ savePose(string name, string anim, string exp, string posRot) | |||
902 | Poses = llListReplaceList(Poses, [name, anim, exp, posRot], f, f + psSTRIDE - 1); | 1054 | Poses = llListReplaceList(Poses, [name, anim, exp, posRot], f, f + psSTRIDE - 1); |
903 | else | 1055 | else |
904 | Poses += [name, anim, exp, posRot]; | 1056 | Poses += [name, anim, exp, posRot]; |
1057 | Poses = llListReplaceList(Poses, collectEmotes(anim), f + psANIM, f + psEMOTE); | ||
905 | } | 1058 | } |
906 | 1059 | ||
907 | list reportPose() | 1060 | list reportPose() |