Frictional Games Forum (read-only)

Full Version: Coding problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have an error on my .hps file. It says its on line 18 (I had to clean it up, it's the last line), but I can't see what's wrong there.

Code:
void OnStart ()
{
    AddUseItemCallback("", "key1", "mansion_1", "KeyOnDoor", true);
    
    SetEntityPlayerInteractCallback("key1", "ActivateMonster", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity) {
    SetSwingDoorLocked("mansion_1", false, true);
    PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
    RemoveItem("key1);
}

void ActivateMonster(string &in asItem) {
    SetEntityActive("morso1", true);
    AddEnemyPatrolNode("morso1", "PathNodeArea_1", 0, "Idle");
    AddEnemyPatrolNode("morso1", "PathNodeArea_2", 0, "Idle");
}
In the line
RemoveItem("key1);
is your issue.
You didn't fully enclose key1 in quotation marks,
RemoveItem("key1"); is what you'll want.
Oh how stupid I am. That must have come when I cleaned the script. Thank you.
In the future when asking for debugging, best if you tell us everything the game tells us (This was Unexpected end of file?), that we way know that it's not the last line but rather something else.
Yes it was Unexpected end of file. I'll tell that if I'll have problems in the future,