Need simple help!

Spillsandstains

Warlord
Joined
Mar 31, 2008
Messages
271
OK this little bit of code is intended to identify a specific in an event, so I tested it with a dual outcome ... essentially the idea is to do stuff based on the leadertype string. Except it worked exactly in the opposite way I imagined!

The code:

def canDoSpecificLeaderNegative(argsList):
iEvent = argsList[0]
kTriggeredData = argsList[1]
pPlayer = gc.getPlayer(kTriggeredData.ePlayer)
iSpecificLeader = gc.getLeaderHeadInfo(pPlayer.getLeaderType())
if iSpecificLeader == gc.getInfoTypeForString('LEADER_MYLEADER'):
return False
return True

def canDoSpecificLeaderPositive(argsList):
iEvent = argsList[0]
kTriggeredData = argsList[1]
pPlayer = gc.getPlayer(kTriggeredData.ePlayer)
iSpecificLeader = gc.getLeaderHeadInfo(pPlayer.getLeaderType())
if iSpecificLeader == gc.getInfoTypeForString('LEADER_MYLEADER'):
return True
return False
 
Wouldn't swapping "return False" and "return True" do the job in this case?

BTW, if you post code, it is useful to put in a code block. It will save the indentation, which makes is much better readable. e.g.

Code:
def function(args):
    do_something
 
Top Bottom