Frictional Games Forum (read-only)
Yet another noob asking for help scripting - 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: Yet another noob asking for help scripting (/thread-10105.html)



Yet another noob asking for help scripting - Repus32 - 09-01-2011

////////////////////////////
// Run first time starting map
void OnStart()
{
SetPlayerLampOil(0);

}
////////////////////////////
// Run when entering map
void OnEnter()
{
PlayMusic("09_amb_safe", true, 0.9, 5, 0, true);

AddUseItemCallback("", "Key_1", "Door_1", "UsedKeyOnDoor", true);

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(Door_1, false, true);
PlaySoundAtEntity("", "unlock_door.snt", "Door_1", 0.0f, false);
RemoveItem(Key_1);
}
}
////////////////////////////
// Run when leaving map
void OnLeave()
{

}

ERROR: expected ( at 16,8!

Could someone please help me fix this?


RE: Yet another noob asking for help scripting - Your Computer - 09-01-2011

You're not supposed to define a function within another function (i.e. take UsedKeyOnDoor out of OnEnter).


RE: Yet another noob asking for help scripting - Repus32 - 09-01-2011

Many thanks upon you, good sir. Is there a tutorial page for this out there somewhere?


RE: Yet another noob asking for help scripting - Your Computer - 09-02-2011

(09-01-2011, 10:43 PM)Repus32 Wrote: Is there a tutorial page for this out there somewhere?
For what exactly? Defining a function? How to handle errors? Understanding scripting in general?