Jump to content

Search the Community

Showing results for tags 'chatbot'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • People Forum
    • Your Avatar
    • Make Friends
    • Lifestyles and Relationships
    • Role Play
    • General Discussion Forum
    • Forums Feedback
    • Missed Connections
    • Second Life Education
  • Places and Events Forum
    • Favorite Destinations
    • Upcoming Events and Activities
    • Games in Second Life
  • Official Contests, Events & Challenges
    • Challenges
    • Leap Into Love Snapshot Contest
  • Creation Forum
    • Fashion
    • Art, Music and Photography
    • Animation Forum
    • Bakes on Mesh
    • Environmental Enhancement Project
    • Machinima Forum
    • Building and Texturing Forum
    • Mesh
    • LSL Scripting
    • LSL Library
    • Experience Tools Forum
    • Sansar for Second Life Residents
  • Technology Forum
    • Second Life Server
    • Second Life Viewer
    • Second Life Web
    • General Second Life Tech Discussion
  • Commerce Forum
    • Merchants
    • Inworld Employment
    • Wanted
  • Land Forum
    • General Discussion
    • Mainland
    • Linden Homes
    • Regions for Sale: Full Private Island
    • Region for Rent: Full Private Island
    • Regions for Sale: Homesteads
    • Region Rentals: Homestead
    • Parcels for Sale: Mainland
    • Parcels for Rent: Mainland
    • Wanted: Full Private Island
    • Wanted: Homesteads
    • Wanted: Mainland
  • International Forum
    • Deutsches Forum
    • Foro en español
    • Forum in italiano
    • Forum français
    • 日本語フォーラム
    • 한국어 포럼
    • Fórum em português
    • Forum polskie
    • المنتدى العربي
    • Türkçe Forum
    • Форум по-русски
  • Adult Content Forum
    • Highlight Upcoming Events
    • General Discussion
    • General Announcements
  • Answers
    • Abuse and Griefing
    • Account
    • Avatar
    • Creation
    • Inventory
    • Getting Started
    • Controls
    • Land
    • Linden Dollars (L$)
    • Shopping
    • Technical
    • Viewers
    • Everything Else
    • International Answers

Blogs

  • Commerce
  • Featured News
  • Inworld
  • Tools and Technology
  • Tips and Tricks
  • Land
  • Community News

Categories

  • English
  • Deutsch
  • Français
  • Español
  • Português
  • 日本語
  • Italiano
  • Pусский
  • Türkçe

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me

