Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
ChatBot Pandora_Chatbot  

Pandora_Chatbot

An ALICE base chatbot hosted at Pandorabots.com


Place these two scripts in an object. The first one is the listener for you to customize and control who it listens to. The second one is the actual engine itself.

Category: ChatBot
By : Destiny Niles
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Pandora_Chatbot
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Pandora_Chatbot_1.lsl
Get file # 2. Pandora_Chatbot_2.lsl
1 string mesg;
2 key gOwner;
3 list talkers;
4
5
6 listen_to(key talker)
7 {
8 integer index = llListFindList( talkers, [talker] );
9 if( index != -1 )
10 {
11 talkers = llDeleteSubList(talkers, index, index);
12 llMessageLinked(LINK_SET,0,"BYE",talker);
13 }
14 else
15 {
16 talkers = talkers + talker;
17 llMessageLinked(LINK_SET,0,"HI",talker);
18 }
19 }
20
21
22 default
23 {
25 {
26 gOwner = llGetOwner();
27 llListen(0,"",NULL_KEY,"");
28 }
29
30 on_rez(integer i)
31 {
32 llWhisper(0,"Owner say /chat or touch me");
34 }
35
36 touch_start(integer num_detected)
37 {
38 listen_to(llDetectedKey(0));
39 }
40
41 listen(integer channel, string name, key id, string msg)
42 {
43 if(msg == "/chat")
44 {
45 listen_to(id);
46 return;
47 }
48 if((msg == "/reset") && (id == gOwner))
49 {
50 llWhisper(0,"Resetting");
52 }
53
54
55
56 integer index = llListFindList( talkers, [id] );
57 if(index != -1)
58 {
59 mesg = llToLower(msg);
60 llMessageLinked(LINK_SET,0,msg,id);
61 }
62 }
63
64 }

Pandora_Chatbot

pandorabot script

Category: ChatBot
By : Destiny Niles
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

1 key requestid;
2 string botid;
3 string cust;
4 string reply;
5 string newreply;
6 integer that_begin;
7 integer that_end;
8 integer cust_begin;
9
10
11 string SearchAndReplace(string input, string old, string new)
12 {
13 return llDumpList2String(llParseString2List(input, [old], []), new);
14 }
15
16 default
17 {
19 {
20 cust="";
21 botid="b1e9139eee362838";
22 }
23
24 on_rez(integer param)
25 {
27 }
28
29 link_message(integer sender_num, integer num, string msg, key id)
30 {
31 requestid = llHTTPRequest("http://www.pandorabots.com/pandora/talk-xml?botid="+botid+"&input="+llEscapeURL(msg)+"&custid="+cust,[HTTP_METHOD,"POST"],"");
32 }
33 http_response(key request_id, integer status, list metadata, string body)
34 {
35 if(request_id == requestid)
36 {
37 cust_begin=llSubStringIndex(body, "custid=");
38 cust=llGetSubString(body, cust_begin+8, cust_begin+23);
39 that_begin = llSubStringIndex(body, "<@that>"); // this should be < that > (delete @)
40 that_end = llSubStringIndex(body, "<@/that>"); //this should be < / that > (delete @)
41 reply = llGetSubString(body, that_begin + 6, that_end - 1);
42 newreply = SearchAndReplace(reply, "%20", " ");
43 reply = newreply;
44 newreply = SearchAndReplace(reply,"&@quot;","\""); //this should be & quot; (delete @) the wiki changes it to "
45 reply = newreply;
46 newreply = SearchAndReplace(reply,"&@lt;br&@gt;","\n"); //the first search should be & lt;br & gt; (delete @)
47 reply = newreply;
48 newreply = SearchAndReplace(reply, "&@gt;", ">"); //the first search should be & gt; (delete @)
49 reply = newreply;
50 newreply = SearchAndReplace(reply, "&@lt;", "<"); //this first search should be & lt;
51
52 llSay(0,newreply);
53 }
54 }
55 }

Back to the Best Free Tools in Second Life and OpenSim.