AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Functions outside rule
 
 

Is it possible to execute functions outside of a rule in a topic? For example, if some keyword or response triggered the Relationships randomized topic file I would like to know if the user’s gender has been determined, if not do so, before responding or gambiting anything in the topic. Currently, I dont see a way to do this without testing this in each rule of the topic.

 

 
  [ # 1 ]

Maybe something like:

u:(!$gender) Are you a guy or girl?
              a: (guy) $gender=male
              a: (girl) $gender=female

at the beginning of the topic file?

Would that automatically always run once upon entry and then fail based on the pattern?

 

 
  [ # 2 ]

as first gambit in topic do

t: (!$gender) keep() end(TOPIC)

 

 
  [ # 3 ]

But would that wouldn’t be sure to run first for a randomized topic file right?

 

 
  [ # 4 ]

Actually I guess you could use 1 t: and all the rest r: gambits

But what if the topic was triggered by a ? s or u rule?

 

 
  [ # 5 ]

I dont see a way to do it without entering a custom macro for each rule

 

 
  [ # 6 ]

you are correct that for a random topic it doesnt work. And you cant do 1 r: and then a bunch of t:..
but you could NEST this topic within a different topic that was gated with the exclusion rule

t: (!$gender) keep() END(TOPIC)
t: ^keep() gambit(~nestedtopic)

 

 
  [ # 7 ]
Bruce Wilcox - Oct 22, 2014:

And you cant do 1 r: and then a bunch of t:..

Actually I said 1 t: and then a bunch of r:

Wouldn’t that work?

 

 
  [ # 8 ]

probably not. system has to clear out the t to move on

 

 
  [ # 9 ]

Right! So have the gender setting gambit as t: and all other gambits as r: Like

topic : ~relationships keep (date single boyfriend girlfriend)

t: (!$genderAre you a guy or girl?
                   
a:(~male$gender=male
                   a
:(~female$gender=female 

followed by r: s: and ?: rules

 

 
  [ # 10 ]

Yes. If the first rule in a topic is a gambit (in a topic not marked random), then it will try that and any other initial gambits. Once it finds an r:, it will then shift to randomly selecting the r:‘s.

 

 
  login or register to react
‹‹ Canonical forms      Defining global macros ››