我只是贴在整个功能,因为它不是长期无效的语法:与if语句
def decideTile():
global tile
global exp
global maxexp
tile += 1
exp += math.ceil(random.randrange(math.ceil((maxexp/2)/2,maxexp/2))
if exp >= maxexp:
levelUp()
else:
tileChoices = ['Battle','Loot','Nothing']
fileType = random.choice(tileChoices)
if tileType == 'Battle':
battle()
elif tileType == 'Loot':
loot()
elif tileType == 'Nothing':
nothing()
现在,Python是说,它的
if exp >= maxexp:
部分是“无效的语法“,我不完全确定为什么。帮助表示赞赏!
不要忘记接受最适合您的答案(点击它的绿色复选标记)。对于更复杂的问题/答案,您可能需要等待几个小时,然后选择最完整的(可能不是第一个;)。 – 2012-01-02 07:39:16
@ sbb0请接受正确的答案:)有关详细信息,请参阅此问题:http://meta.stackexchange.com/q/5234/156122 – 2012-01-07 21:18:03