Skip to main content
Tweeted twitter.com/StackBlender/status/670663967174471680
deleted 36 characters in body
Source Link
David
  • 49.7k
  • 40
  • 162
  • 318

first of all, happy new year!

I "try"I'm trying to make an inventory with 4 cells or more and 2 various items or more...

enter image description here

I want to check if the variable x is set to False. If so, then the cell1() function should be x set to True. The idea is if x is True then nothing should be collected. In principle, should represent x if the cell is empty or full. My problem is that x is always "False" after the function has finished??? Why does it work in Python but not in Blender?

x = "False"

def xReplace(value):
    global x
    x = value
    

def cell1():    
    if sens.positive and x == "False": # sens= message sensor
        var()                          # var()= function update text in cell1/ or end object
        xReplace("True")               # "change the value from global variable x"
        
    elif sens.positive and x == "True": 
        var2()                         # var2()= function update/set in cell2
               
cell1()
print(x)

console prints

True
False

I do not understand why it prints variable x twice, and why is the second line False? I think Blender makes two variables of the same name.? Because when I write print (x == x) then comes twice True. Why does the Blender in this way? Or is there another way to do it.

first of all, happy new year!

I "try" to make an inventory with 4 cells or more and 2 various items or more...

enter image description here

I want to check if the variable x is set to False. If so, then the cell1() function should be x set to True. The idea is if x is True then nothing should be collected. In principle, should represent x if the cell is empty or full. My problem is that x is always "False" after the function has finished??? Why does it work in Python but not in Blender?

x = "False"

def xReplace(value):
    global x
    x = value
    

def cell1():    
    if sens.positive and x == "False": # sens= message sensor
        var()                          # var()= function update text in cell1/ or end object
        xReplace("True")               # "change the value from global variable x"
        
    elif sens.positive and x == "True": 
        var2()                         # var2()= function update/set in cell2
               
cell1()
print(x)

console prints

True
False

I do not understand why it prints variable x twice, and why is the second line False? I think Blender makes two variables of the same name.? Because when I write print (x == x) then comes twice True. Why does the Blender in this way? Or is there another way to do it.

I'm trying to make an inventory with 4 cells or more and 2 various items or more.

enter image description here

I want to check if the variable x is set to False. If so, then the cell1() function should be x set to True. The idea is if x is True then nothing should be collected. In principle, should represent x if the cell is empty or full. My problem is that x is always "False" after the function has finished??? Why does it work in Python but not in Blender?

x = "False"

def xReplace(value):
    global x
    x = value
    

def cell1():    
    if sens.positive and x == "False": # sens= message sensor
        var()                          # var()= function update text in cell1/ or end object
        xReplace("True")               # "change the value from global variable x"
        
    elif sens.positive and x == "True": 
        var2()                         # var2()= function update/set in cell2
               
cell1()
print(x)

console prints

True
False

I do not understand why it prints variable x twice, and why is the second line False? I think Blender makes two variables of the same name.? Because when I write print (x == x) then comes twice True. Why does the Blender in this way? Or is there another way to do it.

added 19 characters in body
Source Link
Anunaki
  • 41
  • 1
  • 1
  • 5

first of all, happy new year!

I "try" to make an inventory with 4 cells or more and 2 various items or more...

like thisenter image description here

I want to check if the variable x is set to False. If so, then the cell1() function should be x set to True. The idea is if x is True then nothing should be collected. In principle, should represent x if the cell is empty or full. My problem is that x is always "False" after the function has finished??? Why does it work in Python but not in Blender?

x = "False"

def xReplace(value):
    global x
    x = value
    

def cell1():    
    if sens.positive and x == "False": # sens= message sensor
        var()                          # var()= function update text in cell1/ or end object
        xReplace("True")               # "change the value from global variable x"
        
    elif sens.positive and x == "True": 
        var2()                         # var2()= function update/set in cell2
               
cell1()
print(x)

console prints

True
False

I do not understand why it prints variable x twice, and why is the second line False? I think Blender makes two variables of the same name.? Because when I write print (x == x) then comes twice True. Why does the Blender in this way? Or is there another way to do it.

first of all, happy new year!

I "try" to make an inventory with 4 cells or more and 2 various items or more...

like this

I want to check if the variable x is set to False. If so, then the cell1() function should be x set to True. The idea is if x is True then nothing should be collected. In principle, should represent x if the cell is empty or full. My problem is that x is always "False" after the function has finished??? Why does it work in Python but not in Blender?

x = "False"

def xReplace(value):
    global x
    x = value
    

