I cant get tmy var to work [SOLVED]

 

 
var = 10
 
##############################
 
ear.addCommand("plus one", "python", "plusone")
ear.addCommand("minus one", "python", "minusone")
ear.addCommand("what's the value", "python", "thevalue")
 
##############################
 
 
def plusone():
    mouth.speak("plus one")
    var += 1
 
def minusone():
    mouth.speak("minus one")
    var -= 1
 
def thevalue():
    mouth.speak("the value is" + str(var))
Markus's picture

this is  in my Inmoov script

this is  in my Inmoov script

Alessandruino's picture

Write global var at the begin

Write global var at the begin of every function:

Example :

def example():
global var
var +=1
print var

GroG's picture

o/ Nice Ale !

o/

Nice Ale !

Alessandruino's picture

\o yeah

\o yeah

Alessandruino's picture

Remember the spaces too...i m

Remember the spaces too...i m at phone and I can t add them

Markus's picture

ok!  

ok!