First of all, indent your code properly... I can't stress enough how important this is.
Now, like Nicky said, to simply check if the player possesses a certain inventory item, use player.HasInventory.
If, on the other hand, you want to find out whether the player has
used a certain inventory item, you'll need this:
else if (UsedAction(eGA_UseInv)) {
if (player.ActiveInventory == iCup) player.Say("I used the cup.");
else Unhandled(); // <-- this is needed to handle other inv items
}
As for your bool code, you can't define a Global variable called
Portafogli_inv, then define it
again within a script.
Also, to create a bool function, you'll need a) parameter brackets after the name and b) a return value. The following will compile:
bool player_is_using_key() {
if (player.ActiveInventory == iKey) return true;
else return false;
}
Or the short version:
bool player_is_using_key() {
return (player.ActiveInventory == iKey);
}
This function is useless though since you can directly check HasInventory() or ActiveInventory.
BUTT, and this is the most important part:There's already a special function that does all the door handling. It's called
any_click_on_door_special and is explained in the goddamn PDF that comes with the fucking template.
Not only does it allow you to specify the inv item that unlocks the door but also the message supposed to be displayed if the player tries opening the door while it's locked or looks at it.
There's also example code right there in the first room of the game.
Edit: May I also remind you of this thread:
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=46182.0Did you forget everything I posted in there...?