SecondLife Blogging Script

Writing by admin on Tuesday, 20 of March , 2007 at 1:42 pm

Lots of people have been asking for a blogging solution, a way of being able to blog from “in-world” either a text or notecard directly to their personal blog.

The following two scripts when placed in a prim will do exactly that.

You can change the subject title, the blog address, the email, and choose between blogging the text chat, or a notecard.

You call this script “blogger”.

The basic premise is that the script sends an e-mail, so you need your blog software set up to process an email, which is fairly simple on most blog apps.

// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 2 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// Written by Gypsy Paz
// Version Beta 0.3

string blog_email;
string blog_url = "http://blogger.com";
string blog_msg = "Visit my Blog";
string blog_subj = "Post from SecondLife";
integer isadmin;
integer on = FALSE;

string dcapt;
list dbutt;
integer dchan;
key duser = NULL_KEY;

integer i;

integer dlistener;
bluemenu(){
llDialog(duser,dcapt,dbutt,dchan);
dlistener = llListen(dchan,"",duser,"");
llSetTimerEvent(60);
}

integer clistener;
string listenfor;

unlisten(){
llListenRemove(dlistener);
llListenRemove(clistener);
listenfor = "";
llAllowInventoryDrop(FALSE);
duser = NULL_KEY;
}

default{
touch_start(integer num_detected){
if ( ( duser == NULL_KEY ) || ( duser == llDetectedKey(0) ) ){
duser = llDetectedKey(0);
dchan = (integer)llRound(llFrand(1)*5000000);
if ( llDetectedKey(0) == llGetOwner() ){
isadmin = TRUE;
dcapt = "Admin Menu

Blogger Address: "+blog_url+"
Blogger Email: "+blog_email+"
Blogger Subject: "+blog_subj;
dbutt = ["Chat Blog", "Blog Note", "Goto Blog", "Subject", "Set Email", "Set URL"];
bluemenu();
}
else{
isadmin = FALSE;
dcapt = "User Menu";
dbutt = ["Chat Blog", "Blog Note", "Goto Blog"];
bluemenu();
}

}
else{
llInstantMessage(llDetectedKey(0),"In Use, please try again in a minute.");
}
}

listen(integer channel, string name, key id, string message){
if ( channel == dchan ){
if ( isadmin ){
if ( message == "Subject" ){
unlisten();
llInstantMessage(id,"Say /1 followed by the subject you wish for each blog post");
listenfor = "subject";
clistener = llListen(1,"",id,"");
llSetTimerEvent(60);
}
if ( message == "Set Email" ){
unlisten();
llInstantMessage(id,"Say /1 followed by the email address that accepts blogger posts.");
listenfor = "setemail";
clistener = llListen(1,"",id,"");
llSetTimerEvent(60);
}
if ( message == "Set URL" ){
unlisten();
llInstantMessage(id,"Say /1 followed by the blogger web addres to your blog.");
listenfor = "seturl";
clistener = llListen(1,"",id,"");
llSetTimerEvent(60);
}
}
if ( message == "Chat Blog" ){
unlisten();
llMessageLinked(LINK_THIS,0,"chatblog",id);
llInstantMessage(id,"Say your blog post in chat within 60 seconds.");

}
if ( message == "Blog Note" ){
unlisten();
llAllowInventoryDrop(TRUE);
llSetTimerEvent(60);
llInstantMessage(id,"Drop your notecard into this object within 60 seconds.");
}
if ( message == "Goto Blog" ){
llLoadURL(id,blog_msg,blog_url);
unlisten();
}

}
else if ( channel == 1 ){
if ( isadmin ){
if ( listenfor == "setemail" ){
blog_email = message;
llInstantMessage(id,"Blogger email address set");
llMessageLinked(LINK_THIS,0,"setemail",blog_email);
unlisten();
}
else if ( listenfor == "subject" ){
blog_subj = message;
llInstantMessage(id,"Subject is set");
llMessageLinked(LINK_THIS,0,"subject",blog_subj);
unlisten();
}
else if ( listenfor == "seturl" ){
blog_url = message;
llInstantMessage(id,"Blogger url set");
unlisten();
}
}

}
}

timer(){
unlisten();
}

}

You call this script “mailer”


string blog_email;
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 2 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// Written by Gypsy Paz
// Version Beta 0.3

string blog_subject = "Post from SecondLife";
string post;
integer listener;

string qName;
integer qLine = 0;
key qID;

mailit(){
llEmail(blog_email, blog_subject, post);
post = "";
}

clean(){
list types = [INVENTORY_TEXTURE, INVENTORY_SOUND, INVENTORY_LANDMARK, INVENTORY_CLOTHING, INVENTORY_OBJECT, INVENTORY_NOTECARD, INVENTORY_BODYPART, INVENTORY_ANIMATION, INVENTORY_GESTURE];
integer i;
integer ii;
string iname;
for ( i = 0; i < llGetListLength(types); i++ ){
for ( ii = 0; ii < llGetInventoryNumber(llList2Integer(types,i)); ii++ ){
if ( iname = llGetInventoryName(llList2Integer(types,i), ii) ){
llRemoveInventory(iname);
}
}
}
}

default{
state_entry(){
// llAllowInventoryDrop(TRUE);
}

link_message(integer sender_num, integer num, string str, key id){
if ( str == "setemail" ){
blog_email = id;
}
else if ( str == "subject" ){
blog_subject = id;
}
else if ( str == "chatblog" ){
listener = llListen(0,"",id,"");
llSetTimerEvent(60);
}
}

timer(){
llListenRemove(listener);
llSetTimerEvent(0);
}

listen(integer channel, string name, key id, string message){
llListenRemove(listener);
post = message + "\n\n" + llKey2Name(id);
llSetTimerEvent(0);
mailit();
}

changed(integer change){
if(change & (CHANGED_ALLOWED_DROP | CHANGED_INVENTORY)){
qName = llGetInventoryName(INVENTORY_NOTECARD, 0);
if ( llStringLength(qName) > 0 ){
qID = llGetNotecardLine(qName, qLine);
}
else{
clean();
}

}
}

dataserver(key query_id, string data){
if (query_id == qID){
if (data != EOF){
post = post + “\n” + data;
++qLine;
qID = llGetNotecardLine(qName, qLine);
}
else{
mailit();
clean();
qLine = 0;
}
}
}

}

Category: Chris Hambly

No Comments

No comments yet.

Leave a comment

You must be logged in to post a comment.

Audana of AC Optimized Theme is created by Hostseeq Designer

Welcome

SLEDucating is a collective of individuals blogging their research and insights concerning Secondlife.

  • Calendar:

    March 2007
    M T W T F S S
        Apr »
     1234
    567891011
    12131415161718
    19202122232425
    262728293031