Blacklisted_Guy Posted May 13, 2016 Share Posted May 13, 2016 I started working on some vex practice and decided to use it for a switch and a bunch of statements I've wrote this script but the second if statement (rot =1 && flip = 0) doesn't seem to be giving the right value. int rotatetion= ch("rot"); int flipvalue= ch("flip"); @switch = 0; if ( (rotatetion == 0) && (flipvalue == 0)) { @switch = 1; } if ( (rotatetion == 1) && (flipvalue == 0)) { @switch = 1; } if ( (rotatetion == 0) && (flipvalue == 1)) { @switch = 0; } if ( (rotatetion == 1) && (flipvalue = 1)) { @switch = 0; } rot and flip are integer sliders on the attribute wrangle node itself. Quote Link to comment Share on other sites More sharing options...
iamyog Posted May 13, 2016 Share Posted May 13, 2016 (edited) for integer, use chi() rather than ch() Similarly, you should probably defined your switch attribute as an integer: i@switch Edit: should have tested it before, it does not fix your problem. However adding some else statements works: int rotatetion= chi("rot"); int flipvalue= chi("flip"); i@switch = 0; if ( (rotatetion == 0) && (flipvalue == 0) ) { @switch = 1; } else { if ( (rotatetion == 1) && (flipvalue == 0) ) { @switch = 1; } else { if ( (rotatetion == 0) && (flipvalue == 1) ) { @switch = 0; } if ( (rotatetion == 1) && (flipvalue = 1) ) { @switch = 0; } } } Edited May 13, 2016 by iamyog 1 Quote Link to comment Share on other sites More sharing options...
Blacklisted_Guy Posted May 13, 2016 Author Share Posted May 13, 2016 48 minutes ago, iamyog said: for integer, use chi() rather than ch() Similarly, you should probably defined your switch attribute as an integer: i@switch Edit: should have tested it before, it does not fix your problem. However adding some else statements works: int rotatetion= chi("rot"); int flipvalue= chi("flip"); i@switch = 0; if ( (rotatetion == 0) && (flipvalue == 0) ) { @switch = 1; } else { if ( (rotatetion == 1) && (flipvalue == 0) ) { @switch = 1; } else { if ( (rotatetion == 0) && (flipvalue == 1) ) { @switch = 0; } if ( (rotatetion == 1) && (flipvalue = 1) ) { @switch = 0; } } } that worked! Thank you so much Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.