[alicebot-general] Setting predicates to value of a variable

Dirk Scheuring scheuring at lycos.com
Tue May 2 00:33:50 PDT 2006


Alan Haymes wrote:

> It is a pity that I can't do things the other way round, i.e. store the
> value of variables into predicates - this would enable my bot to have a
> memory and engage my clients imagination when they returned some time later
> to have another dialogue.

Since I still don't understand what your problem is, but would like to, I have to ask . . .

The following <template> works for me (using Chariebot 4.1.8):

<template>
 <think>
  <set name="current_time">
   <javascript>
    <![CDATA[
     var now = new java.util.Date()
     var hour = now.getHours()
     var minute = now.getMinutes()
     now = null
     var ampm = ""
      if (hour >= 12) {
       hour -= 12
       ampm = "PM"
      } else
       ampm = "AM"
     hour = (hour == 0) ? 12 : hour
     if (minute < 10)
       minute = "0" + minute 
     hour + ":" + minute + " " + ampm;
    ]]>
   </javascript>
  </set>
 </think>
</template>

It properly puts the current time into the predicate name="current_time", so that other templates can use it. What else do you need?

Dirk

-- 
_______________________________________________

Search for businesses by name, location, or phone number.  -Lycos Yellow Pages

http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.asp?SRC=lycos10



More information about the alicebot-general mailing list