Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
Ein Script fuer Mailbox mit NC funktion
#2
Hallo Ezry Smile
ja es gibt ein Briefkasten Skript , das auch in OS funktioniert.
Es ist zwar nur für eine Person (den Owner) aber ansonsten funktioniert es gut.
Jeder kann eine Notecard darin ablegen und der Owner hat beim Anklicken ein Auswahl Menue.
Ungelesen Nachrichten, bereits gelesene Nachrichten oder löschen .
Code:
// --------------------------------------//
// This script transform a prim to a Mail Box.
// Folks can drop notecard to the box.
// Read/unread information is displayed as hovering text.
// You can copy/modify this script, it's totally free.
// --------------------------------------//
// Modified by dakar Muliaina, converted to The king's English
// and a few other enhancements.
//-------------------------------------------//

list lMail = [];
// column 1 = notecard name, column 2 = read by user
integer     MAIL_UNREADED = 0;
integer     MAIL_READED = 1;
integer     DIALOG_CHANNEL = 49383;
list        DIALOG_CHOICE =
                ["Ungelesene",
                 "Gelesene",
                 "Loeschen"];
integer nLastCardCount = 0;
integer nLastItemCount = 0;

TxtRefresh()
{
    // show the unreadable notecard
    integer nTotalCard = 0;
    integer nNotReaded = 0;
    integer nCount = 0;
    for (nCount = 0; nCount < llGetListLength(lMail); nCount += 2)
    {
        if (llList2Integer(lMail, nCount + 1) == MAIL_UNREADED)
            nNotReaded += 1;
        nTotalCard += 1;
    }

    // total string
    string cPost = (string)nTotalCard + " Brief(e)";
    if (nTotalCard > 1) cPost += "s";
    cPost += " eingeworfen";

       // unreaded string
    string cUnreaded = (string)nNotReaded + " ungelesen";
    llSetText("Briefkasten!\n" + cPost + "\n" + cUnreaded, <.95, .75, 0>, 1);
}

