|
Xio Jester
Killed the King.
Join date: 13 Nov 2006
Posts: 813
|
04-15-2007 10:43
Does anybody know how I can uplink an object to a Pandorabot? If you don't know what it is, you can take a quick look at Pandorabots.com. It's an A.I. program hosted online...I have no coding experience whatsoever, I just wanna make one for fun.
_____________________
~ In Shakespeare, 'Tis The Fool Who Speaks The Most Profound Truth. ~ http://slexchange.com/modules.php?name=Marketplace&MerchantID=37521
|
|
RobbyRacoon Olmstead
Red warrior is hungry!
Join date: 20 Sep 2006
Posts: 1,821
|
04-15-2007 10:45
oooh... That looks kinda cool. Bookmarked it to get back to when I'm not completely slammed.
|
|
Xio Jester
Killed the King.
Join date: 13 Nov 2006
Posts: 813
|
04-16-2007 09:22
Thanks Racoon. I'm already gettin started on teaching the bot...should be fun!
_____________________
~ In Shakespeare, 'Tis The Fool Who Speaks The Most Profound Truth. ~ http://slexchange.com/modules.php?name=Marketplace&MerchantID=37521
|
|
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
|
04-16-2007 12:03
|
|
Xio Jester
Killed the King.
Join date: 13 Nov 2006
Posts: 813
|
Woooo
04-17-2007 07:28
Thanks a lot Destiny...I'm in the Sandbox workin on it right now. (Not exactly Einstien) I'm tryna work around the comments that the Wiki formatting screwed all up in the second script: From: someone key talker; key requestid; string botid; string cust; string bodyx; string reply; string newreply; integer that_begin; integer that_end; integer cust_begin; integer chat = 0; string SearchAndReplace(string input, string old, string new) { return llDumpList2String(llParseString2List(input, [old], []), new); } default { state_entry() { cust=""; botid="b1e9139eee362838"; } on_rez(integer param) { llResetScript(); } link_message(integer sender_num, integer num, string msg, key id) { requestid = llHTTPRequest("http://www.pandorabots.com/pandora/talk-xml?botid="+botid+"&input="+llEscapeURL(msg)+"&custid="+cust,[HTTP_METHOD,"POST"],""  ; } http_response(key request_id, integer status, list metadata, string body) { integer i; if (request_id == requestid) { cust_begin=llSubStringIndex(body, "custid="  ; cust=llGetSubString(body, cust_begin+8, cust_begin+23); that_begin = llSubStringIndex(body, "<@that>"  ; // this should be < that > (delete @) that_end = llSubStringIndex(body, "<@/that>"  ; //this should be < / that > (delete @) reply = llGetSubString(body, that_begin + 6, that_end - 1); newreply = SearchAndReplace(reply, "%20", " "  ; reply = newreply; newreply = SearchAndReplace(reply,"&@quot;","\""  ; //this should be & quot; (delete @) the wiki changes it to " reply = newreply; newreply = SearchAndReplace(reply,"&@lt;br&@gt;","\n"  ; //the first search should be & lt;br & gt; (delete @) reply = newreply; newreply = SearchAndReplace(reply, "&@gt;", ">"  ; //the first search should be & gt; (delete @) reply = newreply; newreply = SearchAndReplace(reply, "&@lt;", "<"  ; //this first search should be & lt; llSay(0,newreply); } } }
_____________________
~ In Shakespeare, 'Tis The Fool Who Speaks The Most Profound Truth. ~ http://slexchange.com/modules.php?name=Marketplace&MerchantID=37521
|
|
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
|
04-17-2007 08:51
listen string mesg; key gOwner; list talkers;
listen_to(key talker) { integer index = llListFindList( talkers, [talker] ); if ( index != -1 ) { talkers = llDeleteSubList(talkers, index, index); llMessageLinked(LINK_SET,0,"BYE",talker); } else { talkers = talkers + talker; llMessageLinked(LINK_SET,0,"HI",talker); } }
default { state_entry() { gOwner = llGetOwner(); llListen(0,"",NULL_KEY,""); }
on_rez(integer i) { llWhisper(0,"Owner say /chat or touch me"); llResetScript(); } touch_start(integer num_detected) { listen_to(llDetectedKey(0)); }
listen(integer channel, string name, key id, string msg) { if (msg == "/chat") { listen_to(id); return; } if ((msg == "/reset") && (id == gOwner)) { llWhisper(0,"Resetting"); llResetScript(); }
integer index = llListFindList( talkers, [id] ); if (index != -1) //delete and it will respond to everyone { mesg = llToLower(msg); llMessageLinked(LINK_SET,0,msg,id); } }
}
here is the second script pandorabot
key talker; key requestid; string botid; string cust; string bodyx; string reply; string newreply; integer that_begin; integer that_end; integer cust_begin; integer chat = 0;
string SearchAndReplace(string input, string old, string new) { return llDumpList2String(llParseString2List(input, [old], []), new); }
default { state_entry() { cust=""; botid="b1e9139eee362838"; }
on_rez(integer param) { llResetScript(); }
link_message(integer sender_num, integer num, string msg, key id) { requestid = llHTTPRequest("http://www.pandorabots.com/pandora/talk-xml?botid="+botid+"&input="+llEscapeURL(msg)+"&custid="+cust,[HTTP_METHOD,"POST"],""); } http_response(key request_id, integer status, list metadata, string body) { integer i; if (request_id == requestid) { cust_begin=llSubStringIndex(body, "custid="); cust=llGetSubString(body, cust_begin+8, cust_begin+23); that_begin = llSubStringIndex(body, "<that>"); that_end = llSubStringIndex(body, "</that>"); reply = llGetSubString(body, that_begin + 6, that_end - 1); newreply = SearchAndReplace(reply, "%20", " "); reply = newreply; newreply = SearchAndReplace(reply,""","\""); reply = newreply; newreply = SearchAndReplace(reply,"<br>","\n"); reply = newreply; newreply = SearchAndReplace(reply, ">", ">"); reply = newreply; newreply = SearchAndReplace(reply, "<", "<"); llSay(0,newreply);
} }
}
|
|
Robustus Hax
Registered User
Join date: 4 Feb 2007
Posts: 231
|
04-17-2007 16:47
Very amazing thank you Destiny.
This works very well for chatbots... I am interested to hear if anyone tweaks this to do some amazing things. Keep us all posted.
|