Frictional Games Forum (read-only)
Fatal error: Expected identifier - 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: Fatal error: Expected identifier (/thread-16748.html)

Pages: 1 2


Fatal error: Expected identifier - Vennufius - 07-05-2012

So I'm having this small problem with my script. It keeps on having some kind of error, but I just can't simply find it. I would appreciate if someone could help me with this.

Here is my script atm:










void OnStart()
{
AddEntityCollideCallback("crowbar_joint_1", "BreakDoor", "CollideAreaBreakDoor", true, 1);
AddUseItemCallback("crowbarondoor", "crowbar_1", "castle_arched01_2", "UseCrowbarOnDoor", true);
AddUseItemCallback("crowbaronframe", "crowbar_1", "AreaUseCrowbar", "UseCrowbarOnDoor", true);
}


void UseCrowbarOnDoor(string &in asItem, string &in asEntity)
{
AddTimer("timer01", 0.2, "TimerAttachCrowbar");
PlaySoundAtEntity("pickupcrow","player_crouch.snt", "Player", 0.05, false);
RemoveItem("crowbar_1");
}


void TimerAttachCrowbar(string &in asTimer)
{
PlaySoundAtEntity("attachcrowbar","puzzle_place_jar.snt", "Player", 0, false);
SetEntityActive("crowbar_joint_1", true);
}


void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
{
GiveSanityBoostSmall();
PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
SetSwingDoorLocked("castle_arched01_2", false, false);
SetSwingDoorDisableAutoClose("castle_arched01_2", true);
SetSwingDoorClosed("castle_arched01_2", false, false);
PlaySoundAtEntity("break", "break_wood_metal", "AreaBreakEffect", 0, false);
CreateParticleSystemAtEntity("breakps", "ps_hit_wood", "AreaBreakEffect", false);
AddPropImpulse("castle_arched01_2", 0, 0, 3, "World");
SetEntityActive("crowbar_joint_1", false);
SetEntityActive("crowbar_broken_1", true);
AddTimer("pushdoor", 0.1, "TimerPushDoor");
AddDebugMessage("Break door!", false);
}


void TimerPushDoor(string &in asTimer)
{
AddPropImpulse("castle_arched01_2", -1, 2, -4, "World");
AddTimer("doorclose", 1.1, "TimerDoorCanClose");
}


void TimerDoorCanClose(string &in asTimer)
{
SetSwingDoorDisableAutoClose("castle_arched01_2", false);
}


RE: Fatal error: Expected identifier - Adny - 07-05-2012

Can you specify what the error is?


RE: Fatal error: Expected identifier - Vennufius - 07-05-2012

(07-05-2012, 03:02 AM)andyrockin123 Wrote: Can you specify what the error is?
Well thats part of the problem. It just wont start the map and gives me that "FATAL ERROR: Expected identifier". I can't figure out what could be the problem.


RE: Fatal error: Expected identifier - Vennufius - 07-05-2012

So I messed around a bit and got to this. When I try to start the map, it gives me this error (Look at the attachment). It changed from "Expected identifier" to "Unexpected end of file". Can someone please help me out?


RE: Fatal error: Expected identifier - drunkmonk - 07-05-2012

(07-05-2012, 10:48 AM)Vennufius Wrote: So I messed around a bit and got to this. When I try to start the map, it gives me this error (Look at the attachment). It changed from "Expected identifier" to "Unexpected end of file". Can someone please help me out?
What changes did you make to your script? Because iv had an unexpected error before and it was for something simple as forgetting to put quotes around something or forgetting a bracket somewhere. andyrockin123 helped me with my last one


RE: Fatal error: Expected identifier - Vennufius - 07-05-2012

(07-05-2012, 12:42 PM)drunkmonk Wrote:
(07-05-2012, 10:48 AM)Vennufius Wrote: So I messed around a bit and got to this. When I try to start the map, it gives me this error (Look at the attachment). It changed from "Expected identifier" to "Unexpected end of file". Can someone please help me out?
What changes did you make to your script? Because iv had an unexpected error before and it was for something simple as forgetting to put quotes around something or forgetting a bracket somewhere. andyrockin123 helped me with my last one
I found some small mistakes in the script, so I fixed them. I can't figure out whats wrong.


RE: Fatal error: Expected identifier - drunkmonk - 07-05-2012

Post the script that you have now


RE: Fatal error: Expected identifier - Vennufius - 07-05-2012

Here is what my script looks like now:


void OnStart()
{
AddEntityCollideCallback("crowbar_joint_1", "BreakDoor", "CollideAreaBreakDoor", true, 1);
AddUseItemCallback("crowbarondoor", "crowbar_1", "castle_arched01_2", "UseCrowbarOnDoor", true);
AddUseItemCallback("crowbaronframe", "crowbar_1", "castle_arched01_2", "UseCrowbarOnDoor", true);
}

