Change font size
It is currently Sat Feb 16, 2019 8:40 am

Forum rules


Post a new topicPost a reply Page 1 of 1   [ 1 post ]
Author Message
 Post subject: Just a fun mailbox / guestbook
PostPosted: Fri Sep 12, 2014 1:13 am 
Furious Typer
User avatar

Joined: Mon Aug 10, 2009 11:53 pm
Posts: 258
Hiya peoples! It's been a while since I've dropped by and contributed anything. While this is pretty darn simple and not much to show off, I was hopping around the hypergrid and came across a neat little mailbox. It was no copy/mod, but I wanted one for myself! So I made one and here is the script that makes it work.

Nothing fancy, but I've put it below and here is how it works:

Somebody spies your mailbox / guestbook / whatever you choose to use. They click on it, it thanks them for stopping by and asks them to leave a message.
It then captures the next line of open chat and stores it in a notecard, along with their name, key, time, and the region name.
Then it thanks them and fires off an IM to the owner.

It includes the optional function of when the owner clicking on the item, it will display the blocks of content in the notecard. Of course you can always just read your notecard, but hey! Why not right? Don't forget to create a blank notecard, name it 'mailbox' and drop it in the prim along with the script.

You can pickup a free script and notecard from the mailbox on my hg region at: radio
Take a copy and leave me a message lol!

So without further ado:
// Simple mailbox / guestbook script - Haplo Voss
// Free to use and abuse as you see fit
// Just drop this and a blank notecard named 'mailbox' into a prim of your choice.
// When others click on it, they can leave you a message and it will leave you an IM that someone has done so.
// When you (the owner) click on it, it will list all messages within the notecard including name, key, time, and message.
// Having the key is useful if you want to send an IM or something to that user at some point.
// In a metaverse where there can be more than one of the same name - the UUID is good to have.
// On with the show...

integer listener;
string gMessage = "";   // Empty string to build the message for write to notecard
key visitor;            // key of person clicking on the object
key owner;              // your key
string v_Name = "";     // string to contain the visitors name

RetrieveMsgs()                                              // Optional retrieval and display function...
        string note = osGetNotecard("mailbox");             // Get contents of notecard and store it in temporary string 'note'
        list new_list = llParseString2List(note,"|","");    // Parse it out into a list
        integer i;
        string inbox;                                       // empty string to build individual message blocks
        for (i=0; i<llGetListLength(new_list); i++)         // loop that reads the list, displays the information to the owner.
            inbox = "\n"+llList2String(new_list,i)+" "+llList2String(new_list,i+1)+" "+llList2String(new_list,i+2)+" "+llList2String(new_list,i+3);

    string note = osGetNotecard("mailbox");                 // Get contents of notecard and store it in temporary string 'note'
    llRemoveInventory("mailbox");                           // Delete the old notecard! (If you don't... well, you'll find out.)
    note += gMessage;                                       // Add the new message block to the contents of the old notecard
    gMessage="";                                            // Clear the message string! (Otherwise you duplicate and mess up your data)
    list new_list = llParseString2List(note,"|","");        // Parse the string into a list. Why? Cuz osMakeNotecard needs a list.
    osMakeNotecard("mailbox",new_list);                     // Make a new notecard with all the old and new data in it. woo!

        llOwnerSay("Mailbox Active");                       // Why not?
    touch_start(integer num)
        visitor = llDetectedKey(0);                         // Just a few variable assignments. Pretty self explanatory here...
        v_Name = llKey2Name(visitor);
        owner = llGetOwner();
        if (visitor != owner)
            llSay(0,"Thank you for stopping by!\nEnter your message in chat using one line.\nOnce you press ENTER your message will be saved and delivered!");
            listener = llListen(0,"",visitor,"");           // Open the listener channel to capture the next line in chat
            RetrieveMsgs();             // Go read up top. It's really really interesting.
            // **** This is a completely optional portion of this script. You can always just open your notecard and read it ***
    listen (integer channel, string name, key id, string msg)
        if (msg != "")
            llListenRemove(listener);   // Close the listener. Don't need it or want it. No lag. *pets llListenRemove*
            gMessage = v_Name+"|"+(string)visitor+"|"+(string)llGetTime()+"|"+msg;  // Create the new message block
            WriteMsg();                 // Go up a ways, enrich yourself with scripting goodness.
            llSay(0,"Thank you for taking the time to write me!");                  // Nothing much left to do. Tell them thanks, fire off an IM.
            llInstantMessage(owner,"You have mail! At region: "+llGetRegionName());

Sorry, I was just thinking upon the immortal words of Socrates who said ... "I drank what?? ... "
- Real Genius

Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 1 post ]

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of