Get Base Item Fits In Inventory function query

My question relates to:

int GetBaseItemFitsInInventory ( int nBaseItemType, object oObject );

I’ve copied the example code from the Lexicon for this function (see below) into my Neverwinter Nights EE Toolset compiler, and I’m get the following error: ERROR: NO RIGHT BRACKET ON EXPRESSION.

The error is generated by the “if” conditional statement where the GetBaseItemFitsInInventory function is used. This function is part of the Enhanced Edition new content / update stuff. If anyone knows why the function generates this error, please let me know. Thanks :slight_smile:

==============================================================

The Lexicon example code is:

// OnUsed script that would give a plot Greatsword, which is a rather large weapon.
// Since the object will be set as cursed let’s not drop it on the ground!

void main()
{
object oUser = GetLastUsedBy();

if(GetBaseItemFitsInInventory(BASE_ITEM_GREATSWORD, oUser))
{
    object oSword = CreateItemOnObject("plot_gsword", oUser, 1);
    SetItemCursedFlag(oSword, TRUE);
    SendMessageToPC(oUser, "This sword you pulled from the rubble clings to you. You cannot seem to remove it from your inventory!");
}
else
{
    SendMessageToPC(oUser, "You find a greatsword but cannot fit it in your inventory. You need to make room to pick it up.");
}

}

This message can simply mean that the function is unrecognised.

Are you using EE version 8193.21 or later? If not, you will get this error, because the function doesn’t exist in earlier releases.

8193.21 and .22 are Development (beta) versions of EE which are available on the Beamdog client and Steam (not sure about GOG).

It’s most likely what Proleric has said.

However if you get an error message and don’t know right away what it means it usually helps to split the line into multiple lines:

1 if
2 (
3 GetBaseItemFitsInInventory
4 (
5 BASE_ITEM_GREATSWORD
6 ,
7 oUser
8 )
9 )

The compiler then will give you the ERROR: NO RIGHT BRACKET ON EXPRESSION in line 4. That means the compiler expects a right bracket rather than a left bracket. The reason is that the compiler doesn’t know a function GetBaseItemFitsInInventory and considers GetBaseItemFitsInInventory to be an expression (a variable or a constant) and after an expression you cannot have a left bracket.

Thanks for replying, Proleric. I’ve got the 8193.20 version, and GOG’s not giving me access to the development version of EE. I guess I’ll just have to wait for GOG to update my game. Thanks again.

Peter :slight_smile:

1 Like