PDA

View Full Version : The not keyword



alpaca
03-28-2007, 16:55
Hey Carl, I found a new problem in vanilla today that needs fixing (as I put it into my tutorial, it reads like this):


Be careful when using not. It apparently doesn't work with some conditions that use a logic token (like I_CompareCounter counter = 1).
If you want to negate these, manually negate the token, so "not condition = 1" would become "condition !=1", "not condition >= 1" would become "condition < 1" and so on.

I found that using "I_CompareCounter = 1" and "not I_CompareCounter = 1" yields the exact same results. I'm not sure if that's true for all logic_token keywords, but to be sure, they should be changed.

The problem is that CA uses this kind of syntax with some vanilla triggers, for example:

;------------------------------------------
Trigger battle3Dread
WhenToTest PostBattle

Condition GeneralNumKillsInBattle > 8
and not Trait BattleChivalry > 0

Affects BattleDread 1 Chance 50
Affects Bloodthirsty 1 Chance 10
Affects Brave 1 Chance 20

So I thought I'd just tell you to have a look for that :yes:

Carl
03-28-2007, 17:55
It definetly works with the example yopu gave in the code tags. Also the anti-trait fixes actually rely on the not code working rigt in relation to traits.

On the other hand, thanks for the warnings about it not working in every case, I didn't know that and it would explain a few oddball things I noticed.

Thanks.

alpaca
03-28-2007, 19:51
That's fine if it works for your keywords. I'd just change the logic token in the future instead of negating the whole thing to be on the safe side :2thumbsup:

The only thing I can definitely say it doesn't work with is I_CompareCounter because that's the only one i tested properly.

Carl
03-28-2007, 19:55
That's fine if it works for your keywords. I'd just change the logic token in the future instead of negating the whole thing to be on the safe side


Of course, thats why i'm Glad of the warning. I was just pointing out that in the case of some things, we can't do it without the not tag.

I think (don't quote me on this though), that any condition that starts with "I" is unaffected as I don't think a couple of lines relating to:


and not IsFactionLeader

AND


and not IsFactionHeir

are not working right. A few others too I suspect.

alpaca
03-30-2007, 23:10
The problem only ever applies to keywords using logic tokens as parameters (i.e. something like "=", "!=", "<", etc.)
It definitely should work with the other keywords.