def cell1():    
    if sens.positive and x == "False": # sens= message sensor
        var()                          # var()= function update text in cell1/ or end object
        xReplace("True")               # "change the value from global variable x"
        
    elif sens.positive and x == "True": 
        var2()                         # var2()= function update/set in cell2
               
cell1()
print(x)

console prints

True
False

I do not understand why it prints variable x twice, and why is the second line False? I think Blender makes two variables of the same name.? Because when I write print (x == x) then comes twice True. Why does the Blender in this way? Or is there another way to do it.

first of all, happy new year!

I "try" to make an inventory with 4 cells or more and 2 various items or more...

enter image description here

I want to check if the variable x is set to False. If so, then the cell1() function should be x set to True. The idea is if x is True then nothing should be collected. In principle, should represent x if the cell is empty or full. My problem is that x is always "False" after the function has finished??? Why does it work in Python but not in Blender?

x = "False"

def xReplace(value):
    global x
    x = value
    

def cell1():    
    if sens.positive and x == "False": # sens= message sensor
        var()                          # var()= function update text in cell1/ or end object
        xReplace("True")               # "change the value from global variable x"
        
    elif sens.positive and x == "True": 
        var2()                         # var2()= function update/set in cell2
               
cell1()
print(x)

console prints

True
False

I do not understand why it prints variable x twice, and why is the second line False? I think Blender makes two variables of the same name.? Because when I write print (x == x) then comes twice True. Why does the Blender in this way? Or is there another way to do it.

deleted 1 character in body
Source Link
Anunaki
  • 41
  • 1
  • 1
  • 5

first of all, happy new year!

I "try" to make an inventory with 4 cells or more and 2 various items or more...

like this

I want to check if the variable x is set to False. If so, then the cell1() function should be x set to True. The idea is if x is True then nothing should be collected. In principle, should represent x if the cell is empty or full. My problem is that x is always "False" after the function has finished??? Why does it work in Python but not in Blender?

x = "False"

def xReplace(value):
    global x
    x = value
    

def cell1():    
    if sens.positive and x == "False": # sens= message sensor
        var()                          # var()= function update text in cell1/ or end object
        xReplace("True")               # "change the value from global variable x"
        
    elif sens.positive and x == "True": 
        var2()                         # var2()= function update/set in cell2
               
cell1(x)
print(x)

console prints

True
False

I do not understand why it prints variable x twice, and why is the second line False? I think Blender makes two variables of the same name.? Because when I write print (x == x) then comes twice True. Why does the Blender in this way? Or is there another way to do it.

first of all, happy new year!

I "try" to make an inventory with 4 cells or more and 2 various items or more...

like this

I want to check if the variable x is set to False. If so, then the cell1() function should be x set to True. The idea is if x is True then nothing should be collected. In principle, should represent x if the cell is empty or full. My problem is that x is always "False" after the function has finished??? Why does it work in Python but not in Blender?

x = "False"

def xReplace(value):
    global x
    x = value
    

def cell1():    
    if sens.positive and x == "False": # sens= message sensor
        var()                          # var()= function update text in cell1/ or end object
        xReplace("True")               # "change the value from global variable x"
        
    elif sens.positive and x == "True": 
        var2()                         # var2()= function update/set in cell2
               
cell1(x)
print(x)

console prints

True
False

I do not understand why it prints variable x twice, and why is the second line False? I think Blender makes two variables of the same name.? Because when I write print (x == x) then comes twice True. Why does the Blender in this way? Or is there another way to do it.

first of all, happy new year!

I "try" to make an inventory with 4 cells or more and 2 various items or more...

like this

I want to check if the variable x is set to False. If so, then the cell1() function should be x set to True. The idea is if x is True then nothing should be collected. In principle, should represent x if the cell is empty or full. My problem is that x is always "False" after the function has finished??? Why does it work in Python but not in Blender?

x = "False"

def xReplace(value):
    global x
    x = value
    

def cell1():    
    if sens.positive and x == "False": # sens= message sensor
        var()                          # var()= function update text in cell1/ or end object
        xReplace("True")               # "change the value from global variable x"
        
    elif sens.positive and x == "True": 
        var2()                         # var2()= function update/set in cell2
               
cell1()
print(x)

console prints

True
False

I do not understand why it prints variable x twice, and why is the second line False? I think Blender makes two variables of the same name.? Because when I write print (x == x) then comes twice True. Why does the Blender in this way? Or is there another way to do it.

Source Link
Anunaki
  • 41
  • 1
  • 1
  • 5
Loading