Frictional Games Forum (read-only)
Unlocking Door 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: Unlocking Door Script (/thread-14240.html)



Unlocking Door Script - Zebby - 03-25-2012

Is something wrong with this code? A message everytime I start the custom story comes up:

FATAL ERROR: Could not load script file ‘custom_stories/Evergreen/maps/Small
House.hps’!



Main (9, 1) : ERR: Unexpected token ‘{‘

This is all the code:


////////////////////////////
// Run first time starting map

void OnStart()

{

AddUseItemCallback("", "Bedroom_Key_1", "Bedroom_Door_1", "KeyOnDoor", true);

}

void KeyOnDoor(string &in asItem, string &in asEntity);

{

SetSwingDoorLocked("Bedroom_Door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "Bedroom_Door_1", 0, false);
RemoveItem("Bedroom_Key_1");

}

////////////////////////////
// Run when entering map

void OnEnter()

{

}

////////////////////////////
// Run when leaving map

void OnLeave()

{

}


I have tried using these tutorials to help, but so far they have not.

http://www.youtube.com/watch?v=ABI7NUqkXW0&feature=related

http://www.youtube.com/watch?v=3vn9MhoRFl0&feature=related
Could someone check the code for me please? Confused






RE: Unlocking Door Script - SplitHeadProduction - 03-25-2012

(03-25-2012, 08:32 PM)Zebby Wrote: Is something wrong with this code? A message everytime I start the custom story comes up:

FATAL ERROR: Could not load script file ‘custom_stories/Evergreen/maps/Small
House.hps’!



Main (9, 1) : ERR: Unexpected token ‘{‘

This is all the code:


////////////////////////////
// Run first time starting map

void OnStart()

{

AddUseItemCallback("", "Bedroom_Key_1", "Bedroom_Door_1", "KeyOnDoor", true);

}

void KeyOnDoor(string &in asItem, string &in asEntity);

{

SetSwingDoorLocked("Bedroom_Door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "Bedroom_Door_1", 0, false);
RemoveItem("Bedroom_Key_1");

}

////////////////////////////
// Run when entering map

void OnEnter()

{

}

////////////////////////////
// Run when leaving map

void OnLeave()

{

}


I have tried using these tutorials to help, but so far they have not.

http://www.youtube.com/watch?v=ABI7NUqkXW0&feature=related

http://www.youtube.com/watch?v=3vn9MhoRFl0&feature=related
Could someone check the code for me please? Confused
i can't see a problem with that code but i could be missing something


RE: Unlocking Door Script - ClayPigeon - 03-25-2012

When pointing a function you should not place a semicolon at the end of the line.

void KeyOnDoor(string &in asItem, string &in asEntity);


This is wrong.

void KeyOnDoor(string &in asItem, string &in asEntity)

This is right.


RE: Unlocking Door Script - Zebby - 03-25-2012

(03-25-2012, 08:37 PM)ClayPigeon Wrote: When pointing a function you should not place a semicolon at the end of the line.

void KeyOnDoor(string &in asItem, string &in asEntity);


This is wrong.

void KeyOnDoor(string &in asItem, string &in asEntity)

This is right.
Thank you! Big Grin It worked! I now feel a little stupid.... Blush




RE: Unlocking Door Script SOLVED - ClayPigeon - 03-25-2012

(03-25-2012, 08:40 PM)Zebby Wrote:
(03-25-2012, 08:37 PM)ClayPigeon Wrote: When pointing a function you should not place a semicolon at the end of the line.

void KeyOnDoor(string &in asItem, string &in asEntity);


This is wrong.

void KeyOnDoor(string &in asItem, string &in asEntity)

This is right.
Thank you! Big Grin It worked! I now feel a little stupid.... Blush
Small mistakes can screw a whole script, it happens to everyone, no worries.