'Undefined' in replies...

Help
2002-08-05
2013-04-25
  • dave devitry

    dave devitry - 2002-08-05

    I can't figure out where the default variables are set. Things like the user's name, age, etc come out as
    'Undefined' in replies.   In addition, even after telling the bot what my name is, the variable still remains Undefined in future replies.   How do I fix that???

     
    • tanoshimi

      tanoshimi - 2005-09-25

      Not sure whether you mean default variables or default values, so I've got two possible answers...

      1.) Default variables relate to properties of the bot, and not to the user. These are all declared in the <bot> section near the top of startup.xml.
      You can then use these in pattern-side or template-side matching by using the syntax:
      <bot name="name" />, <bot name="gender" /> etc.

      2.) The default value for all user properties which haven't been defined is in dbprefs.php in the following line:
      define("DEFAULTPREDICATEVALUE", "undefined");
      If you try to use <get name="name"> for any variable which hasn't been set, this is what will return.

       
    • Alex Linthicum

      Alex Linthicum - 2008-08-21

      Just learned something interesting about defining predicates (my apologies if this is common knowledge). If you use think/set tags in conjunction with a srai tag, the think/set tags have to come BEFORE the srai tag.

      For example this fails to set the predicate 'mode' (UNDEFINED is returned when using get):

      <category>
      <pattern>JUMP *</pattern>
      <template>
      <srai>JUMP</srai>
      <think><set name="mode">jump</set></think>
      </template>
      </category>

      This correctly sets the predicate 'mode':

      <category>
      <pattern>JUMP *</pattern>
      <template>
      <think><set name="mode">jump</set></think>
      <srai>JUMP</srai>
      </template>
      </category>

      Hope this helps someone.

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks