Frictional Games Forum (read-only)
Game wrashes while starting the story - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Game wrashes while starting the story (/thread-8219.html)



Game wrashes while starting the story - EddieShoe - 05-24-2011

Okay, here's the deal: Everytime I start the game I go to Custom Story and start my story and the game crashes and I get an error about UNEXPECTED { something, something...

I'm trying to make a locked door open, but it won't work as you can see. Here's the HPL and the script file.

HPL.log
Spoiler below!
-------- THE HPL ENGINE LOG ------------
Engine build ID 20100818114615

Creating Engine Modules
--------------------------------------------------------
Creating graphics module
Creating system module
Creating resource module
Creating input module
Creating sound module
Creating physics module
Creating ai module
Creating gui module
Creating generate module
Creating haptic module
Creating scene module
--------------------------------------------------------

Initializing Resources Module
--------------------------------------------------------
Creating loader handlers
Creating resource managers
Adding loaders to handlers
--------------------------------------------------------

Initializing Graphics Module
--------------------------------------------------------
Setting video mode: 1680 x 1050 - 32 bpp
Init Glew...OK
Setting up OpenGL
Vendor: NVIDIA Corporation
Renderer: GeForce GTX 460/PCI/SSE2
Version: 4.1.0
Max texture image units: 32
Max texture coord units: 8
Max user clip planes: 8
Two sided stencil: 1
Vertex Buffer Object: 1
Anisotropic filtering: 1
Max Anisotropic degree: 16
Multisampling: 1
Texture compression: 1
Texture compression S3TC: 1
Auto generate MipMaps: 1
Render to texture: 1
Max draw buffers: 8
Max color render targets: 8
Packed depth-stencil: 1
Texture float: 1
GLSL Version: 4.10 NVIDIA via Cg compiler
ShaderModel 2: 1
ShaderModel 3: 1
ShaderModel 4: 1
OGL ATIFragmentShader: 0
Adding engine materials
Initializing DevIL
Vendor String: Abysmal Software
Version String: Developer's Image Library (DevIL) 1.6.8pre Aug 12 2006
Version Number: 168
Adding engine post effects
--------------------------------------------------------

Initializing Sound Module
--------------------------------------------------------
Initializing OpenAL
Available OpenAL devices:
0. Generic Software on Högtalare (VIA High Definition Audio)(OpenAL default)
Trying to open device 'Generic Software on Högtalare (VIA High Definition Audio)'... Success!
Number of mono sources: 32
Streaming setup: 4 Buffers x 262144 bytes each
--------------------------------------------------------

Initializing Game Module
--------------------------------------------------------
Adding engine updates
Initializing script functions
--------------------------------------------------------

User Initialization
--------------------------------------------------------
-------- Loading map 'menu_bg.map' ---------
Cache Loading: 1057 ms
Entities: 218 ms
Compilation: 0 ms
Total: 1282 ms
Meshes created: 25
Bodies created: 5
-------- Loading complete ---------
--------------------------------------------------------

Game Running
--------------------------------------------------------
Setting profile: 'dev_user' Path: 'C:\Users\Timmy\Documents/Amnesia/Main/dev_user/'
WARNING: No resources element found in 'custom_stories/Custom 01/extra_english.lang'
ERROR: Couldn't build script 'C:/Program Files (x86)/Amnesia - The Dark Descent/redist/custom_stories/Custom 01/maps/map1.hps'!
------- SCRIPT OUTPUT BEGIN --------------------------
main (9, 3) : ERR : Unexpected token '{'
------- SCRIPT OUTPUT END ----------------------------
FATAL ERROR: Could not load script file 'custom_stories/Custom 01/custom_stories/Custom 01/maps/map1.hps'!
main (9, 3) : ERR : Unexpected token '{'


Script File
Spoiler below!
//===========================================
// This runs when the map first starts
void OnStart()
{
AddUseItemCallback("", "firstroomkey", "mansion_1", "UsedKeyOnDoor", true);
}

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

//===========================================
// This runs when the player enters the map
void OnEnter()
{

}

//===========================================
// This runs when the player leaves the map
void OnLeave()
{

}

I can provide more info, just ask!
Thanks in advance


RE: Game wrashes while starting the story - Roenlond - 05-24-2011

(05-24-2011, 06:26 PM)EddieShoe Wrote: Okay, here's the deal: Everytime I start the game I go to Custom Story and start my story and the game crashes and I get an error about UNEXPECTED { something, something...

I'm trying to make a locked door open, but it won't work as you can see. Here's the HPL and the script file.

