Jump to content

Proper usage of () in scripts


rondivu

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...