Frictional Games Forum (read-only)
SCRIPTING PROBLEMS - 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 PROBLEMS (/thread-9182.html)



SCRIPTING PROBLEMS - JenniferOrange - 07-16-2011

I keep getting this error [see attachment] every time I try and load. I've gotten rid of the tokens, added the ';' it wants, and it still complains. -.- Here's my full script:

Spoiler below!
void OnStart(wakeup())

void wakeUp () {
FadeOut(0);
FadeIn(20);
FadeImageTrailTo(2, 2);
FadeSepiaColorTo(100, 4);
SetPlayerActive(false);
FadePlayerRollTo(50, 220, 220);
FadeRadialBlurTo(0.15, 2);
SetPlayerCrouching(true);
AddTimer("trig1", 11.0f, "beginStory");
}

void beginStory(string &in asTimer){
ChangePlayerStateToNormal();
SetPlayerActive(true);
FadePlayerRollTo(0, 33, 33);
FadeRadialBlurTo(0.0, 1);
FadeSepiaColorTo(0, 4);
SetPlayerCrouching(false);
FadeImageTrailTo(0,1);
}

{
AddUseItemCallback("", "crowbar_1", "prison_1", "UsedCrowbarOnDoor", true);
AddEntityCollideCallback("crowbar_joint_1", "ScriptArea_1", "CollideAreaBreakDoor", true, 1);
}

void UsedCrowbarOnDoor(string &in asItem, string &in asEntity)
{
AddTimer("", 0.2, "TimerSwitchShovel");
RemoveItem("crowbar_1");
}

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

void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
{
AddPlayerSanity(25);
PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
SetSwingDoorLocked("prison_1", false, true);
SetMoveObjectState("prison_1", 1);
PlaySoundAtEntity("","break_wood_metal", "AreaBreakEffect", 0, false);
CreateParticleSystemAtEntity("", "ps_hit_wood", "AreaBreakEffect", false);
SetEntityActive("crowbar_joint_1", false);
SetLocalVarInt("Door", 1);
}

{
AddUseItemCallback("", "ladder_1", "PlaceLadder", "LadderOn", true);
}

void LadderOn(string &in asItem, string &in asEntity)
{
SetEntityActive("LadderArea_1", true);
SetEntityActive("ladder_static_1", true);
GiveSanityBoostSmall();
}

{
AddUseItemCallback("", "key_1", "locked_door1", "UsedKeyOnDoor", true);
}

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

{
AddEntityCollideCallback("Player" , "monster_rawr" , "MonsterFunc1" , true , 1);
}
void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("servant_grunt" , true);
}


thanks to anyone who can help me! D:


RE: SCRIPTING PROBLEMS - xtron - 07-16-2011

isn't it
Code:
void OnStart()
{
wakeup();
}

?


RE: SCRIPTING PROBLEMS - Zypherzemus - 07-16-2011

Woah.. ok.. first off, '(wake up)', that does NOT belong there lol, nothing goes inbetween the parenthesis of OnStart(), OnLeave(), or OnEnter().
and there are extra brackets everywhere.
Here:
Code:
void OnStart()
{
FadeOut(0);
FadeIn(20);
FadeImageTrailTo(2, 2);
FadeSepiaColorTo(100, 4);
SetPlayerActive(false);
FadePlayerRollTo(50, 220, 220);
FadeRadialBlurTo(0.15, 2);
SetPlayerCrouching(true);
AddTimer("trig1", 11.0f, "beginStory");
AddUseItemCallback("", "crowbar_1", "prison_1", "UsedCrowbarOnDoor", true);
AddEntityCollideCallback("crowbar_joint_1", "ScriptArea_1", "CollideAreaBreakDoor", true, 1);
AddUseItemCallback("", "ladder_1", "PlaceLadder", "LadderOn", true);
AddUseItemCallback("", "key_1", "locked_door1", "UsedKeyOnDoor", true);
AddEntityCollideCallback("Player" , "monster_rawr" , "MonsterFunc1" , true , 1);
}

void beginStory(string &in asTimer)
{
ChangePlayerStateToNormal();
SetPlayerActive(true);
FadePlayerRollTo(0, 33, 33);
FadeRadialBlurTo(0.0, 1);
FadeSepiaColorTo(0, 4);
SetPlayerCrouching(false);
FadeImageTrailTo(0,1);
}


void UsedCrowbarOnDoor(string &in asItem, string &in asEntity)
{
AddTimer("", 0.2, "TimerSwitchShovel");
RemoveItem("crowbar_1");
}

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

void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
{
AddPlayerSanity(25);
PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
SetSwingDoorLocked("prison_1", false, true);
SetMoveObjectState("prison_1", 1);
PlaySoundAtEntity("","break_wood_metal", "AreaBreakEffect", 0, false);
CreateParticleSystemAtEntity("", "ps_hit_wood", "AreaBreakEffect", false);
SetEntityActive("crowbar_joint_1", false);
SetLocalVarInt("Door", 1);
}


void LadderOn(string &in asItem, string &in asEntity)
{
SetEntityActive("LadderArea_1", true);
SetEntityActive("ladder_static_1", true);
GiveSanityBoostSmall();
}


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


void MonsterFunc1(string &in asParent , string &in asChild , int alState)
{
SetEntityActive("servant_grunt" , true);
}

void OnEnter()
{

}


void OnLeave()
{

}

I had to redo most of the script, there might be some syntax error, i'm not sure, i'm being lazy right now sorry.
None of the commands belong in a seperate set of brackets like you had it.
EX:
{
AddEntityCollideCallback(blah, blah, blah)
}

It doesn't work that way, these commands will always be in one of the On sections (OnStart, OnEnter, etc.)
The only things that get a bracket are the callback functions themselves.

EDIT: lol, I dunno if I messed it up or not, considering the way you had it.


RE: SCRIPTING PROBLEMS - JenniferOrange - 07-16-2011

I'm sorry about putting the wakeup() in the OnStart parenthesis.. I got the script from someone else and the directions said to put that in between a code and I was very clueless.. xD I've made a backup of my original script and have copied Snuffalofagus' script to try out instead, I'll let you know if it works. Big Grin

IT WORKS, THANKYOU Big Grin