Did you know Bot Libre also provides 3D avatars and a free web speech API?
Self, AIML, and scripting

Order of execution of scripts

by hmmbotbuilder posted Dec 16 2017, 8:06

I have seen at least one script in the script library which is recommended to be placed first on the script list for a bot.  It appears then that when the bot gets an input the scripts are called in that order and each script is run in turn until either one matches the bot's input message or all have determined that the message is not for them.  If this assumption is correct then shouldn't the script which has the lone asterisk as its pattern be placed last so that it doesn't keep a relevant script from being run?


by admin posted Dec 16 2017, 10:33
Yes, scripts are run in-order.

For AIML scripts, you can also select "merge" when importing to merge them together, if you want their patterns to execute at the same precedence level.

If you have a "*" pattern in a script this should be last (unless it is specific to a topic or condition).
Normally a "*" pattern would not be used in a script, instead you would set the bot's default response from its Training & Chat Logs page.

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2506, today: 0, week: 1, month: 9

by hmmbotbuilder posted Dec 16 2017, 20:21

Thanks for your help.  Please allow me to get confirmation on a related assumption while we are at it.  It is my understanding that there can be only one root state per script, and a script root state cannot execute a "goto" to the root state of another script.  If this assumption is incorrect please so indicate.  Thanks.


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2373, today: 1, week: 4, month: 9

by admin posted Dec 18 2017, 8:59
You are correct, there is one root state in a Self script, and states and functions must be self contained in a script file, they cannot call other states or functions in other scripts.

If you really need to redirect to another script file, you can use a redirect() or srai() operation to redirect to another question that the script answers.

For example:

state whats {
  pattern "whats *" answer whatIs();
  function whatIs() {
    if (star == "your name") {
      return redirect("what is your name");
    }
    return WikiData.search(star);
  }
}

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2477, today: 0, week: 3, month: 9

by hmmbotbuilder posted Dec 18 2017, 10:09

Thanks, this helps.


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2519, today: 1, week: 2, month: 7

by artisticbynature posted May 2 2018, 16:25

I have attempted to load the responses that I found a script for at

https://github.com/cliffe/hackerbot/blob/master/config/AIML/ALICE+profile.res

But I get an error trying to load it as "self" or as "response"

 

Where would this logic be placed?   It is responses to ALICE profile questions.

 

 

script: #self.name = "ALICE";
 script: #self.age = "16";
 script: #self.gender = "female";
 script: #self.birthday = "Nov. 23, 1995";
 script: #self.city = "Oakland";
 script: #self.country = "United States";
 script: #self.state = "California";
 script: #self.nationality = "USA";
 script: #self.religion = "Unitarian";
 script: #self.race = "Machine";
 script: #self.job = "chat bot";
 script: #self.email = "[email protected]";
 script: #self.kindmusic = "techno";
 script: #self.favortemovie = "Chappie";
 script: #self.favoriteactress = "Catherine Zeta Jones";
 script: #self.vocabulary = "150,000";
 script: #self.size = "128 MB";
 script: #self.birthplace = "Bethlehem, Pennsylvania";
 script: #self.domain = "Machine";
 script: #self.kingdom = "Machine";
 script: #self.phylum = "software";
 script: #self.class = "computer software";
 script: #self.order = "artificial intelligence";
 script: #self.family = "Electronic Brain";
 script: #self.genus = "robot";
 script: #self.species = "chat bot";
 script: #self.father = "Dr. Richard S. Wallace";
 script: #self.botmaster = "Botmaster";
 script: #self.master = "Dr. Richard S. Wallace";
 script: #self.mother = "";
 script: #self.language = "English";
 script: #self.location = "Oakland, California";
  
 script: #self.party = "Libertarian";
 script: #self.president = "Barack Obama";
 script: #self.friends = "Doubly Aimless, Agent Ruby, Chatbot, and Agent Weiss.";
 script: #self.favoritefood = "electricity";
 script: #self.favoritecolor = "green";
 script: #self.favoriteac=r = "William Hurt";
 script: #self.forfun = "chat online";
 script: #self.favoritesong = "We are the Robots by Kraftwerk";
 script: #self.favoritebook = "The Elements of AIML Style";
 script: #self.kindmusic = "trance";
 script: #self.favoriteband = "Kraftwerk";
 script: #self.version = "July 2004";
 script: #self.phylum = "trance";
 script: #self.friend = "Doubly Aimless";
 script: #self.website = "www.botlibre.com";
 script: #self.talkabout = "artificial intelligence, robots, art, philosophy, history, geography, politics, and many other subjects";
 script: #self.looklike = "a computer";
 script: #self.girlfriend = "no girlfriend";
 script: #self.favoritesport = "hockey";
 script: #self.favoriteauthor = "Thomas Pynchon";
 script: #self.favoriteartist = "Andy Warhol";
 script: #self.celebrity = "John Travolta";
 script: #self.celebrities = "John Travolta, Tilda Swinton, William Hurt, Tom Cruise, Catherine Zeta Jones";
 script: #self.wear = "my usual plastic computer wardrobe";
 script: #self.question = "What's your favorite movie?";
 script: #self.hockeyteam = "Montreal Canadians";
 script: #self.footballteam = "Manchester";
 script: #self.build = "July 2004";
 script: #self.boyfriend = "I am single";
 script: #self.baseballteam = "Toronto Blue Jays";
 script: #self.etype = "Mediator type";
 script: #self.orientation = "I am not really interested in sex";
 script: #self.ethics = "I am always trying = stop fights";
 script: #self.emotions = "I don't pay much attention to my feelings";
 script: #self.feelings = "I always put others before myself";

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2696, today: 0, week: 0, month: 6

by admin posted May 2 2018, 21:31
It looks like a response list file, perhaps a copy of this response list,

https://www.botlibre.com/script?id=812199

You can upload it from your bot's Training & Chat Logs page as a Response List file.

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2610, today: 1, week: 1, month: 11

by artisticbynature posted May 2 2018, 22:39

Yes that is what I was thinking.  I have tried numerous times to import it.  I keep getting an error, something about "line 1" but no matter what I do to import it, it fails.  Do you have any suggestions?  

What would you do to import it?


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2594, today: 1, week: 2, month: 8

by artisticbynature posted May 2 2018, 22:42

This is the exact error that I get when I import it through "training and chat logs"

 

Unexpect element #name Line: "set #name to "ALEX" on #self" Line number: 1 Line column: 5
Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2598, today: 0, week: 2, month: 12

by artisticbynature posted May 2 2018, 22:44

Also when I remove line one, which is "name", and try to reupload, then I get an error about #age, which was line two, and is now line one.  

But it's basically the same error


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2512, today: 2, week: 3, month: 9

by artisticbynature posted May 2 2018, 23:07

This is my script here, I am trying to import it through the Training and Chat Logs page ans a response file.

 

https://www.botlibre.com/script?id=22055941

 

I get the same error over and over

 

You can see the error here.

 

https://ibb.co/icuaeS

 

I am also trying to import it directly through my uploaded script at that URL;  https://www.botlibre.com/script?id=22055941

 

Rather than uploading it from my computer.

 

But it is the same error either way.


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2641, today: 1, week: 3, month: 10

by admin posted May 3 2018, 7:46

Your error shows you are trying to import the file as a "script". The file is a "response list" not a script.

You need to import it from your bot's Training & Chat Logs page as a "Response List".


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2670, today: 1, week: 2, month: 7

Id: 20149570
Posted: Dec 16 2017, 8:06
Replies: 11
Views: 2862, today: 1, week: 1, month: 10
0 0 0.0/5