Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
MetroidJunkie

CheckInventory not working. (Solved)

Recommended Posts

I have;

Script 27 (void)
{
if (CheckInventory("BlueCard") > 0);
Floor_LowerToLowest(64,15);
if (CheckInventory("BlueCard") < 1);
print(s:"They're hiding something.");
}

To check for the Blue Keycard and having a message indicating it's locked if the player doesn't have the card. I tried using else but it claimed Invalid Statement.

This script doesn't have errors but it doesn't seem to work in the actual game as it both displays the message and lowers the floor even though the player doesn't have the key card.

Share this post


Link to post

Because you have stuck line endings at the end of checks. If you end a check before it runs a function, the check itself does nothing.

{
if (CheckInventory("BlueCard") > 0)
Floor_LowerToLowest(64,15);
else
print(s:"They're hiding something.");
}

Share this post


Link to post

Note that in some circumstances, you may want to use this deliberately:

if (somecondition);
else if (someothercondition) dosomething();
Depending on the length of the expressions being evaluated, this can be a more legible way of writing:
if (!somecondition && someothercondition) dosomething();

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×