This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

PMAC POSER V2.8 BASISSCRIPT TEIL2
#1
PMAC POSER V2.8 BASISSCRIPT TEIL2

Dieser Artikel enthält meine Weiterentwicklung des PMAC Posers. Ein Fork der Version 2.0

Das Script kann direkt in vorhandenen alten PMAC Poser bis 2.2 zum Austausch verwendet werden.

Ihr müsst es aber in 2 Teilen herunterladen und im Script Editor zu einem Script zusammen setzen.
Der Code ist zu lang für einen Artikel des Forums. Dieses ist der 2.Teil!
Als eindeutige Beschriftung empfehle ich: P607 PMAC 2.8 Poser UNIVERSAL + NPC 122022.lsl


TEIL2:    "P607 PMAC 2.8 Poser UNIVERSAL + NPC 122022.lsl"

Code:
    // *** BEFEHLE AUS MENÜEINGABEN AUSWERTEN
    listen (integer channel, string name, key who, string message)
    {
        if (who!=user)
        {
            if (message=="TAKE CONTROL")
            {
                if (myState!="RUNNING")
                {
                    if (who==llGetOwner()) llOwnerSay("Cannot give you control because I am not in RUNNING state. Current state is: "+myState);
                    else llRegionSayTo(who,0,"Sorry, you cannot take control at the moment because I am not currently in normal operation mode.");
                    return;
                }
                ChangeMenuUser(who);
            }
            else if (message=="CANCEL") return;
            else return;
        }
        else if (message=="-") startListening();
        else if (message=="SYNCH") { SyncAvas(); startListening();}
        else if (message=="OPTIONS") showOptionsMenu();
        else if (message=="GROUPS") showGroupsMenu();
        else if (message=="<< BACK") loadAnimGroup(llList2String(currentAn,0));
        else if (message=="QUIT") QuitEditMode();
        else if (menu=="MENU_GROUPS")
        {
            if ((message=="< PREV") || (message=="NEXT >"))
            {
                if (message=="< PREV") groupPage-=6;
                else groupPage+=6;
                if (groupPage>=llGetListLength(groupList)) groupPage=0;
                else if (groupPage<=-6) groupPage=llGetListLength(groupList)-6;
                if (groupPage<0) groupPage=0;
                showGroupsMenu();
            }
            else loadAnimGroup(message);
        }
        else if (menu=="MENU_ANIM")
        {
            if ((message=="< PREV") || (message=="NEXT >"))
            {
                if (message=="< PREV") anPage-=6;
                else anPage+=6;
                if (anPage>=llGetListLength(anList)) anPage=0;
                else if (anPage<=-6) anPage=llGetListLength(anList)-6;
                if (anPage<0) anPage=0;
                showAnMenu();
            }
            else if (message=="ADD NPC")
            {
                if (llListFindList(positions,[NULL_KEY])==-1)
                {
                    llRegionSayTo(user,0,"Cannot add a new NPC at this time as there are no vacant positions");
                    showOptionsMenu();
                } else buildNpcList();
            }
            else
            {
                playAnimation(message);
                showAnMenu();
            }
        }
        else if (menu=="MENU_ADD_NPC") // MENU NPC HINZUFÜGEN GEWÄHLT
        {
            if (message=="CANCEL") showOptionsMenu();
            else if (llListFindList(positions,[NULL_KEY])==-1)
            {
                llRegionSayTo(user,0,"Cannot add a NPC as there are no longer any vacant positions");
                showOptionsMenu();
            }
            else if ((message=="< PREV") || (message=="NEXT >"))
            {
                if (message=="< PREV") npcPage-=9;
                else npcPage+=9;
                if (npcPage>=llGetListLength(npcList)) npcPage=0;
                else if (npcPage<=-9) npcPage=llGetListLength(npcList)-9;
                if (npcPage<0) npcPage=0;
                showAddNpcMenu();
            }
            else
            {
                string npcToLoad=llList2String(invNpc,llListFindList(invNpc,[message])-2);
                if (llGetInventoryType(npcToLoad)!=INVENTORY_NOTECARD)
                {
                    llRegionSayTo(user,0,"ERROR! Unable to locate the appearance notecard for this NPC.\nButton was: "+message+"\nCard should be: "+npcToLoad);
                    startListening();
                    return;
                }
                key npc = npc_rezzer(npcToLoad, llGetKey(), llGetPos()+<0.0,0.0,2.0>);
                showOptionsMenu();
            }
        }
        else if (menu=="MENU_SWAP_TO_POSITION")
        {
            if (message=="CANCEL") showOptionsMenu();
            else SwapAvaPositions(llListFindList(positions,user),((integer)message)-1);
            showOptionsMenu();
        }
        else if (menu=="MENU_UNSIT_POSITION")
        {
            if (message=="CANCEL") showOptionsMenu();
            else
            {
                integer posToUnsit=(integer)message-1;
                key thisKey=llList2Key(positions,posToUnsit);
                if (osIsNpc(thisKey))
                {
                    positions=[]+llListReplaceList(positions,[NULL_KEY],posToUnsit,posToUnsit);
                    osNpcRemove(thisKey);
                }
                else llUnSit(thisKey);
                showOptionsMenu();
            }
        }
        else if (menu=="MENU_SELECT_AUTO_MODE")
        {
            if (message=="AUTO OFF")
            {
                autoOn=FALSE;
                llSensorRemove();
                if (!silent) llRegionSayTo(user,0,"Auto mode now off");
            }
            else if (message!="CANCEL")
            {
                autoOn=TRUE;
                if(message!="AUTO ON") autoTimer=(float)message;
                llSensorRepeat("THIS_WILL_NEVER_RETURN_A_SENSOR_RESULT",NULL_KEY,AGENT,0.001,0.0,autoTimer);
                if (!silent) llRegionSayTo(user,0,"Auto mode is on and set to "+(string)llRound(autoTimer)+" seconds");
            }
            showOptionsMenu();
        }
        else if (menu=="MENU_SPECIALS")
        {
            if (message=="CANCEL") showOptionsMenu();
            else if ((message=="< PREV") || (message=="NEXT >"))
            {
                if (message=="< PREV") specPage-=18;
                else specPage+=18;
                if (specPage>=llGetListLength(specials)) specPage=0;
                else if (specPage<=-18) specPage=llGetListLength(specials)-18;
                if (specPage<0) specPage=0;
                showSpecialsMenu();
            }
            else llMessageLinked(LINK_THIS,0,llList2String(specials,llListFindList(specials,[message])+1)+"|"+user,llDumpList2String(positions,"|"));
        }
        else if (menu=="MENU_OPTIONS")
        {
            if (message=="AUTO") showAutoMenu();
            else if (message=="SPECIAL") showSpecialsMenu();
            else if (llSubStringIndex(message,"MENUS")==0)
            {
                ownerOnlyMenus=!ownerOnlyMenus;
                if (ownerOnlyMenus) llOwnerSay("Menus are now locked. Only you can control me");
                else llOwnerSay("Menus are now unlocked");
                showOptionsMenu();
            }
            else if (message=="EDIT ON")
            {
                if (llListFindList(positions,[NULL_KEY])>=0)
                {
                    llRegionSayTo(who,0,"Sorry, all positions must be filled before you can enter edit mode and there is currently at least one that is empty.");
                    showOptionsMenu();
                }
                else if (currentGroup!=llList2String(currentAn,0))
                {
                    llRegionSayTo(user,0,"Cannot enter edit mode because the animation currently playing is not from the same notecard as your currently loaded group. Either select an animation from this card or load the group that the current animation belongs to.");
                    showOptionsMenu();
                }
                else
                {
                    if (autoOn) { autoOn=FALSE; llSensorRemove();}
                    integer l=llGetListLength(positions);
                    while (--l>=0) { if (!osIsNpc(llList2Key(positions,l))) llRegionSayTo(llList2Key(positions,l),0,"The Owner has entered edit mode and all functions are temporarily disabled. Please do not stand while these adjustments are being made.");}
                    myState="EDIT";
                    llMessageLinked(LINK_THIS,0,"GLOBAL_NOTICE_ENTERING_EDIT_MODE",llDumpList2String(positions,"|"));
                    editHandles=[];
                    rezzingHandles=TRUE;
                    rezHandles();
                }
            }
            else if (message=="SWAP")
            {
                integer i=llGetListLength(positions);
                if (i==1)
                {
                    llRegionSayTo(user,0,"The current animation group is for only one position so cannot swap positions.");
                    showOptionsMenu();
                }
                else if (i==2)
                {
                    SwapAvaPositions(0,1);
                    showOptionsMenu();
                }
                else
                {
                    txtDia="SWAP POSITION\n\nSelect the position number you would like to swap with\n";
                    butDia=[];
                    integer p;
                    while (llGetListLength(butDia)<11)
                    {
                        if (p<i)
                        {
                            key thisKey=llList2Key(positions,p);
                            if (thisKey==user) txtDia+="\n"+(string)(p+1)+". (you are curently here)";
                            else
                            {
                                butDia=[]+butDia+[(string)(p+1)];
                                if (thisKey==NULL_KEY) txtDia+="\n"+(string)(p+1)+". (empty)";
                                else txtDia+="\n"+(string)(p+1)+". "+llGetUsername(thisKey);
                            }
                            p++;
                        }
                        else butDia=[]+butDia+["-"];
                    }
                    butDia=[]+butDia+["CANCEL"];
                    while (llListFindList(butDia,["-","-","-"])>=0) { butDia=[]+llDeleteSubList(butDia,llListFindList(butDia,["-","-","-"]),llListFindList(butDia,["-","-","-"])+2); }
                    menu="MENU_SWAP_TO_POSITION";
                    startListening();
                }
            }
            else if (message=="UNSIT")
            {
                list whoCanUnsit;
                integer i=llGetListLength(positions);
                while (--i>=0)
                {
                    key thisKey=llList2Key(positions,i);
                    if ((thisKey!=user) && (thisKey!=llGetOwner()) && (thisKey!=NULL_KEY)) whoCanUnsit=[]+[i,thisKey]+whoCanUnsit;
                }
                integer l=llGetListLength(whoCanUnsit);
                if (l==0)
                {
                    llRegionSayTo(user,0,"There are no users you can remove");
                    showOptionsMenu();
                }
                else if (l==2)
                {
                    integer thisInd=llList2Integer(whoCanUnsit,0);
                    key thisUser=llList2Key(whoCanUnsit,1);
                    if (osIsNpc(thisUser))
                    {
                        positions=[]+llListReplaceList(positions,[NULL_KEY],thisInd,thisInd);
                        osNpcRemove(thisUser);
                } else llUnSit(thisUser);
                showOptionsMenu();
                }
                else
                {
                    txtDia="UNSIT A USER\n\nSelect the user to unsit (selecting NPC it will remove it). The number is the position they currently occupy.\n";
                    butDia=[];
                    i=0;
                    while (llGetListLength(butDia)<11)
                    {
                        if (i<l)
                        {
                            txtDia+="\n"+(string)(llList2Integer(whoCanUnsit,i)+1)+". "+llGetUsername(llList2Key(whoCanUnsit,i+1));
                            butDia=[]+butDia+[(string)(llList2Integer(whoCanUnsit,i)+1)];
                            i+=2;
                        }
                        else butDia=[]+butDia+["-"];
                    }
                    butDia=[]+butDia+["CANCEL"];
                    while (llListFindList(butDia,["-","-","-"])>=0) { butDia=[]+llDeleteSubList(butDia,llListFindList(butDia,["-","-","-"]),llListFindList(butDia,["-","-","-"])+2); }
                    menu="MENU_UNSIT_POSITION";
                    startListening();
                }
            }
            else if (message=="ADD NPC")
            {
                if (llListFindList(positions,[NULL_KEY])==-1)
                {
                    llRegionSayTo(user,0,"Cannot add a new NPC at this time as there are no vacant positions");
                    showOptionsMenu();
                } else buildNpcList();
            }
            else llOwnerSay("ERROR! Received unexpected message from Options menu: "+message);
        }
        else if (menu=="MENU_EDIT")
        {
            if (myState!="EDIT")
            {
                llOwnerSay("No longer in edit mode so unable to handle a response from that menu.");
                showOptionsMenu();
            }
            llSetTimerEvent(0.0);
            integer valid=TRUE;
            integer check=llGetListLength(positions);
            while (valid && (--check>=0)) { if (!getUserLink(llList2Key(positions,check))) valid=FALSE; }
            if (!valid)
            {
                llOwnerSay("ERROR! A user appears to have stood. Cannot remain in edit mode unless all positions are occupied. Ignoring your selection, reverting to stored position for this animation, and leaving edit mode without saving any changes. Once all positions are filled once more you may return to edit mode to resume work or save the stored data.");
                playAnimation(llList2String(currentAn,1));
                removeHandles();
                return;
            }
            if (message=="STORE ADDON") llMessageLinked(LINK_THIS,0,"GLOBAL_STORE_ADDON_NOTICE",llDumpList2String(positions,"|"));
            else if (message=="REVERT THIS") playAnimation(llList2String(currentAn,1));
            else
            {
                persistChanges();
                if (message=="EDIT OFF") removeHandles();
                else if ((message=="STORE THIS") || (message=="< PREV") || (message=="NEXT >"))
                {
                    integer anToPlay=llListFindList(anList,[llList2String(currentAn,1)]);
                    if (message=="< PREV") anToPlay--;
                    else if (message=="NEXT >") anToPlay++;
                    if (anToPlay<0) anToPlay=llGetListLength(anList)-1;
                    if (anToPlay>=llGetListLength(anList)) anToPlay=0;
                    playAnimation(llList2String(anList,anToPlay));
                }
                else if ((message=="SAVE CARD") || (message=="SAVE NEW"))
                {
                    string cardName=llList2String(invGroups,llListFindList(invGroups,[currentGroup])-3);
                    string strToSay;
                    if (message=="SAVE NEW")
                    {
                        integer num=2;
                        while (llGetInventoryType(cardName+(string)num)==INVENTORY_NOTECARD) { num++; }
                        cardName=""+cardName+(string)num;
                        currentGroup=llGetSubString(cardName,10,-1);
                        invGroups=[]+invGroups+[cardName,(integer)(llGetSubString(cardName,7,7)),llGetSubString(cardName,8,8),currentGroup];
                        groupList=[]+groupList+[currentGroup];
                        currentAn=[]+llListReplaceList(currentAn,[currentGroup],0,0);
                        strToSay="All data stored to a new notecard and now working with the newly created group: "+currentGroup;
                    }
                    else strToSay="All data now updated in notecard for the group: "+currentGroup;
                    saveCard(cardName);
                    llRegionSayTo(user,0,strToSay);
                }
                else llOwnerSay("ERROR! Message not expected in Edit menu handling: "+message);
            }
            if (myState=="EDIT")
            {
                llSetTimerEvent(editTimer);
                showEditMenu();
            }
        }
    }
}


Dieses Script ist zunächst als Austauschobjekt für vorhandene PMACs gedacht um diese zu modernisieren.

Um es Standalone einzusetzten bedarf es noch mehrere zusätzlicher Elemente und Erklärungen.
Dies folgen in weiteren Artikel Teilen.
Zitieren


Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste