j'ai un problème avec ma variable, quoi que je tente elle reste a 0 alors je ne sais pas comment règle mon problème.
Je dois mal initialise mal ma variable sois je la modifie pas correctement pouvez vous m'aider je vous fait une copie de mon code lua.
je n'est aucune erreur et le code me renvoie toujours 0 pour compteur.
si je clic sur 25 le code s’exécute mais la variable reste a 0 donc le reste ne fonctionne pas
merci par avance
Code : Tout sélectionner
commandArray = {}
compteur = 0
print (compteur)
if (devicechanged['rideau gauche'] == '0') then
if (compteur == 0) then
commandArray ['rideau gauche'] = 'Off'
print (compteur)
elseif (compteur == 25) then
commandArray[1]={['rideau gauche up']='On'}
commandArray[2]={['rideau gauche up']='Off AFTER 5'}
print (compteur)
elseif (compteur == 50) then
commandArray[1]={['rideau gauche up']='On'}
commandArray[2]={['rideau gauche up']='Off AFTER 50'}
print (compteur)
elseif (compteur == 75) then
commandArray[1]={['rideau gauche up']='On'}
commandArray[2]={['rideau gauche up']='Off AFTER 75'}
print (compteur)
elseif (compteur == 100) then
commandArray[1]={['rideau gauche up']='On'}
commandArray[2]={['rideau gauche up']='Off AFTER 100'}
print (compteur)
end
compteur = 0
elseif (devicechanged['rideau gauche'] == '25') then
if (compteur == 0) then
commandArray[1]={['rideau gauche down']='On'}
commandArray[2]={['rideau gauche down']='Off AFTER 5'}
elseif (compteur == 25) then
commandArray ['rideau gauche'] = 'Off'
elseif (compteur == 50) then
commandArray[1]={['rideau gauche up']='On'}
commandArray[2]={['rideau gauche up']='Off AFTER 25'}
elseif (compteur == 75) then
commandArray[1]={['rideau gauche up']='On'}
commandArray[2]={['rideau gauche up']='Off AFTER 50'}
elseif (compteur == 100) then
commandArray[1]={['rideau gauche up']='On'}
commandArray[2]={['rideau gauche up']='Off AFTER 75'}
end
compteur = 25
elseif (devicechanged['rideau gauche'] == '50') then
if (compteur == 0) then
commandArray[1]={['rideau gauche down']='On'}
commandArray[2]={['rideau gauche down']='Off AFTER 50'}
elseif (compteur == 25) then
commandArray[1]={['rideau gauche down']='On'}
commandArray[2]={['rideau gauche down']='Off AFTER 25'}
elseif (compteur == 50) then
commandArray ['rideau gauche'] = 'Off'
elseif (compteur == 75) then
commandArray[1]={['rideau gauche up']='On'}
commandArray[2]={['rideau gauche up']='Off AFTER 25'}
elseif (compteur == 100) then
commandArray[1]={['rideau gauche up']='On'}
commandArray[2]={['rideau gauche up']='Off AFTER 50'}
end
compteur = 50
elseif (devicechanged['rideau gauche'] == '75') then
if (compteur == 0) then
commandArray[1]={['rideau gauche down']='On'}
commandArray[2]={['rideau gauche down']='Off AFTER 75'}
elseif (compteur == 25) then
commandArray[1]={['rideau gauche down']='On'}
commandArray[2]={['rideau gauche down']='Off AFTER 50'}
elseif (compteur == 50) then
commandArray[1]={['rideau gauche down']='On'}
commandArray[2]={['rideau gauche down']='Off AFTER 25'}
elseif (compteur == 75) then
commandArray ['rideau gauche'] = 'Off'
elseif (compteur == 100) then
commandArray[1]={['rideau gauche up']='On'}
commandArray[2]={['rideau gauche up']='Off AFTER 25'}
end
compteur = 75
elseif (devicechanged['rideau gauche'] == '100') then
if (compteur == 0) then
commandArray[1]={['rideau gauche down']='On'}
commandArray[2]={['rideau gauche down']='Off AFTER 100'}
elseif (compteur == 25) then
commandArray[1]={['rideau gauche down']='On'}
commandArray[2]={['rideau gauche down']='Off AFTER 75'}
elseif (compteur == 50) then
commandArray[1]={['rideau gauche down']='On'}
commandArray[2]={['rideau gauche down']='Off AFTER 50'}
elseif (compteur == 75) then
commandArray[1]={['rideau gauche down']='On'}
commandArray[2]={['rideau gauche down']='Off AFTER 25'}
elseif (compteur == 100) then
commandArray ['rideau gauche'] = 'Off'
end
compteur = 100
end
return commandArray