Frictional Games Forum (read-only)
Whats wrong with my script? - 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 - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Whats wrong with my script? (/thread-16655.html)



Whats wrong with my script? - lbrosious96 - 07-01-2012

Im getting an unexpected ending at line 42,2, and i have tried everything! please help

Code:
void OnStart()
{
AddUseItemCallback("", "monsterdoorkey_1", "monsterdoor", "UsedKeyOnDoor", true);
AddUseItemCallback("", "irondoor_key", "irondoor", "UsedKeyOnDoor", true);
AddUseItemCallback("", "monstercontain_key", "monstercontain", "UsedKeyOnDoor", true);
AddUseItemCallback("", "deskdoor_lib_key", "deskdoor_lib", "UsedKeyOnDoor", true);
AddUseItemCallback("", "basement_key", "basement_door", "UsedKeyOnDoor", true);
AddUseItemCallback("", "lib_key", "lib_door", "UsedKeyOnDoor", true);
AddEntityCollideCallback("Player", "PlayerCollide_1", "MonsterFunction", true, 1);
AddEntityCollideCallback("Player", "PlayerCollide_2", "MonsterFunction_2", true, 1);
AddEntityCollideCallback("Player", "door_shut_1", "door_shut_collide", string& asFunction, true, 1);
AddEntityCollideCallback("Player", "closetdoor", "closetopen", string& asFunction, true, 1);
SetEntityPlayerInteractCallback("monstercontain_key", "ActivateMonster", true)
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);
RemoveItem(asItem);
}

void closetopen(string &in asParent, string &in asChild, int alState)
{
    SetSwingDoorOpen("closet_1", true, true);
}

void door_shut_collide(string &in asParent, string &in asChild, int alState)
{
    SetSwingDoorClosed("irondoor", true, true);
}

void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("servant_grunt", true");
}

void MonsterFunction_2(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("servant_brute_4", true);
}

void ActivateMonster(string &in item)
{
    SetEntityActive("corpse_male_4", true);
}



RE: Whats wrong with my script? - Adny - 07-01-2012

You left the function blank for two of your callbacks:


AddEntityCollideCallback("Player", "door_shut_1", "door_shut_collide", string& asFunction, true, 1);
AddEntityCollideCallback("Player", "closetdoor", "closetopen", string& asFunction, true, 1);

Also, the syntax for the function "ActivateMonster" should be asEntity, not item.


RE: Whats wrong with my script? - Cruzore - 07-01-2012

as long as "string &in" is there, it doesn't matter what you name it. it can be asEntity, item or anything. I tried it out by replacing it with "lolz" and it worked.
It's just good to name it asEntity or entity, to remember what it stands for so you don't have to look at the script functions page again.