Hi GroG,

I am trying to get this to work;

def killtime():
    for y in range(0,15):
        
        if (data == "stop"):    # this the that is not working
            stop()
        x = (random.randint(1,10))
        if x == 1:
           knocktoby()

 

           sleep(60)

           ...........

I have put this further put in my script

def heard(data):

         global lastHeard

         lastHeard = data

This is a spin on Markus's "Break"

 

Thanks

GroG

9 years 5 months ago

replace all "data" with the global lastHeard in this method
 
def killtime():
    global lastHeard
    for y in range(0,15):
        
        if (lastHeard == "stop"):   
            stop()
        x = (random.randint(1,10))
        if x == 1:
           knocktoby()
 
 
           sleep(60)