4

The Task: It is planning that Nao should ask humans some questions and give answer variants. The people should give one answer variant per question but after every five question, Nao should say: Ok, you answered on 5 questions and gave 3 correct and 2 incorrect answers. Please, try again.

The realization: The questions and answer variants are realized in the Choreography Dialog but I can't understand how can I call the variable from Python script in the Dialog.

I call the calculated variable in Dialog (QiChat) like this:

topic: ~addition() 
language: enu 
u:([c]) Yes, it's the correct answer. 
%script 
p=+1 
%script

But how in such case to do that the value of the variable should be understood by QiChat and nao will say the value of variables?

This example nao can't say, it will be missing during dialog.

%script
print p
%script

Such approach to connect dialog and python script doesn't work:

$cnt = %script p %script
Andy K
  • 4,944
  • 10
  • 53
  • 82
  • 1
    Hi! Welcome to stackOverflow! As you might have noticed, your question is totally unreadable. You need to add paragraphs (empty lines) to structure your text logically, and you need to use code formatting for code. Eliminate all unnecessary phrases (the "please help" and "thank you", for example), since these only distract from the question. – Marcus Müller Oct 07 '17 at 09:26
  • 2
    That sounds like a homework. Nobody here likes to solve somebody's homework. – Mikaelblomkvistsson Oct 07 '17 at 10:27
  • Thanks, I added the formatting. Bad idea to ask a question without any task explanation – Darya Lashkevich Oct 07 '17 at 12:48

1 Answers1

0

Here is a dialog-service template that has dialog linked to some python code; see in the .top file for how to call the Python or get info from it:

u:(set {the} counter [to at] _~numbers)
    setting counter to $1
    ^call(ALMyService.set($1))

u:(["check counter" "what is the counter?"])
    So, ^call(ALMyService.get())
        c1:(_*) the counter is $1 

(this assumes your Python is running in a service; an example of that is also included in that template)

Emile
  • 2,946
  • 2
  • 19
  • 22