Default weight|calyx|calyx238@gmail.com|1364303674|calyx|xx|0|146.90.223.55|When creating an interpreter instance, it would be nice to be able to specify a default weight to be applied to all triggers. For example:<br /><br />$rs-&gt;new(default_weight =&gt; 1);<br /><br />Then, in addition to applying a higher weight to triggers that you want to have higher matching priority, it is also possible to specify a weight lower than the default, for triggers that you want to have a lower matching priority.<br /><br />For example, I want to use this to match anything unknown, ending in &quot;lol&quot;, and return a smile:<br /><br />[code]<br />+ [*] @lol<br />- :-)[/code]<br /><br />I want this to be a low-priority trigger, and should be overriden by this:<br /><br />[code]<br />+ nice username [*]<br />- thanks!<br /><br />You&gt; nice username lol<br />Bot&gt; thanks![/code]<br /><br />To be sure of this, I must do:<br /><br />[code]<br />+ [*] @lol<br />- :-)<br /><br />+ &#123;weight=100&#125;nice username [*]<br />- thanks!<br /><br />+ &#123;weight=100&#125;nice weather [*]<br />- it is!<br /><br />+ &#123;weight=100&#125;nice place [*]<br />- yes[/code]<br /><br />But this is much more elegant:<br /><br />[code]<br />// default weight = 1<br />+ &#123;weight=0&#125;[*] @lol<br />- :-)<br /><br />+ nice username [*]<br />- thanks!<br /><br />+ nice weather [*]<br />- it is!<br /><br />+ nice place [*]<br />- yes[/code]||||
