if statement modifies groups, what!?

   1407   2   0
User Avatar
Member
1012 posts
Joined: 4月 2017
Offline
Hi!

I have a bunch of primitives that can or not be in a group (i@group_frontDoor; i@group_upFrontDoor; i@group_backDoor; i@group_upBackDoor; ). I wanted to have an i@doorCheck to verify if the prim is in one of the door groups or not. The problem is the primitives groups gets modified by the IF statement. Why is that?!

i@doorCheck;
i@group_frontDoor; i@group_upFrontDoor; i@group_backDoor; i@group_upBackDoor;

if((@group_frontDoor = 1) || (@group_upFrontDoor = 1) || (@group_backDoor = 1) || (@group_upBackDoor = 1))
    {
    @doorCheck = 1;
    }

-Olivier
Edited by olivierth - 2018年11月19日 13:47:10
User Avatar
Member
24 posts
Joined: 7月 2014
Offline
I'm pretty sure you need to use “==” for if statements like that. if(@group_frontdoor == 1)
A single “=” sets the value, even inside an if statement.
User Avatar
Member
1012 posts
Joined: 4月 2017
Offline
DOH!!!

Thanks!

-Olivier
  • Quick Links