default
{
    state_entry()
    {
       // Allowing dropping of object
       llAllowInventoryDrop(TRUE);
       llListen(DIALOG_CHANNEL, "", NULL_KEY, "");
       nLastCardCount = llGetInventoryNumber(INVENTORY_ALL);
       nLastItemCount = llGetInventoryNumber(INVENTORY_NOTECARD);

       // Auto complete list
       integer nCardCount = llGetInventoryNumber(INVENTORY_NOTECARD);
       integer n_CurObj = 0;
       string c_Name = "NotEmpty";
       while (c_Name != "")
       {
            c_Name = llGetInventoryName(INVENTORY_NOTECARD, n_CurObj);
            n_CurObj += 1;
            if (c_Name != "")
            {
                lMail += [c_Name];
                lMail += MAIL_UNREADED;
            }
        }
        TxtRefresh();
    }

    touch_start(integer total_number)
    {
        llSay(0, "Drop a notecard to be sent to MY OWNER.\n ziehe eine Notecard
auf mich um sie meinem Besitzer zu hinterlassen.");
//---- Change MY OWNER above to suit your likes and needs.   //
        // if owner
        key id = llDetectedKey(0);
        if (id == llGetOwner())
        {
            // Show a dialog
            llDialog(id, "Welche Briefe soll ich oeffnen?", DIALOG_CHOICE,
              DIALOG_CHANNEL);
        }
    }

    listen(integer channel, string name, key id, string message)
    {
        if (llGetOwner() == id && llListFindList(DIALOG_CHOICE,
           [message]) != -1)
        {
            integer i;
            string cName;
            list lRemove;
            integer nStatus;
            for (i = 0; i < llGetListLength(lMail); i += 2)
            {
                cName = llList2String(lMail, i);
                nStatus = llList2Integer(lMail, i + 1);
                if (message == llList2String(DIALOG_CHOICE, 0)
                   && nStatus == MAIL_UNREADED)
                {
                    // open un-readed
                    llGiveInventory(id, cName);
                    // mark for readed
                    lMail = llListReplaceList(lMail, [MAIL_READED],
                        i + 1, i + 1);
                }
                if (message == llList2String(DIALOG_CHOICE, 1)
                   && nStatus == MAIL_READED)
                {
                    // open readed
                    llGiveInventory(id, cName);
                }
                if (message == llList2String(DIALOG_CHOICE, 2)
                   && nStatus == MAIL_READED)
                {
                    // delete readed
                    llSay(0, cName);
                    llRemoveInventory(cName);
                    lRemove += i;
                }
            }
            // remove from the list
            if (llGetListLength(lRemove) > 0)
            {
                integer k;
                for (k = 0; k < llGetListLength(lRemove); k++)
                {
                    i = llList2Integer(lRemove, k);
                    lMail = llDeleteSubList(lMail, i, i+1);
                }
            }
            TxtRefresh();
        }
    }

    changed(integer change)
    {
        // dont accept other than a notecard
        integer nItemCount = llGetInventoryNumber(INVENTORY_ALL);
        if (nItemCount < 2)
        {
            // clear the list
            lMail = [];
        }

        if (nItemCount != nLastItemCount)
        {
            // delete other item type than notecard
            string cName = "NotEmpty";
            integer nCurObj = 0;
            integer nObjType = INVENTORY_NONE;
            list lRemove = [];
            while (cName != "")
            {
                cName = llGetInventoryName(INVENTORY_ALL, nCurObj);
                nCurObj += 1;
                nObjType = llGetInventoryType(cName);
                if (nObjType != INVENTORY_NOTECARD)
                {
                    // add for deletion, its not a notecard
                    lRemove += cName;
                }
            }

            // delete other object than notecard
            integer nD = 0;
            for (nD = 0; nD < llGetListLength(lRemove); nD += 1)
            {
                // dont remove this script !
                cName = llList2String(lRemove, nD);
                if (cName != llGetScriptName() && cName != "")
                {
                    llSay(0, "Sorry but " + cName + " is not a notecard.");
                    llRemoveInventory(cName);
                }
            }

            // search for a new notecard
            integer n_CurObj = 0;
            string c_Name = "NotEmpty";
            while (c_Name != "")
            {
                c_Name = llGetInventoryName(INVENTORY_NOTECARD, n_CurObj);
                llSay(0, c_Name);
                n_CurObj += 1;
                // search for this card
                if (llListFindList(lMail, [c_Name]) == -1 && c_Name != "")
                {
                    // ok its a new card
                    lMail += [c_Name];
                    lMail += MAIL_UNREADED;
                    llSay(0, c_Name + " added to the mailbox.");
                }
            }
        }
        nLastItemCount = llGetInventoryNumber(INVENTORY_ALL);
        nLastCardCount = llGetInventoryNumber(INVENTORY_NOTECARD);
        // refresh the text
        TxtRefresh();
    }
}

viel Spass beim testen

greets

Genie
Zitieren


Nachrichten in diesem Thema
Re: Ein Script fuer.... - von Genie Fegte - 07.08.2010, 11:25
Re: Ein Script fuer.... - von Bogus Curry - 07.08.2010, 15:38
Re: Ein Script fuer.... - von Ezry Aldrin - 07.08.2010, 18:20
Re: Ein Script fuer.... - von Ezry Aldrin - 10.08.2010, 00:49
Re: Ein Script fuer.... - von Masajo - 10.08.2010, 06:44

Möglicherweise verwandte Themen…
Thema Verfasser Antworten Ansichten Letzter Beitrag
Question Suche Garagentor script Kalkofe 4 1.461 20.07.2024, 12:06
Letzter Beitrag: Manfred Aabye
Question Tür script gesucht, Tür soll bei Eintritt ein paar meter vorher öffnen Kalkofe 9 1.916 11.10.2023, 05:37
Letzter Beitrag: Christoph Balhaus
  Rufknopf Script für Aufzug gesucht Xenos Yifu 4 2.540 03.04.2022, 19:09
Letzter Beitrag: Mareta Dagostino
  Geber/ Rezz Script Xenos Yifu 10 5.949 28.11.2020, 14:28
Letzter Beitrag: Kubwa
  Suche Script Gruppe Titoss 4 7.245 27.11.2020, 14:52
Letzter Beitrag: Dorena Verne

Gehe zu:


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