HPL.log
Spoiler below!
-------- THE HPL ENGINE LOG ------------
Engine build ID 20100818114615

Creating Engine Modules
--------------------------------------------------------
Creating graphics module
Creating system module
Creating resource module
Creating input module
Creating sound module
Creating physics module
Creating ai module
Creating gui module
Creating generate module
Creating haptic module
Creating scene module
--------------------------------------------------------

Initializing Resources Module
--------------------------------------------------------
Creating loader handlers
Creating resource managers
Adding loaders to handlers
--------------------------------------------------------

Initializing Graphics Module
--------------------------------------------------------
Setting video mode: 1680 x 1050 - 32 bpp
Init Glew...OK
Setting up OpenGL
Vendor: NVIDIA Corporation
Renderer: GeForce GTX 460/PCI/SSE2
Version: 4.1.0
Max texture image units: 32
Max texture coord units: 8
Max user clip planes: 8
Two sided stencil: 1
Vertex Buffer Object: 1
Anisotropic filtering: 1
Max Anisotropic degree: 16
Multisampling: 1
Texture compression: 1
Texture compression S3TC: 1
Auto generate MipMaps: 1
Render to texture: 1
Max draw buffers: 8
Max color render targets: 8
Packed depth-stencil: 1
Texture float: 1
GLSL Version: 4.10 NVIDIA via Cg compiler
ShaderModel 2: 1
ShaderModel 3: 1
ShaderModel 4: 1
OGL ATIFragmentShader: 0
Adding engine materials
Initializing DevIL
Vendor String: Abysmal Software
Version String: Developer's Image Library (DevIL) 1.6.8pre Aug 12 2006
Version Number: 168
Adding engine post effects
--------------------------------------------------------

Initializing Sound Module
--------------------------------------------------------
Initializing OpenAL
Available OpenAL devices:
0. Generic Software on Högtalare (VIA High Definition Audio)(OpenAL default)
Trying to open device 'Generic Software on Högtalare (VIA High Definition Audio)'... Success!
Number of mono sources: 32
Streaming setup: 4 Buffers x 262144 bytes each
--------------------------------------------------------

Initializing Game Module
--------------------------------------------------------
Adding engine updates
Initializing script functions
--------------------------------------------------------

User Initialization
--------------------------------------------------------
-------- Loading map 'menu_bg.map' ---------
Cache Loading: 1057 ms
Entities: 218 ms
Compilation: 0 ms
Total: 1282 ms
Meshes created: 25
Bodies created: 5
-------- Loading complete ---------
--------------------------------------------------------

Game Running
--------------------------------------------------------
Setting profile: 'dev_user' Path: 'C:\Users\Timmy\Documents/Amnesia/Main/dev_user/'
WARNING: No resources element found in 'custom_stories/Custom 01/extra_english.lang'
ERROR: Couldn't build script 'C:/Program Files (x86)/Amnesia - The Dark Descent/redist/custom_stories/Custom 01/maps/map1.hps'!
------- SCRIPT OUTPUT BEGIN --------------------------
main (9, 3) : ERR : Unexpected token '{'
------- SCRIPT OUTPUT END ----------------------------
FATAL ERROR: Could not load script file 'custom_stories/Custom 01/custom_stories/Custom 01/maps/map1.hps'!
main (9, 3) : ERR : Unexpected token '{'


Script File
Spoiler below!
//===========================================
// This runs when the map first starts
void OnStart()
{
AddUseItemCallback("", "firstroomkey", "mansion_1", "UsedKeyOnDoor", true);
}

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

//===========================================
// This runs when the player enters the map
void OnEnter()
{

}

//===========================================
// This runs when the player leaves the map
void OnLeave()
{

}

I can provide more info, just ask!
Thanks in advance

Spoiler below!
//===========================================
// This runs when the map first starts
void OnStart()
{
AddUseItemCallback("", "firstroomkey", "mansion_1", "UsedKeyOnDoor", true);
}

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

//===========================================
// This runs when the player enters the map
void OnEnter()
{

}

//===========================================
// This runs when the player leaves the map
void OnLeave()
{

}

Try that. after void Function(stuff), do NOT use a semicolon.


RE: Game wrashes while starting the story - Khyrpa - 05-24-2011

take this -> ; <--out from this one
void UsedKeyOnDoor(string &in asItem, string &in asEntity)


RE: Game wrashes while starting the story - EddieShoe - 05-24-2011

Thanks to both of you, it works now! Smile