void UseCrowbarOnDoor(string &in asItem, string &in asEntity)
{
AddTimer("timer_01", 0.2, "TimerAttatchCrowbar");
PlaySoundAtEntity("pickupcrow", "player_crouch.snt", "Player", 0.05, false);
RemoveItem("crowbar_1");
}

void TimerAttatchCrowbar(string &in asTimer)
{
PlaySoundAtEntity("attachcrowbar", "puzzle_place_jar.snt", "Player", 0, false);
SetEntityActive("crowbar_joint_1", true);
}

void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
{
GiveSanityBoostSmall();
PlayMusic("10_puzzle01.snt", false, 0.7, 0.1, 10, false);
SetSwingDoorLocked("castle_arched01_2", true);
SetSwingDoorDisableAutoClose("castle_arched01_2", true);
SetSwingDoorClosed("castle_arched01_2", false, false);
PlaySoundAtEntity("break", "break_wood_metal.snt", "AreaBreakEffect", 0, false);
CreateParticleSystemAtEntity("breakps", "ps_hit_wood", "AreaBreakEffect", false);
AddPropImpulse("castle_arched01_2", 0, 0, 3, "World");
SetEntityActive("crowbar_joint_1", false);
SetEntityActive("crowbar_broken_1", true);
AddTimer("pushdoor", 0.1, "TimerPushDoor");
}

void TimerPushDoor(string &in asTimer)
{
AddPropImpulse("castle_arched01_2", -1, 2, -4, "World");
AddTimer("doorclose", 1.1, "TimerDoorCanClose");
}

void TimerDoorCanClose(string &in asTimer)
{
SetSwingDoorDisableAutoClose("castle_arched01_2", false);
}

(07-05-2012, 05:33 PM)Vennufius Wrote: Here is what my script looks like now:


void OnStart()
{
AddEntityCollideCallback("crowbar_joint_1", "BreakDoor", "CollideAreaBreakDoor", true, 1);
AddUseItemCallback("crowbarondoor", "crowbar_1", "castle_arched01_2", "UseCrowbarOnDoor", true);
AddUseItemCallback("crowbaronframe", "crowbar_1", "castle_arched01_2", "UseCrowbarOnDoor", true);
}

void UseCrowbarOnDoor(string &in asItem, string &in asEntity)
{
AddTimer("timer_01", 0.2, "TimerAttatchCrowbar");
PlaySoundAtEntity("pickupcrow", "player_crouch.snt", "Player", 0.05, false);
RemoveItem("crowbar_1");
}

void TimerAttatchCrowbar(string &in asTimer)
{
PlaySoundAtEntity("attachcrowbar", "puzzle_place_jar.snt", "Player", 0, false);
SetEntityActive("crowbar_joint_1", true);
}

void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
{
GiveSanityBoostSmall();
PlayMusic("10_puzzle01.snt", false, 0.7, 0.1, 10, false);
SetSwingDoorLocked("castle_arched01_2", true);
SetSwingDoorDisableAutoClose("castle_arched01_2", true);
SetSwingDoorClosed("castle_arched01_2", false, false);
PlaySoundAtEntity("break", "break_wood_metal.snt", "AreaBreakEffect", 0, false);
CreateParticleSystemAtEntity("breakps", "ps_hit_wood", "AreaBreakEffect", false);
AddPropImpulse("castle_arched01_2", 0, 0, 3, "World");
SetEntityActive("crowbar_joint_1", false);
SetEntityActive("crowbar_broken_1", true);
AddTimer("pushdoor", 0.1, "TimerPushDoor");
}

void TimerPushDoor(string &in asTimer)
{
AddPropImpulse("castle_arched01_2", -1, 2, -4, "World");
AddTimer("doorclose", 1.1, "TimerDoorCanClose");
}

void TimerDoorCanClose(string &in asTimer)
{
SetSwingDoorDisableAutoClose("castle_arched01_2", false);
}
Sorry again, I found a mistake. But this time I think it gave me an error that someone could actually solve.

So this is what it gave me: FATAL ERROR: Could not load script file
'custom_stories/NoNameYet/maps/NoNameYet.hps'!
main (25, 2) : ERR :No matching signatures to
'SetSwingDoorLocked(string@&, const bool)'

Oh this is just annoying... I had made a wrong script:


SetSwingDoorLocked("castle_arched01_2", true);

[align=-webkit-auto]
Which should have been this:
[/align][align=-webkit-auto]
[/align][align=-webkit-auto]
SetSwingDoorLocked("castle_arched01_2", false, false);
[/align][align=-webkit-auto]
[/align][align=-webkit-auto]
[/align]


RE: Fatal error: Expected identifier - drunkmonk - 07-05-2012

It's your SetSwingDoorLocked. It should look like this
SetSwingDoorLocked("castle_arched01_2", true, true);


RE: Fatal error: Expected identifier - Vennufius - 07-05-2012

(07-05-2012, 06:00 PM)drunkmonk Wrote: It's your SetSwingDoorLocked. It should look like this
SetSwingDoorLocked("castle_arched01_2", true, true);
I got that about half an hour ago and actually it should be false, false in my case.