¿Sabía usted Bot Libre también proporciona avatares en 3D y una web speech API?
Bot Libre Forum

run a script in a greeting

por bobred publicado Oct 3 2018, 19:06

can I run a self script in a greeting?


by bobred posted Oct 3 2018, 20:22

I figured out how to make  the chatbot know the hour with the greeting.so it can ask if you want breakfast, dinner or lunch.i am going to use that for that.


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

by admin posted Oct 4 2018, 9:17

To run code in a greeting there are 2 options, use a Template, or use a redirect.

For example, for a Template you can use something like:

Template("{var hour = Date.get(Date.date(), #hour); if (hour < 10) { "Good morning." } else if (hour > 18) { "Good evening." } else { "Good day." } }")

For a redirect, you use a Template in your greeting that does a redirect to a response that is handled by a script.

Template("{ redirect("script_greeting") }")

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2287, today: 1, week: 3, month: 7

by bobred posted Oct 4 2018, 10:45

that is good to know.But how do I rename a aiml script after I have made it.Because most of my new scripts I made are just called aiml.


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2384, today: 0, week: 2, month: 4

by admin posted Oct 4 2018, 14:12
If you upload AIML from a file or our script library it gets the file/script name.
If you create a new AIML script from the bot's scripts it will be named 'aiml', to have a different name, first save it as a Self script with the name, then change the code to AIML.

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

by bobred posted Oct 6 2018, 8:03

redirect to a script does not work because the default response overrides it.


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2330, today: 1, week: 4, month: 7

by admin posted Oct 9 2018, 12:36
I have tested this, and it does work.

I'm not sure what you tried.

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2189, today: 2, week: 4, month: 11

by bobred posted Oct 9 2018, 19:55

This script is what I was talking about.

 

Template("{ redirect("script_greeting") }")


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2220, today: 1, week: 2, month: 4

by admin posted Oct 10 2018, 13:28
So a "redirect" send the redirect text as a message to the bot and returns the response.

For example if a bot had a script that had the pattern "hello" and returned "hello world", then in a Template redirect("hello") would return "hello world".

In my example "script_greeting" was an example message, you need a script that accepts this pattern and return your desired response. If you have no response for "script_greeting", then your bot would use its default response.

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2281, today: 1, week: 3, month: 5

by bobred posted Oct 10 2018, 18:34

okay I did not know that.


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2238, today: 2, week: 6, month: 7

by bobred posted Oct 10 2018, 19:11

this is what Sheila bing greeting is now.wait here.walks away down the hallway.comes back 30 minutes.here is your script_hour on a tray. 

i have a a aiml script called hour and it has hour as a pattern.

put in the search Sheila bing rating= mature


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

by admin posted Oct 19 2018, 8:02
Looking at your bot, your greeting redirects to the question "script_hour" but you have no response for this.

In your script the pattern should be "script_hour" not "hour".

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2200, today: 2, week: 3, month: 6

by bobred posted Oct 19 2018, 9:30

thankyou that worked.


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

by bobred posted Oct 19 2018, 12:21

the redirect script does not work with the random tag.


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2181, today: 2, week: 4, month: 6

Id: 23866396
Etiquetas: programming
Publicado: Oct 3 2018, 19:06
Respuestas: 13
Vistas: 3957, hoy: 1, la semana: 4, mes: 17
0 0 0.0/5