Couple of noob coding questions

devestator

Lifetime Member
Joined
Oct 25, 2006
Messages
1,550
Reaction score
15
Points
38
Yes JJ I searched, I couldn't find any definitive answers so Im posting, get over it! :) (j/k hehe but I know what your gonna say when you respond)

Ok now that the JJ disclaimer is out of the way, I've got a couple of noob coding questions that have been bugging me.

First off dealing with /if conditions. Is there anyway to group conditions in an /if statement... for example I'm a native VB coder, how would I duplicate (or can I duplicate) something like this

Code:
If varATrue And (varBTrue Or varCTrue) Then
...
End If

I know the syntax conversions, but this does not seem to work
Code:
/if (${varATrue} && (${varBTrue} || ${varCTrue})) {
...
}

For now I've just been nesting two different /ifs, but I like to be as efficient as possible in my coding, so if there is a way to do things of this nature on one line instead of two, that would be awesome!

Next up is there a Select Case type thing in MQ? I think in c++ it's called Switch but not 100% on that.
Example VB:
Code:
Select Case
   Case 1

   Case 2

   Case 3

End Select

Again here I've been doing it with nested /ifs, else /ifs... but if there is a way to optimize it I'd really like to know.

Thanks for any help!
 
first part should work as you have it this is just a fast example out of raiddruid.

Code:
if ((${SelfBuffs} || ${UseAura}) && !${SelfBuffTimer}) /call CheckBuffs

B || C && A
((TRUE || TRUE) && TRUE) /dothis

would not matter if you put the A && B||C should still execute same result.

Not sure why your example you gave does not work.


nested ifs use less memory in MQ2 if I remember correctly.

As for the case thing I have no idea I dont do C++
 
Yes JJ I searched, I couldn't find any definitive answers so Im posting, get over it! :) (j/k hehe but I know what your gonna say when you respond)

Ok now that the JJ disclaimer is out of the way, I've got a couple of noob coding questions that have been bugging me.



Now that is funny!!! - Fry, Can we get this in auto ever message?

Stoneface
 
Not sure why your example you gave does not work.

He's missing paranthesis...

he has: if ( A && B || C)

It should be: if ( A && (B || C)) // whenever A is true as well as B or C.

as is, the parser probably reads from left to right and makes it:

if ((A && B) || C) // whenever c is true or A and B are true

As for the switch statement, I'm pretty sure mq does not implement it.
 
(${varATrue} && (${varBTrue} || ${varCTrue}))
hes not missing anything in that.

MQ2 does read left to right but (${varATrue} && (${varBTrue} || ${varCTrue})) or ( (${varBTrue} || ${varCTrue}) && ${varATrue}) should give same result
 
Yeah you're right, I could swear he didn't have the ( ()) when I looked at it last night!
 
The closest you are going to get with the Select Case setup is with

Code:
/if (${CASE1}) {
...do something
} else /if (${CASE2}) {
...do something
} else /if (${CASE3}) {
...do something
}
 
You may be running the wrong vars...either post a snippet of your code up with the situation in question or shoot me a pm. A lot of the stuff can be close but no cigar.

BC