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.