Conditions- "or" or "and"?

This is really confusing. I think it should be that ALL conditions must be met for an event to occur, yet it seems that ONE or more of the conditions have to be met for an event to occur. This is evident in the inspector, where I have the conditions as follows:

is button held (event player, primary fire) == true [this is true while running; player was pressing the button]
or(compare(global var(b) == event player), compare(global var(b) == NULL)) == true [this is false while running because b == true)

according to the inspector, it ran because “conditions became true”. However only one of these conditions are true, so it should either not run, or it should be more clear that conditions act as an “or” scenario, or you should be able to choose.

And in the future, multiple conditions, alongside and/or, is just really confusing. Maybe make that more clear.

Edit: ok I just combined both conditions with an “and statement” and it literally is thinking the statement is true when it clearly is false. Is my syntax wrong? Does the workshop know how to compare 2 values?

edit 2: WHY is anything but false TRUE? That’s probably where everything has been messing up. I did some changes but that’s the only conclusion i can come up with.

Not sure about that one. You’re saying B equals “true”, that’s what the inspector says? It might consider “true” to be equal to “event player”. Normally you wouldn’t compare different types like that. AFAIK ‘true’ often just means, ‘not false’. Like, null, 0, false, or an empty array, are all FALSE. Anything else is TRUE.

If you have to store a ‘true’ value in B, you could change compare(global var(b) == event player) to and(entity exists(global var b), compare(global var B == event player))

I changed it so it can now have 3 values stored in it- true, false, or event player. But you’re right it seems. Instead of true or false I’ll do something more specific and exact like numbers

You have to have an AND in the middle if its all one same rule

Or you can run the two different conditions in two different boxes and that should fix the problem

I am 100% sure multiple conditions in one rule act as an “and” scenario. Because otherwise 90% of my code wouldnt work wich is not the case.

It would be really weird if TRUE = EVENT PLAYER was a thing. Maybe it is the case, but its also possible that you have an error somewhere else in your code.

I’m certain that it is a thing. Checking something is equal to true in the workshop is basically asking if it’s not false.

I just tried adding a hud text that shows “compare(true==event player)” and the hud shows TRUE.

I guess, its better to simulate true and false with 0 and 1 then …

1 Like

So much this.
It seems like any value besides 0 triggers “== true”, even negative values like -1.

Basically, you can treat “== true” as a check to see if the value has been set to anything besides the default value (0), or false. (although I wouldn’t rely on it to always work like you expect if you use it like this. I’m not sure if “NULL” is considered true or false, as that’s usually used with player ID checks)

You can also use true/false values in calculations, where true acts like 1 and false like 0.
for example, if you multiply 5 with “is on ground”, it will return 5 when you’re on the ground, and 0 when you’re not.