我有一个问题,它只显示 路易斯(650佩尔姆),当你再次点击它将显示路易斯(使用中),但第三次它是路易斯(650佩尔姆)再次,我找不到问题
def example():
if louis_inventory and louis == 0:
pointstore_skin_ct.addline('->1. Louis (650) Perm')
elif louis_inventory == 1 and louis == 0:
pointstore_skin_ct.addline('->1. Louis (In use)')
elif louis_inventory and louis == 1:
pointstore_skin_ct.addline('->1. Louis (Not in use)')
答案 0 :(得分:2)
if louis_inventory and louis == 0:
这将抓住louis_inventory
真实的所有案例 - 例如在int的情况下,任何非零值 - louis
为零。
因此第一个elif
案例无法访问。我不知道你究竟要做什么,但这可能会解决它:
def example():
if louis_inventory == 1 and louis == 0:
pointstore_skin_ct.addline('->1. Louis (In use)')
elif louis_inventory and louis == 0:
pointstore_skin_ct.addline('->1. Louis (650) Perm')
elif louis_inventory and louis == 1:
pointstore_skin_ct.addline('->1. Louis (Not in use)')
如果值正好为1,它将跳转到第一个块;如果是任何其他非零值,它将跳转到第二个块。