How does ne() actually work?

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
AstralWanderer
Kobold
Posts: 15
Joined: Sat May 11, 2019 8:41 am

How does ne() actually work?

Post by AstralWanderer »

The wiki makes a handful of examples. The first two are:

[r: ne(1, 0)]
[r: ne(1, 1, 0)]

which return:
1
0

Now, I understand the first example: 1 is not equal to 0, so ne() checks true.

But the second one, why is it false? The first 1 is equal to the second 1, but neither of them is equal to 0, so the inequality should check true.
What am I missing?

User avatar
aliasmask
RPTools Team
Posts: 9023
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: How does ne() actually work?

Post by aliasmask »

ne, not equal checks a list of consecutive numbers or strings. And if there are any 2 that are equal, then the whole thing is false.

So, 1,1,0 is 1 ne 1 - false.. doesn't need to check any more.
1, 0, 1 is 1 ne 0, true.. 0 ne 1, true so whole list is true.

so a list of a,b,c,d,e is: a ne b; b ne c, c ne d and d ne e.

AstralWanderer
Kobold
Posts: 15
Joined: Sat May 11, 2019 8:41 am

Re: How does ne() actually work?

Post by AstralWanderer »

Oh, ok, so it checks if there is any kind of repetition, not if there's inequality between the whole batch of parameters.

Thanks.


Post Reply

Return to “Macros”