Download the open source Bot Libre Community Edition and install Bot Libre on your own server
Bot Libre Forum

chatbot is not saying the correct time

by bobred posted Jun 27 2018, 12:40

pioyu2 chatbot is not telling me the correct time.here is the aiml script I am using.timer time.txt


by admin posted Jun 28 2018, 7:31
What response do you get from the bot, and what response do you expect?

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2162, today: 0, week: 0, month: 31

by bobred posted Jun 28 2018, 9:05

i want pioyu2 chatbot to say the time in texas it is currently.

it's response to the question what time it is is the locale time is:9: AM. when it is actually 7 am.


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2093, today: 0, week: 0, month: 32

by admin posted Jul 3 2018, 11:09

The local is not the timezone, it just affects how the date is printed.

To set the timezone of the date use the "timezone" attribute set to the GMT hour offset.

<date format="%I: %p" timezone="+2" locale="en_US"/>

You can also use Self to print a date, even from AIML,

<template>The local time is: <self>Date.setTimeZone(Date.time(), "EST")</self></template>

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 2218, today: 0, week: 0, month: 36

by tpranara posted Jul 1 2020, 8:16

Is there support for (GMT+9.30). Often there is only support for whole numbers. Adelaide, Australia is between +9 and +10. Since the bot I am making is only for myself, it defeats the purpose of time if It can only give me the time in Perth, or Melbourne, or Sydney, or Canberra.

 

Pranara.


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 1776, today: 1, week: 1, month: 54

by admin posted Jul 1 2020, 19:06
You can use the Self code,

Date.setTimeZone(Date.time(), "GMT+9:30")

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 1682, today: 1, week: 1, month: 39

by tpranara posted Jul 2 2020, 0:32

This is still not working.

Code.jpg

 

Response.jpg

 

My bot was built using the basic template, but I deleted most of the self scripts as I was wanting NOTHING to over ride my aiml files. I was going to keep the DateAndTime script but since that was not giving the outputs I want, I deleted that too.

 

This is my AIML file, and I want every iota of it to work, without some other 'not by me' defined response given. I was testing this script yesterday without any changes, and with the DateAndTime self script in; even though it was giving me a non Australian country, and I was sure greetings were being given that was not in my aiml script. Do I have to delete EVERY self script to ensure only my aiml categories are used are used?

 

Currently these are the only self scripts I have running:

 

active scripts.jpg

 

My AIML script. I have commented out most of it, for testing purposes, but I do want it to ALL work.

 

salutations.self.txt

 

This was originally an aiml file. Why was it changed when I exported it?


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 1552, today: 0, week: 0, month: 36

by tpranara posted Jul 2 2020, 3:09

I finally found where all these erroneous reponses were coming from: training and chatlogs.

After some more testing, I removed my commented out code from salutaitons.aiml and tried again, now that training and chatlogs were no longer interfering with my responses.

 

Problem now is, Adelaide is supposed to be GMT+9:30, but that was still giving me the wrong time, a whole hour fast. So I fixed the problem with +8:30. It works, but it is still wrong as it's not +9:30.  Putting in GMT+9:30 didn't help.

 

<category>
<pattern>What time is it</pattern>
<template>
<random>
<li>The time is currently </li>
<li>It is currently </li>
<li>The time is </li>
<li>It is </li>
<li>Its </li>
</random>
<date timezone="+8:30" format="%I:%M%p"/> right now.
</template>
</category>

 

I tried using Date.setTimeZone(Date.time(), "GMT+9:30") but it seems that can't used as a replacement for <date timezone="+8:30" format="%I:%M%p"/>, as it was assumed that I knew how to use it.

Any insight in why +9:30 was producing wrong time 5:1PM instead of 4:1PM?

 


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 1637, today: 2, week: 2, month: 45

by admin posted Jul 2 2020, 10:53

The issue seems to be with the format="%I".
For some reason we were adding 1 to the hour. We will update this.
If you use Self, jformat or format="%X" it will have the correct hour.

<aiml>
<category>
<pattern>time</pattern>
<template><date timezone="+4" format="%I:%M%p"/> -- <date timezone="+4" format="%X"/> -- <self>Date.setTimeZone(Date.time(), "GMT+4")</self></template>
</category>
</aiml>


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 1607, today: 1, week: 1, month: 37

Id: 22624204
Tags: aiml
Posted: Jun 27 2018, 12:40
Replies: 8
Views: 3696, today: 1, week: 1, month: 105
0 0 0.0/5