Frictional Games Forum (read-only)
If Statement - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: If Statement (/thread-5007.html)



If Statement - shiznit304 - 10-10-2010

How do I make an if statement to check if the door is not locked, then don't display message?
this is what I got.
Code:
if (GetSwingDoorLocked("door1") == true)
    {
        void AddMessage1(string &in entity)
        {
            AddDebugMessage("fgsfds",false);
            SetMessage("Messages", "ExitDoorMessage", 0);
        }    
}

But when i try to load my level, it says:
Unexpected token 'if'


RE: If Statement - Pandemoneus - 10-10-2010

Other way around.

Code:
void AddMessage1(string &in entity)
{
       if (GetSwingDoorLocked("door1") == true){
            AddDebugMessage("fgsfds",false);
            SetMessage("Messages", "ExitDoorMessage", 0);
        }    
}



RE: If Statement - shiznit304 - 10-10-2010

Thanks. It works perfectly.