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.

NPC CLONE Script um NPC Notecards zu erstellen von Aine Caolmhe
#1
NPC CLONE Script um NPC Notecards vom aktuellen Avatar zu erstellen


   
Foto: Ein Avatar inspiziert seinen Clone

Dieses Script ist das Original von Aine Caolmhe.
Ich habe lediglich die CardPrefix geändert.


Somit wird die Notecard gleich in gültiger PMAC Nomenklatur beschriftet und muss nicht umbenannt werden.
Ebenso passt direkt sie in alle meine, oder von mir angepasste NPC Scripte. Zum Beispiel in die Paramout Line Dancer OSSL Version hier im Forum.


Auf der Sim auf der das Script zum Einsatz kommt müssen OSSL Befehle (in der OSSL.ini) erlaubt sein, und der User muss auf der Parzelle das Recht haben diese zu nutzen.


ANWENDUNG:

Das Script kommt in ein Prim oder ein anderes (Mesh-) Objekt hinein.
Durch Berührung mittels Avatar wird der Vorgang gestartet, und dem Avatar eine Notecard für den Clone übergeben.

Der Inhalt der Notecard kann übrigens als XML Datei bei Problemen bearbeitet werden, zum Beispiel mit Notepad++.
Anhand der Attachment points kann rausgefunden werden welches Objekt den Fehler macht, und die betreffende XML Sequenz entfernt werden.
Ebenso könnte man auch Attachments nachträglich hinzufügen.


   
Foto: Ein NPC in der Clonaufbewahrung

Zur Konfiguration gibt es im dem Script nur 2 Dinge:

1. Soll die Notecard auch im Prim gespeichert werden?
2. Wie lautet der Prefix der Notecard.




Code:
// HEDONE CLONE-ME UTILITY  -  erstellt Notecarten für NPCs von Avataren die auf das Objekt clicken
// By Aine Caolmhe Feb 2013
//
// ******************************************
// ***              OVERVIEW              ***
// ******************************************
// Ensure that the OSSL Function osAgentSaveAppearance() is enabled in your region (http://opensimulator.org/wiki/OSSL_Enabling_Functions)
// Place this script into any prim
// On touch, your current appearance will be cloned to a new notecard and given to you.
// Optionally, the original will be stored in the prim itself (technically it always gets stored there...the option is whether to delete it)
//
// ******************************************
// ***              USAGE                 ***
// ******************************************
// This script is supplied under the terms of the GPU General Public License 3.0
// You are free to modify, copy,and/or redistribute this work provided you:
// 1. Supply it free of charge
// 2. Attribute it as the modified work of the original creator (Aine Caolmhe)
// 3. Also make your modified version freely available to copy, modify, and redistribute
//    under the same GPU3.0 terms that this script was given.
// Full details of the GPU General Public License are available at http://www.gnu.org/licenses/gpl.html
//
// USER VARIABLES
integer storeCopy=FALSE;            // TRUE will store a copy of each appearance notecard in the prim's inventory
string cardPrefix=".NPC123";        // notecard will have this string + First Name + Last Name + a number if it duplicates an existing card name
//
// ###################################################################
// DO NOT CHANGE ANYTHING BELOW HERE UNLESS YOU KNOW WHAT YOU'RE DOING
// ###################################################################

default
{
    state_entry()
    {
        string txt="Paramour Clone-Me Utility\nTouch to clone a copy of\nyourself to a NPC appeance notecard";
        if (storeCopy) txt+="\nA copy of the card will be kept in the prim inventory";
        llSetText(txt,<1.0,0.85,0.2>,1.0);
        llOwnerSay("Clone-Me utility is ready for use. Please ensure that the OSSL function osAgentSaveAppearance() is enabled in your region.");
    }
    
    
    touch_start(integer num)
    {
        list toucherData=[llDetectedKey(0),llDetectedName(0)];
        llRegionSayTo(llList2Key(toucherData,0),0,"Please wait while appearance data is stored - it will take several seconds...");
        string cardName;
        integer i=1;
        integer nameAvailable;
        while (!nameAvailable)
        {
            if (i==1) cardName=cardPrefix+llList2String(toucherData,1);
            else cardName=cardPrefix+llList2String(toucherData,1)+" "+(string)i;
            if(llGetInventoryType(cardName)==INVENTORY_NOTECARD) i++;
            else nameAvailable=TRUE;
        }
        
        osAgentSaveAppearance(llList2Key(toucherData,0),cardName);
        integer cardReady;
        
        while(!cardReady)
        {
            if(llGetInventoryType(cardName)==INVENTORY_NOTECARD) cardReady=TRUE;
            else llSleep(0.2); // not ready so wait a little longer before checking again
        }
        
        llGiveInventory(llList2Key(toucherData,0),cardName);
        
        if (!storeCopy)
        {
            llRemoveInventory(cardName);
            llRegionSayTo(llList2Key(toucherData,0),0,"The notecard has now been removed from the prim's inventory");
        }
    }
}



Einen herzlichen Dank meinerseits an Aine Caolmhe für diese guten Scripte in der Opensim Anfangszeit.
Thank you so much Aine, for supporting Opensim from the beginning with this helpful scripts.


Tron
Zitieren


Gehe zu:


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