Tweeting about HUDDLES
Although, I haven’t been a user of twitter before, I got to thinking about how one might update a twitter stream from a LSL script in Second Life. It took me a little time to figure it out, but it seems quite easy. Someone posted a solution to the Second Life forums a couple years back.
The key line of code is this:
llHTTPRequest(“http://” + llEscapeURL(user) + “:”+llEscapeURL(password) + “@twitter.com/statuses/update.xml”, [HTTP_METHOD, “POST”, HTTP_MIMETYPE, “application/x-www-form-urlencoded; charset=UTF-8”], “status=”+llEscapeURL(msg));
User is your twitter name, password is your password and msg is the message you want to send.
I’m thinking that it might be nice to add this to the EZ Animator Deluxe, but I’m wondering if anyone would use it and what features would they want. What do you think?
Oh, by the way, you can follow me on twitter, my name is KeikiAtHuddles.
Tags: EZ Animator Deluxe, HUDDLES, Second Life, tweet, twitter, twitter in second life
April 7th, 2009 at 11:26 am
Hi Keiki, did you run that LSL? It didn’t work for me. I get a 401 Unsupported or unknown Content-Type and after half an hour the message still isn’t in Twitter. Perhaps something has changed since the code was published.
I’d use it if you added it to the Huddles. I use Ordinal Malaprop’s Twitterbox http://ordinalmalaprop.com/twitter/ but I’d rather carry one fewer thing. Ordinal’s works through a PHP script on her server, not directly to Twitter.
I use it mostly to tweet prices and locations of things I find in stores, so I don’t forget about them. Ordinal’s script expands SLPOS and SLURL into the current location, which is very useful.
April 7th, 2009 at 12:54 pm
Yep, I’ve definitely got that script working. Could you be more specific about the error you are getting? Is it when you compile the script? Or is it some feedback you are getting in the http_response event?
April 8th, 2009 at 10:43 am
It’s the HTTP response. Here’s my exact script (except for my username and password):
string USER = “mytwittername”;
string PASSWORD = “mytwitterpassword”;
default {
touch_start(integer total_number) {
string msg = “this is a test from SL”;
llHTTPRequest(“http://”+llEscapeURL(USER)+”:”+llEscapeURL(PASSWORD)+”@twitter.com/statuses/update.xml”, [HTTP_METHOD, “POST”, HTTP_MIMETYPE, “application/x-www-form-urlencoded; charset=UTF-8”], “status=”+llEscapeURL(msg));
}
http_response(key request_id, integer status, list meta, string body) {
llOwnerSay(“status:” + (string)status + ” meta:” + (string)llGetListLength(meta) + ” body:” + body);
}
}
When I touch it, I see this in chat:
twit: status:401 meta:0 body:Unsupported or unknown Content-Type.
April 8th, 2009 at 1:48 pm
I tried your script. I got an error message. But it did post to my twitter.
IM me if you want me to give you a working script.
April 9th, 2009 at 9:58 am
Thank you Keiki. If the identical script worked for you, I figured it had to be something about my Twitter account. I made a new account and it works! I compared the settings of the two accounts and they’re identical, so who knows what is wrong with the old one. Anyway, now I can Twitter away happily 🙂
April 24th, 2009 at 3:33 pm
Maybe you happen to have some special characters such as “_” or “-” in your username? Maybe that caused the error?
July 18th, 2009 at 11:44 am
Correction:
HTTP_MIMETYPE “application/x-www-form-urlencoded; charset=UTF-8?
UPDATES but twitter still spits back
“Unsupported or unknown Content-Type.”
July 23rd, 2009 at 9:58 am
But does the tweet show up on your twitter page?
September 24th, 2009 at 8:06 pm
The 415 error comes from the LL servers when they get the reply back from the remote server (Twitter). The LL server does not know how to handle the more exotic formats such as xml and json its reponse to us is the 415 error. We can assume therefore that the 415 error means Twitter replied, we will just never know what the reply was.