rondivu Posted January 13, 2009 Share Posted January 13, 2009 Okay so I was doing some scripting and... I know that I've seen people use parenthesis before, but I cannot find good documentation of Parenthetical Usage when it comes to scripting. Here is my script which is in question... if (player.IsAnimGroupPlaying attackbackpower || player.IsAnimGroupPlaying attackpower || player.IsAnimGroupPlaying attackleftpower || player.IsAnimGroupPlaying attackrightpower) == 1 The difference between that and if I used an == 1 on ever single "or" conditional. Good paranthetical usage (not just this example, but others) would benefit me in the greatest way (and possible reduce problems in the future when I am modding. Thanks! :thanks: Link to comment Share on other sites More sharing options...
Vagrant0 Posted January 13, 2009 Share Posted January 13, 2009 Okay so I was doing some scripting and... I know that I've seen people use parenthesis before, but I cannot find good documentation of Parenthetical Usage when it comes to scripting. Here is my script which is in question... if (player.IsAnimGroupPlaying attackbackpower || player.IsAnimGroupPlaying attackpower || player.IsAnimGroupPlaying attackleftpower || player.IsAnimGroupPlaying attackrightpower) == 1 The difference between that and if I used an == 1 on ever single "or" conditional. Good paranthetical usage (not just this example, but others) would benefit me in the greatest way (and possible reduce problems in the future when I am modding. Thanks! :thanks:I believe it is more of a personal, organizational issue than anything. I usually don't use them, and when I do it's either when I'm doing some slightly complicated math-type stuff, or when I'm using conditional OR's in scripting. So far I really havn't seen any problems which are caused by a lack of parenthesis. Most f the scripting problems I come across are from people using either the wrong functions, or functions improperly, or the wrong block type, or just bad condition setup... My own work included. I guess the ultimate answer is that it depends alot on what you're doing, and your own personal preference. Link to comment Share on other sites More sharing options...
LoginToDownload Posted January 13, 2009 Share Posted January 13, 2009 As a side-note, in that situation, you actually don't need an "== 1" at all. If you just call a boolean (true or false) function in an if-statement without the number, it just assumes "== 1". Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.