Hi,
I’m new to the forums and new to using ChatScript.
I believe that I’ve found a bug in that a rule seems to ignore the noerase() and repeat() commands if that rule contains a analyze call.
A simple example is :
topic: ~TalkFood (~food ~eat )
u: (~eat much _*)^noerase() ^repeat() ^analyze (_0) yes you eat a lot
#u: (~eat much _*)^noerase() ^repeat() ^analyze (_0) yes you eat a lot
The active rule will only get fired once and then it will never be called again. At first I thought the analze call must be failing after the first time, but I’ve ran the program under a debugger and the analyzecode method is only being called the first time and then is never called again.
If you uncomment the second rule then that also can be called once. Lastly just to confirm that it seems to be either the noerase or repeat call that isn’t working, if you add noerase and repeat to the topic then the rules can be called repeatedly.
Also is there anyway to check if a string variable contains another string. I don’t mean equal but if the variable was a sentence then I want to check if it contains a word or two. The only way I can see at the moment is to use the analyze method and then call respond on a topic that tries to match the search string and sets another variable if it finds it. It works but it seems that a simple string contain function would be better at least for simple searches. I’ve started to look how to add another function call to the source code but I’m only just starting to find my way around it. Is there anything more required for the scripts to be able to call it, than adding the details of the new method to systemFunctionSet ?