[pandorabots-general] Javascript or Arrays in AIML

Anne Kootstra anne at aiml.info
Tue Feb 15 11:09:50 PST 2005


I think you should take a closer look at stack.aiml. To me it seems it does
do what you want. Just take out:

<srai>RANDOM TOPIC</srai>

And the RANDOM TOPIC category and it should do what you aim to do.

However, you are right that this will always be a fixed length stack.
Variable stacks is something that AIML is equipped with.

As ever,

Anne Kootstra
Founding Member AIML.info, Main developer Program E
http://www.aiml.info	   http://sourceforge.net/projects/programe

e-mail & msn messenger:	
anne at aiml.info
 
> -----Oorspronkelijk bericht-----
> Van: Brooks Boyd [mailto:boydb at midnightdesignhq.com]
> Verzonden: dinsdag 15 februari 2005 17:18
> Aan: pandorabots-general at list.pandorabots.com
> Onderwerp: [pandorabots-general] Javascript or Arrays in AIML
> 
> I'm trying to make an advanced Stacking category to facilitate my AIML bot
> being
> able to emulate the 1970s ELIZA program. The ELIZA program has a memory
> stacking
> feature that saves some conversation information for future use. But the
> memory
> list is a varying length array.
> 
> So, I'm looking for help in the syntax of adding in a Javascript script
> that
> does the array work (since I don't think AIML can do arrays), and output
> them
> to the proper <set>s something like this:
> 
> <category>
> <pattern>MEMPUSH *</pattern> <!-- add * to the memory stack -->
> <template>
> 
> Javascript:
> <get name="memone"/> = var $memory[1];
> <get name="memtwo"/> = var $memory[2];
> <get name="memthree"/> = var $memory[3];
> ...
> <get name="memten"/> = var $memory[10];
> Find the first empty slot, and fill it with *, or if none exist, shift the
> whole
> array up and add * to the bottom.
> <set name="memone"/>$memory[1]</set>
> <set name="memtwo"/>$memory[2]</set>
> <set name="memthree"/>$memory[3]</set>
> ...
> <set name="memten"/>$memory[10]</set>
> </template>
> </category>
> 
> The next category can be done with all AIML I think:
> <category><pattern>MEMPOP</pattern> <!-- Use a memory item -->
> <template><get name="memone"/>
> <think>
> <set name="memone"><get name="memtwo"/></set>
> <set name="memtwo"><get name="memthree"/></set>
> <set name="memthree"><get name="memfour"/></set>
> ...
> <set name="memten"/>
> </think>
> </template>
> </category>
> 
> Does anyone know a way to do that first category without resorting to
> Javascript? I looked at Alice's stack.aiml, but that one seems to always
> have
> the same number of items in it, and I still can't figure out how it's
> filled
> for the first use with random topics.
> _______________________________________________
> 




More information about the pandorabots-general mailing list