Frictional Games Forum (read-only)

Full Version: The "if" statement
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hai guys!
I wanted to ask of you to guide me a little bit as far as the "if" statement goes. Yes, I understand the very very basics of it, but I can't get it to work in my map.

Here's the scheme of use for the "if":
In the beginning I have set up a locked door that (obviously) requires a key. In doing the code, I decided upon setting a message to tell you whether or not you have the key. So, assuming you found the key and have it tucked away in your inventory, and then you click the door, it will say "I should use that key I found".
Assuming you HAVEN'T found it, it will say that you need to look around for one.
The problem is, I can't get the message to show up at all. I particularly think that I didn't even come close to getting the coding right when I made it.

Code:
if(HasItem("entrykey"))
{SetMessage("Messages", "Message1Alt", 0)
else
SetMessage("Messages", "Message1", 0)
}



If you could fix my code or teach me how to correctly write my own, I'd be much obliged.
void FunctionThatIsCalledWhenClickingDoor (Syntax)
{
if(HasItem("entrykey"))
{
SetMessage script
}
else
{
Other SetMessage script.
}
}
(03-20-2012, 08:11 PM)Obliviator27 Wrote: [ -> ]void FunctionThatIsCalledWhenClickingDoor (Syntax)
{
if(HasItem("entrykey"))
{
SetMessage script
}
else
{
Other SetMessage script.
}
}
Thanks! I'll try it now. I gave you a rep, just for your quick reply Wink