Name?|Art|stoney535@gmail.com|1361273837|Art|xx|0|69.255.165.151|Is there a way to allow the bot to ask the user's name before anything else? &quot;Hi, User / Seeker / Undefined, What's your name?&quot;<br /><br />How would one caution the user about repeating the same input?<br /><br />Is there a method for the bot to be &quot;aware&quot; of the date and time?<br /><br />Thanks Noah!||||
Re: Name?|Kirsle|casey@cuvou.net|1361297901|Kirsle|xx|0|38.122.20.226|1. Yes, I do something like this with my bot: https://github.com/kirsle/aires-bot/tree/master/replies/aiden in begin.rs and aiden-welcome.rs. Basically:<br /><br />[code]&gt; begin<br />  + request<br />  - &lt;get met&gt; != true =&gt; &#123;topic=new_user&#125;&#123;ok&#125;<br />  - &#123;ok&#125;<br />&lt; begin<br /><br />&gt; topic new_user<br />  + *<br />  - Hello, user! What's your name?<br /><br />  + * * *<br />  % * what is your name<br />  - That's too much information. Just tell me your first name. What's your name?<br /><br />  + * *<br />  % * what is your name<br />  - I only need your first name. What's your name?<br /><br />  + *<br />  % * what is your name<br />  - &lt;set name=&lt;formal&gt;&gt;Nice to meet you, &lt;get name&gt;!&lt;set met=true&gt;&#123;topic=random&#125;<br />&lt; topic[/code]<br /><br />You could have it go into other topics to ask more questions of the user, i.e. the way SmarterChild did it.<br /><br />2. Using the &lt;input&gt; tags.<br /><br />[code]+ &lt;input1&gt;<br />* &lt;input1&gt; == &lt;input9&gt; =&gt; You're repeating yourself way too often.<br />* &lt;input1&gt; == &lt;input8&gt; =&gt; This is getting a bit old.<br />* &lt;input1&gt; == &lt;input7&gt; =&gt; You're quite annoying aren't you?<br />* &lt;input1&gt; == &lt;input6&gt; =&gt; Are you done yet?<br />* &lt;input1&gt; == &lt;input5&gt; =&gt; Five times in a row. Seriously?<br />* &lt;input1&gt; == &lt;input4&gt; =&gt; Don't you know how to say anything else?<br />* &lt;input1&gt; == &lt;input3&gt; =&gt; That's three times now!<br />* &lt;input1&gt; == &lt;input2&gt; =&gt; Now you've said the same thing twice!<br />- Didn't you just say that?[/code]<br /><br />&lt;input1&gt; is the thing the user just said before their current message, and &lt;input9&gt; is the thing they said 9 messages ago. So we have to check the conditions going from &lt;input9&gt; down to &lt;input2&gt; so the bot would run through all those replies from the bottom up when you keep repeating yourself, because conditions are checked from the top down and the first one that's true is the reply used.<br /><br />3. You can use the &quot;object macros&quot; to get the date/time.<br /><br />[code]// some examples...<br />&gt; object year perl<br />  my ($year) = (localtime)[5] + 1900;<br />  return $year;<br />&lt; object<br /><br />&gt; object month perl<br />  my ($month) = (localtime)[4] + 1;<br />  return $month;<br />&lt; object<br /><br />// gets you mm-dd formatted date<br />&gt; object date perl<br />  my @time = localtime();<br />  my $month = sprintf(&quot;%02d&quot;, $time[4] + 1);<br />  my $day = sprintf(&quot;%02d&quot;, $time[3]);<br />  return &quot;$month-$day&quot;;<br />&lt; object[/code]<br /><br />And then you can use them like:<br /><br />[code]+ hello<br />* &lt;call&gt;date&lt;/call&gt; == 12-25 =&gt; Hello, and Merry Christmas!<br />* &lt;call&gt;date&lt;/call&gt; == 01-01 =&gt; Happy new year!<br />- Hello there!<br /><br />+ what year is it<br />- It is the year &lt;call&gt;year&lt;/call&gt;!<br /><br />+ what month is it<br />- It is the month number &lt;call&gt;month&lt;/call&gt;.[/code]<br /><br />Substitute the Perl code for Python or JavaScript if you're using one of those implementations of RiveScript.||||
Re: Name?|Art|stoney535@gmail.com|1361310230|Art|xx|0|69.255.165.151|Thanks so much. That cleared up a lot of the fog for me!! Your timing, sir, is impeccable.<br /><br /> ;)||||