Found 1 result

  1. Hello again. I have another project where I am trying to merge two scripts. I have revived an old project of mine which links an object (chatbot) in SL to an AI engine in Pandorabots after I found my original pandorabot was still active. In the SL script library I found a script for pandorabots (in 2 parts) that works fine. I have customised this script to pass some data about the avatar talking to the bot which will enhance the conversation. Currently it passes the avatar's name and location when the avatar first starts talking to the bot. You can test this by creating an object and putting in the two scripts (script1 and script2) as posted below. What I am attempting to do is to also collect the avatar's rez date. For this I have found another script in the library that can determine an avatar's age which included a RequestAgentData call and dataserver event to process the data. It would seem logical to do the dataserver process in touch_start before the call to the pandorabot but I get a syntax error whatever way I try this. I know I have this part of the script in the wrong place currently but at least it saves without any syntax errors. I have included the avatar age script as well which works perfectly fine by itself so you can see where I've pulled the age script from. Any suggestions how I can restructure my script to get this working. If you do create an object with these scripts in, then you can talk to the bot and hopefully you'll get some intelligent answers back - I'll do more work on that side of things once I've got this problem solved. After starting a conversation with the bot by touching it, typing 'testinit' (without quotes) will show the values of these initial variables so you would be able to see if any changes to the script worked. Thank you in advance for any suggestions. Script 1: // :CATEGORY:ChatBot // :NAME:Pandora_Chatbot // :AUTHOR:Destiny Niles // :CREATED:2010-01-10 05:20:56.000 // :EDITED:2013-09-18 15:38:59 // :ID:603 // :NUM:826 // :REV:1.0 // :WORLD:Second Life // :DESCRIPTION: // 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. // :CODE: string mesg; key gOwner; list talkers; key Query; // added by SG for use with age calc integer uYr; // added by SG for use with age calc integer uMn; // added by SG for use with age calc integer uDy; // added by SG for use with age calc 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; string aviName = llDetectedName(0); string location = llList2String(llGetParcelDetails(llGetPos(), [PARCEL_DETAILS_NAME]) ,0); string region = llGetRegionName(); // The MessageLinked below is formatted to process the information in Pandorabots collected from SL - i.e. name and location. Trying to also include avatars rez day but this part not working yet. You can check this by saying in chat (after logging in by touching the prim containing these 2 scripts) "testinit" (without the quotes) llMessageLinked(LINK_SET,0,"CTRL1 "+aviName+". "+"CTRL2 "+(string)uYr+" "+(string)uMn+" "+(string)uDy+". " + "CTRL3 "+location+". "+"CTRL6 "+region+".",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) { Query = llRequestAgentData(llDetectedKey(0),DATA_BORN); listen_to(llDetectedKey(0)); } dataserver(key QID,string Data) { if (QID == Query) { float YrDays = 365.25; float MnDays = YrDays / 12; // This is the user's birthdate. integer uYr = (integer)llGetSubString(Data,0,3); integer uMn = (integer)llGetSubString(Data,5,6); integer uDy = (integer)llGetSubString(Data,8,9); float uXVal = (uYr * YrDays) + (uMn * MnDays) + uDy; // This is today's date Data = llGetDate(); integer Yr = (integer)llGetSubString(Data,0,3); integer Mn = (integer)llGetSubString(Data,5,6); integer Dy = (integer)llGetSubString(Data,8,9); float XVal = (Yr * YrDays) + (Mn * MnDays) + Dy; // We calculate the difference between those two dates to get the number of days. integer DDiff = (integer)(XVal - uXVal); // llSay(0,"total days in SL:"+(string)DDiff); integer years = (integer)(DDiff/YrDays); // llSay(0,"years:"+(string)years); integer months = (integer)((DDiff - (years*365.25))/MnDays); // llSay(0,"months:"+(string)months); integer days = llRound((((DDiff - (years*365.25))/MnDays) - months) *MnDays); // llSay(0,"days:"+(string)days); } } 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) { mesg = llToLower(msg); llMessageLinked(LINK_SET,0,msg,id); } } } Script 2 // :CATEGORY:ChatBot // :NAME:Pandora_Chatbot // :AUTHOR:Destiny Niles // :CREATED:2010-01-10 05:20:56.000 // :EDITED:2013-09-18 15:38:59 // :ID:603 // :NUM:827 // :REV:1.0 // :WORLD:Second Life // :DESCRIPTION: // pandorabot script // :CODE: key requestid; string botid; string cust; string reply; string newreply; integer that_begin; integer that_end; integer cust_begin; list params; string SearchAndReplace(string input, string old, string new) { return llDumpList2String(llParseString2List(input, [old], []), new); } default { state_entry() { cust=""; botid="c058b3671e368866"; // this id is specific to SG's bot } 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,params,""); } http_response(key request_id, integer status, list metadata, string body) { 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,"&quot;","\""); reply = newreply; newreply = SearchAndReplace(reply,"&lt;br&gt;","\n"); reply = newreply; newreply = SearchAndReplace(reply, "&gt;", ">"); reply = newreply; newreply = SearchAndReplace(reply, "&lt;", "<"); llSay(0,newreply); } } } Avatar's age calc script key Query; default { on_rez(integer X) {llResetScript();} touch_start(integer X) { Query = llRequestAgentData(llDetectedKey(0),DATA_BORN); } dataserver(key QID,string Data) { if (QID == Query) { // The following variables are set to account for leap years and assume // the days evenly distributed amongst the 12 months of a year. float YrDays = 365.25; float MnDays = YrDays / 12; // This is the user's birthdate. integer uYr = (integer)llGetSubString(Data,0,3); integer uMn = (integer)llGetSubString(Data,5,6); integer uDy = (integer)llGetSubString(Data,8,9); float uXVal = (uYr * YrDays) + (uMn * MnDays) + uDy; // This is today's date Data = llGetDate(); integer Yr = (integer)llGetSubString(Data,0,3); integer Mn = (integer)llGetSubString(Data,5,6); integer Dy = (integer)llGetSubString(Data,8,9); float XVal = (Yr * YrDays) + (Mn * MnDays) + Dy; // We calculate the difference between those two dates to get the number of days. integer DDiff = (integer)(XVal - uXVal); llSay(0,"total days in SL:"+(string)DDiff); integer years = (integer)(DDiff/YrDays); llSay(0,"years:"+(string)years); integer months = (integer)((DDiff - (years*365.25))/MnDays); llSay(0,"months:"+(string)months); integer days = llRound((((DDiff - (years*365.25))/MnDays) - months) *MnDays); llSay(0,"days:"+(string)days); } } } Thanks
×
×
  • Create New...