Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
If with 2 conditions?
#1
Hi.
how is the command to execute a part of an Program only if 2 conditions are true?
My idea was
Code:
if( level.var1 == 1 and level.var2 == 1 )
{
self iprintlnbold("TEST OK!!!");
}

The Error-Massage (from GScyntax) is:
Code:
358: Error 1: Parser: ) expected, Identifier found instead
In Black ops the Error-Massage is:
Code:
Server Script Compile Error
Bad Syntax

do you know, how it works?
Sorry for bad English Blush -> *GERMAN*
Reply

#2
Code:
if( level.var1 == 1 && level.var2 == 1 )
{
self iprintlnbold("TEST OK!!!");
}

change 'and' to '&&'
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#3
(10-28-2011, 18:52)Se7en Wrote:
Code:
if( level.var1 == 1 && level.var2 == 1 )
{
self iprintlnbold("TEST OK!!!");
}

change 'and' to '&&'

Thank you Big Grin
Code:
No syntax Errors detected
Sorry for bad English Blush -> *GERMAN*
Reply

#4
&&
||
YouTube 1:Azumikkel- Modding
YouTube 2:DerpShark- Gaming Entertainment
Website:Jensby.me
Contact: im[at]jensby.me
Reply

#5
You could take a look at this tutorial: http://wiki.modsrepository.com/index.php...troduction

It helped me a bit when I was new Tongue
Reply

#6
But its COD 4 ?
Sorry for bad English Blush -> *GERMAN*
Reply

#7
(10-28-2011, 19:05)gumpo03 Wrote: But its COD 4 ?

It's the same scripting language, there's a few differences, but just few big changes such as the "foreach" function doesn't exist in BO anymore.
Reply

#8
(10-28-2011, 19:07)Rendflex Wrote:
(10-28-2011, 19:05)gumpo03 Wrote: But its COD 4 ?

It's the same scripting language, there's a few differences, but just few big changes such as the "foreach" function doesn't exist in BO anymore.

foreach also didn't exist in cod4 so that's not problem Smile
[Image: MaEIQ.png]
Reply

#9
(10-28-2011, 18:56)AZUMIKKEL Wrote: &&
||

|| = or,
he shouldn't use that
Reply

#10
Some engines/languages also use &| which means and/or, which is kind of confusing.

Because in those languages, if you use

Code:
if(A == 2 && B == 4)
return true;

It would only go through if both of them are correct (like in COD)

but
Code:
if(A == 2 || B == 4)

would only go through if only ONE of them are correct.




Of course, this is irrelevant to COD, but the more you know.
YouTube 1:Azumikkel- Modding
YouTube 2:DerpShark- Gaming Entertainment
Website:Jensby.me
Contact: im[at]jensby.me
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.