Feature Suggestion - Topic Inclusion|a2b|roy@wasystems.net|1221621107|a2b|xx|0|76.102.148.130|It would be nice if there were a way to include a topic inside another topic. &nbsp;If I have topic A and topic B but I want a few of the same replies in both then I could put them in topic C and include them in A and B. &nbsp;<br /><br />I think topics are important to creating a better AI however, maintaining the same phrases over multiple topics is cumbersome. &nbsp;<br /><br /><br />P.S. I will verify those fixes in 1.17 later this week.||||
Re: Feature Suggestion - Topic Inclusion|Kirsle|casey@cuvou.net|1222033371|Kirsle|xx|0|69.227.167.128|A while back I was thinking of making a game engine in Perl (with Tk probably) for a graphical text-based adventure game, like [url=http://www.adventureclassicgaming.com/index.php/site/reviews/86/]Frederik Pohl's Gateway[/url]). It would need to have certain triggers (like the mandatory &quot;fsck you&quot; that all text-based games have) that are available no matter what part of the game you're at, then certain triggers that are available globally for the &quot;chapter&quot; you're at, then ones that are specific to the room you're in.<br /><br />I think something like this could be implemented by adding extra fields to the topic constructors...<br /><br />[code]&gt; topic mytopic inherits anothertopic[/code]<br /><br />So in a Gateway-like game kind of example:<br /><br />[code]&gt; topic universe<br /> + help<br /> - &lt;call&gt;help&lt;/call&gt;<br /><br /> + inventory<br /> - &lt;call&gt;inventory&lt;/call&gt;<br /><br />  // Taking an object that doesn't exist<br />  + take *<br />  - There is no &quot;&lt;star&gt;&quot; in this area to be taken.<br />&lt; topic<br /><br />// global triggers while on planet earth<br />&gt; topic earth inherits universe<br />  + put on astronaut suit<br />  - You don't need to put on an astronaut suit on Earth.<br />&lt; topic<br /><br />// triggers for a specific room on earth<br />// that contains a tuning fork item<br />&gt; topic room_with_tuning_fork inherits earth<br />  // This would override &quot;take *&quot; from universe<br />  // because this is a better match.<br />  + take tuning fork<br />  - &lt;call&gt;take tuning fork&lt;/call&gt;You have picked up the tuning fork.<br /><br />  + north<br />  - &#123;topic=another_room&#125;&#123;@describe room&#125;<br />&lt; topic[/code]<br /><br />Something like that would work... it would maintain backwards compatibility (a simple &quot;&gt; topic sometopic&quot; wouldn't inherit the triggers of any other topics), and a topic that inherits another topic could just load a kind of reference to the other topic so that it doesn't have to duplicate all the triggers.<br /><br />&quot;&gt; topic something inherits random&quot; would inherit all the triggers that don't have topics on them.<br /><br />[i](oh wow, I just discovered that YaBB lets you resize the text box on the post screen by dragging the bottom and right edges)[/i]<br /><br />[s][on a side note, &quot;&#123;topic=another_room&#125;&#123;@describe room&#125;&quot; wouldn't work, because[/s] actually, before stating that as fact I double checked the trigger order in RiveScript::WD and found out that it does in fact work. :)<br /><br />[code]+ test topic1<br />- &#123;topic=topic1&#125;You are now in topic1.<br /><br />&gt; topic topic1<br />  + *<br />  - You're currently in topic1.<br /><br />  + test topic2<br />  - Moving you to topic2.&#123;topic=topic2&#125;&#123;@trigger in topic2&#125;<br />&lt; topic<br /><br />&gt; topic topic2<br />  + *<br />  - You're currently in topic2.<br /><br />  + trigger in topic2<br />  - This is the test trigger in topic2.<br /><br />  + break<br />  - &#123;topic=random&#125;You're done with the tests.<br />&lt; topic[/code]<br /><br />[code]You&gt; hello<br />Bot&gt; Hi. What seems to be your problem?<br />You&gt; test topic1<br />Bot&gt; You are now in topic1.<br />You&gt; k<br />Bot&gt; You're currently in topic1.<br />You&gt; test topic2<br />Bot&gt; Moving you to topic2.This is the test trigger in topic2.<br />You&gt; k<br />Bot&gt; You're currently in topic2.<br />You&gt; break<br />Bot&gt; You're done with the tests.<br />You&gt; k<br />Bot&gt; I'm not sure I understand you fully.[/code]<br /><br />[b]UPDATE:[/b] I've implemented this change. There's a patch to upgrade RS 1.17 to 1.17.1 which has this functionality.<br /><br />http://www.rivescript.com/yabb2/YaBB.pl?num=1222037177||1222037247|Kirsle|
Re: Feature Suggestion - Topic Inclusion|a2b|roy@wasystems.net|1222037611|a2b|xx|0|76.102.148.130|Great work! &nbsp;Can you inherit more than one topic?||||
Re: Feature Suggestion - Topic Inclusion|Kirsle|casey@cuvou.net|1222037922|Kirsle|xx|0|69.227.167.128|[quote author=782B7B190 link=1221621108/0#2 date=1222037611]Great work! Can you inherit more than one topic?[/quote]<br /><br />Not presently. You mean like &quot;&gt; topic alpha inherits beta,charlie,delta&quot;? That isn't supported yet (but a topic can inherit a topic which inherits another topic).<br /><br />[b]Update:[/b]<br /><br />I've made a new patch on the above linked thread that supports inheriting multiple topics. The syntax goes like e.g.:<br /><br />[code]&gt; topic earth inherits global easter[/code]<br /><br />I imagine there might be some bugs with this though. If one topic inherits two other topics, and each of the other two topics has an identical trigger, it would be unpredictable which trigger would actually be activated by the user's message. Well, I had the code sort the inheritance alphanumerically, so that it would at least be predictable which one wins... but i.e.<br /><br />[code]&gt; topic alpha<br /> &nbsp; + my test<br /> &nbsp; - This was matched in topic alpha.<br />&lt; topic<br /><br />&gt; topic beta<br /> &nbsp; + my test<br /> &nbsp; - This was matched in topic beta.<br />&lt; topic<br /><br />&gt; topic gamma inherits alpha beta<br /> &nbsp; + hello<br /> &nbsp; - Hello world.<br />&lt; topic[/code]<br /><br />If the user's topic was beta, and beta inherits alpha, then &quot;my test&quot; would get beta's response because beta has a &quot;local trigger&quot; for it. If the topic was alpha, and alpha inherited beta, then alpha's &quot;my test&quot; matches because alpha has a local copy.<br /><br />So if the local topic has a trigger that matches that of an inherited topic, the local trigger wins. But, in the case of our &quot;gamma&quot; topic there, which inherits both alpha and beta but doesn't have a &quot;my test&quot; trigger of its own... who's to say which of the two inherited topics should &quot;my test&quot; be pulled from?<br /><br />Currently alpha would win because it's alphanumerically higher than beta.<br /><br />This is the only foreseeable issue I can see for now that might arise from having multiple inheritances. In a situation like this, I'd recommend to either copy the preferred trigger into the local topic, or create a daisy chain of topics, i.e. gamma would inherit beta who inherits alpha, instead of gamma inheriting both topics.<br /><br />If you find other ways to break it, let me know.||1222039510|Kirsle|
Re: Feature Suggestion - Topic Inclusion|a2b|roy@wasystems.net|1222039388|a2b|xx|0|76.102.148.130|Oh okay||||
