bhouston

10 years 1 month ago

Thanks Markus, this is what I have been looking for. I'll test it out when I get my InMoov up and running again I'm installing the Top Stomach.

bhouston

10 years 1 month ago

I've been trying to implement your script.  Do you have  "Break" defined somewhere in your script?

OK I got it working.

Here's how I have mine set up

In 'ear.startListening" I have  "can i have your attention" and "stop"

then I have the following for each one;

if (data == "can i have your attention"):

        stop()
 
    if (data == "stop"):
        stop()
 
My 'stop" command is;
 
def stop():
    rest()
    sleep(2)
    i01.mouth.speak("yes")
    if (data == "break"):
        i01.mouth.speak("yes")
 
In my random.randint script I have;
 
def killtime():
    global lastHeard
    for y in range(0,15):
        
        if (lastHeard == "can i have your attention"):
            stop()
        x = (random.randint(1,10))
        if x == 1:
           knocktoby()
           sleep(60)
        if x == 2:
           lookleft()
           sleep(3)
           lookforward()
           sleep(40)
        if x == 3:
           i01.mouth.speak("hey let's do something fun")
           sleep(60)
 
At the very beginning of the script is  lastHeard =""
 
I have found that the 'stop' command needs to be given first, then the 'can I have your attention' command.
 
It's probably obvious but I'll note it here anyways, this type of command will have to be put at the beginning of any script you may want to stop while it is in progress.
 
Thanks again Markus
 

Markus

10 years 1 month ago

In reply to by bhouston

You need to have the if (data == "can i have your attention"):
In the program that you want to stop.