IF and AND

Post » Tue Jun 19, 2012 6:50 am

I'm trying to write a simple IF statement, and for some reason the compiler is freaking out.

This works:

   	 if playersAlchemy >=40            if (Game.GetPlayer().HasPerk(Alchemist40)) == 0                                Game.GetPlayer().AddPerk(Alchemist40)                                endIf        endIf

But this doesn't compile:

   	 if playersAlchemy >=40 AND (Game.GetPlayer().HasPerk(Alchemist40)) == 0           	 Game.GetPlayer().AddPerk(Alchemist40)                       	 endIf

Error is "Required (...)+ loop did not match anything at input 'AND'"

I'm not a programmer so this mumbo jumbo message is maddening to begin with, and CK wiki has no reference on conditional statements that I could find. Help please?
User avatar
Arnold Wet
 
Posts: 3353
Joined: Fri Jul 07, 2006 10:32 am

Post » Tue Jun 19, 2012 4:35 am

'And' is not valid.

Use && for and.
Use || for or.

Its also wise to put a space after your condition checks.
This: >=40
should be this: >= 40
User avatar
Ruben Bernal
 
Posts: 3364
Joined: Sun Nov 18, 2007 5:58 pm

Post » Tue Jun 19, 2012 9:34 am

Och. Thank you.
User avatar
Sunny Under
 
Posts: 3368
Joined: Wed Apr 11, 2007 5:31 pm

Post » Tue Jun 19, 2012 7:03 am

If you use 2 IF conditions in a row that would equal AND too right? If either fails it will not happen if both do not fail it will happen.
User avatar
Valerie Marie
 
Posts: 3451
Joined: Wed Aug 15, 2007 10:29 am


Return to V - Skyrim