Frictional Games Forum (read-only)
Scripting errors. - 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: Scripting errors. (/thread-17055.html)



Scripting errors. - Redneb27 - 07-17-2012

I just started trying to create my own custom story, and I dont know hardly anything about scripting. All Im trying to do is make a key unlock a door right now. I get an unexpected token { error and a couple other errors. My scripting is probably full of errors, so can someone take a look at it and help me?


////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "key_1", "door_1", "KeyOnDoor", true);
}

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

////////////////////////////
// Run when leaving map
void OnLeave()
{

}


RE: Scripting errors. - Traggey - 07-17-2012

Wrong section, moved to development support.


RE: Scripting errors. - JMFStorm - 07-17-2012

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


RE: Scripting errors. - Redneb27 - 07-17-2012

(07-17-2012, 07:41 PM)JMFStorm Wrote: void KeyOnDoor(string &in asItem, string &in asEntity);
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem("key_1");
}
Okay I did that and it did remove one of the errors, but I still get an unexpected token { error. Is there something else wrong?


RE: Scripting errors. - Kazakarumariou - 07-17-2012

Post the entire script again. You might have did something when most likely copying and pasting JMFStorm's script


RE: Scripting errors. - Your Computer - 07-18-2012

JMFStorm forgot to remove the semicolon in the function header that isn't supposed to be there.


RE: Scripting errors. - Kazakarumariou - 07-18-2012

Oh yeah

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


RE: Scripting errors. - Redneb27 - 07-19-2012

Thanks guys. I got it working.