(1.18 To-Do) Bug in comment processor|a2b|roy@wasystems.net|1221290997|a2b|xx|0|76.102.148.130 72.37.252.50 69.227.167.128|When attempting to set the default topic in the begin statement I found that the comments that came default in the file keep the topic from being set.<br /><br />&gt; begin<br />    + request # This trigger is tested first. <br />    - &#123;topic=intro&#125;&#123;ok&#125;    # An &#123;ok&#125; in the response means it's okay to get a real reply<br />&lt; begin<br /><br />Does not work, however<br /><br />&gt; begin<br />    + request<br />    - &#123;topic=intro&#125;&#123;ok&#125;  <br />&lt; begin<br /><br />does work.<br /><br />RiveScript 1.16||1222040351|Kirsle|
Re: (1.17 Verify Resolved) Bug in comment processor|a2b|roy@wasystems.net|1222038799|a2b|xx|0|76.102.148.130|Not resolved. &nbsp;It appears the comment on the first line (with &quot;request&quot;) is the one which causes the issue.<br /><br />Actually right before I went to press Post I realized that the comment starts with # which is also a numeric pattern mach. I guess that was kind of obvious lol. Perhaps documentation should always use // instead.<br /><br />This works just fine: <br /><br />[code]<br />&gt; begin<br /> &nbsp; + request // This trigger is tested first.<br /> &nbsp; - &#123;topic=intro&#125;&#123;ok&#125; &nbsp; &nbsp;// An &nbsp;in the response means it's okay to get a real reply<br />&lt; begin<br />[/code]<br /><br />Although I did find a new bug when testing that. &nbsp;If you use &quot;//A&quot; rather than &quot;// A&quot; &nbsp;it becomes apart of everything response. &nbsp;I do not know if this is a comment issue module wide, or just when it is on the same line as a response.<br />||||
Re: (1.17 Verify Resolved) Bug in comment processor|a2b|roy@wasystems.net|1222040021|a2b|xx|0|76.102.148.130|Furthermore, you should never set topic in begin as it is called on every single reply request correct? ||||
Re: (1.17 Verify Resolved) Bug in comment processor|Kirsle|casey@cuvou.net|1222040045|Kirsle|xx|0|69.227.167.128|Ah. I prolly should've updated this thread to tell ya how I resolved it.<br /><br />I updated the working draft with a new explanation for how to use inline comments.<br /><br />[quote]# COMMENT<br /><br />The # command is for putting comments into your RiveScript document. The C-style // and /* */ syntax is also supported for commenting.<br /><br />Comments on their own line should be ignored by all interpreters. Inline comments (comments next to RiveScript commands) should be ignored only if the comment symbol is not touching the text of the RiveScript command. There should be at least one space before the # or // command.<br /><br />Of special note, if the # comment character is to be used inline next to a + trigger, there should be two spaces before the # symbol to avoid interpreter confusion, since # is also a wildcard symbol in triggers.<br /><br />[code]  Bad:<br />  + request # This trigger is tested first<br />  Good:<br />  + request  # This trigger is tested first (2 spaces before, 1+ space(s) after)<br />  + request // This trigger is tested first (only 1 space is needed for // syntax)[/code]<br /><br />To explicitely use the characters # or // in a RiveScript command, you must escape them with a \. Example: \# or \//.[/quote]<br /><br />Some things I should update though:<br /><br />[list][*]The two // characters are highly unlikely to exist as a legitimate part of code, so these should always signify an inline comment (which could be negated with \// or /\/ or \/\/, etc).<br />[*]There has to be a white space before AND after the comment symbols for it to work, but the WD doesn't say that.<br />[*]Maybe the WD should emphasize that // should be the primary comment syntax, with # an optional alternative (or try to weed out # altogether by having interpreters treat them as comments but vociferously complain every time they have to do it, until nobody uses it anymore).<br />[/list]||||
Re: (1.17 Verify Resolved) Bug in comment processor|Kirsle|casey@cuvou.net|1222040292|Kirsle|xx|0|69.227.167.128|[quote author=2B78284A0 link=1221290997/0#2 date=1222040021]Furthermore, you should never set topic in begin as it is called on every single reply request correct? [/quote]<br /><br />That's right. You [i]can[/i] use &#123;topic&#125; but only if ya do it correctly, i.e.<br /><br />[code]&gt; begin<br />   + request<br />   * &lt;get intro&gt; == undefined =&gt; &lt;set intro=1&gt;&#123;topic=intro&#125;&#123;ok&#125;<br />   - &#123;ok&#125;<br />&lt; begin<br /><br />&gt; topic intro<br />   + *<br />   - Nice to meet you. I am &lt;bot name&gt;. What's your name?<br /><br />   + *<br />   % * what is your name<br />   - &#123;topic=intro2&#125;&lt;set name=&lt;formal&gt;&gt;Nice to meet you. Are you a boy or a girl?<br />&lt; topic intro<br /><br />&gt; topic intro2<br />   // etc...<br />&lt; topic[/code]||||
