Question regargind Scripting

Post » Tue Oct 02, 2012 12:10 am

Hi everyone,

I'd like to know how to check for two items in the inventory in one line of code...

Let's say:

I want to check if the player has (3 Raw Ebony and 1 daedra Heart)... When I write:

If (( player->getitemcount "Ingred_Raw_Ebony_01" >= 3 ) || ( player->getitemcount "Ingred_daedras_heart_01" >= 1 ) )

When i Compile and save the script in CS no error message, But when I run it in-game I get an Expression Statement Error.... Left Eval....

anybody can show me if and how I can write such a double check in one code?

I know I can write a code that would check both , using a couple of Successive If Satements, but I want to write it on one line if possible...


Thanks guyz!
User avatar
JESSE
 
Posts: 3404
Joined: Mon Jul 16, 2007 4:55 am

Post » Tue Oct 02, 2012 1:52 am

but I want to write it on one line if possible...
The Morrowind scripting language is extremely basic, and is missing nice stuff like full boolean operators.
The topic you are interested in is covered in "Morrowind Scripting for Dummies" version 9 in the section "Constructing Boolean operations in TES Script"
User avatar
Nauty
 
Posts: 3410
Joined: Wed Jan 24, 2007 6:58 pm

Post » Tue Oct 02, 2012 2:57 pm

I think this is the shortest structure you can use
If ( player->getitemcount "Ingred_Raw_Ebony_01" < 3 )elseif ( player->getitemcount "Ingred_daedras_heart_01" < 1 )else  ; actionendif
[EDIT]typo
[EDIT]blah, forget it, opposite logic, I'm too tired
User avatar
OJY
 
Posts: 3462
Joined: Wed May 30, 2007 3:11 pm


Return to III - Morrowind