参加ボットのリブレの パートナー、アフィリエイト プログラムや支援の無料のオープンなプラットフォーム
Self, AIML, and scripting

Order of execution of scripts

による hmmbotbuilder 掲載 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: 2777, today: 0, week: 3, month: 59

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: 2637, today: 0, week: 6, month: 44

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: 2730, today: 1, week: 5, month: 54

by hmmbotbuilder posted Dec 18 2017, 10:09

Thanks, this helps.


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2781, today: 0, week: 3, month: 44

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: 3041, today: 2, week: 8, month: 54

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: 2948, today: 0, week: 4, month: 54

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: 2925, today: 1, week: 4, month: 50

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: 2942, today: 1, week: 6, month: 59

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: 2863, today: 0, week: 6, month: 63

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: 2974, today: 0, week: 6, month: 57

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: 2997, today: 2, week: 11, month: 49

Id: 20149570
掲載: Dec 16 2017, 8:06
回答: 11
眺望: 3203, 今日の: 1, 週間: 9, 月: 57
0 0 0.0/5