Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Error unexpected token {
Radical Batz Offline
Posting Freak

Posts: 953
Threads: 145
Joined: Dec 2013
Reputation: 25
#1
Error unexpected token {

Just as what the title says, I'm getting that error whenever I load my cs, because I just implemented this script inside my hps file which is the voice intro one

void OnStart()
{
    FadeOut(0);
    AddEffectVoice("intro_1", "", "Voice", "intro1",
false, "", 0, 5);
AddEffectVoice("intro_2", "", "Voice", "intro2",
false, "", 0, 5);
AddEffectVoice("intro_3", "", "Voice", "intro3",
false, "", 0, 5);
AddEffectVoice("intro_4", "", "Voice", "intro4",
false, "", 0, 5);
    SetEffectVoiceOverCallback("VoicesDone"); //This enables a callback that happens when the voices are done.
}

{
AddEntityCollideCallback("Player","CollideOpeningDustDoor","AreaTriggerDoor_1",true,1);
AddEntityCollideCallback("JumpscareDoor", "AreaJumpscare", "SanityDec", true, 1);
AddEntityCollideCallback("Handle", "AreaConnect", "AttachLever", true, 1);
AddEntityCollideCallback("Player", "teleport", "changemap", true , 1);
AddEntityCollideCallback("Player", "AreaDoor", "EventDoor", true, 1);
AddEntityCollideCallback("Player", "AreaMemento", "EventQuest", true, 1);
GiveItemFromFile("tinderbox_"+1, "tinderbox.ent");
GiveItemFromFile("tinderbox_"+1, "tinderbox.ent");
GiveItemFromFile("tinderbox_"+1, "tinderbox.ent");
AddTimer("voicesintro_1", 6, "VoicesIntro_1");

wakeUp();
}



void wakeUp()
{
FadeIn(2);
SetPlayerActive(true);
SetSanityDrainDisabled(false);
ShowPlayerCrossHairIcons(true);
FadeOut(0); // Instantly fades the screen out. (Good for starting the game)
FadeIn(10); // Amount of seconds the fade in takes
FadeImageTrailTo(2, 2);
PlayGuiSound("react_pant3.ogg", 1);
FadeSepiaColorTo(0, 2);
SetPlayerActive(false);
FadePlayerRollTo(50, 220, 220); // "Tilts" the players head
FadeRadialBlurTo(0.5, 2);
SetPlayerCrouching(true); // Simulates being on the ground
AddEntityCollideCallback("Player", "AreaCollide", "EventCollide", true, 1);
AddTimer("trig1", 11.0f, "beginStory"); // Change '11.0f' to however long you want the 'unconciousness' to last
}

void beginStory(string &in asTimer)
{
    ChangePlayerStateToNormal();
    SetPlayerActive(true);
    FadePlayerRollTo(0, 33, 33); // Change all settings to defaults
    FadeRadialBlurTo(0.0, 1);
    FadeSepiaColorTo(0, 4);
    SetPlayerCrouching(false);
    FadeImageTrailTo(0,1);
    SetPlayerLampOil(32);
    GiveSanityDamage(80, false);
    SetPlayerHealth(50);
    SetPlayerMoveSpeedMul(0.83f);
    SetPlayerRunSpeedMul(0);
    //SetPlayerLookSpeedMul(0.5);
    FadeImageTrailTo(0,0.2f);
    PlaySoundAtEntity("sigh", "react_sigh.snt", "Player", 1.0 / 1, false);
    AddUseItemCallback("", "HollowNeed", "CellDoor", "UseHollowNeedOnDoor", true);
PlaySoundAtEntity("sigh", "react_sigh.snt", "Player", 1.0 / 1.5f, false);
}

void UseHollowNeedOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("CellDoor", false, true);
PlaySoundAtEntity("", "unlock_door.ogg", asEntity, 0, false);
GiveSanityBoostSmall();
CompleteQuest("area", "enterarea");
AutoSave();
RemoveItem(asItem);
}


void EventCollide(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("CellGuardGrunt", true);
AddEnemyPatrolNode("CellGuardGrunt", "Node_1",0.001f, "");
AddEnemyPatrolNode("CellGuardGrunt", "Node_4",0.001f, "");
AddEnemyPatrolNode("CellGuardGrunt", "Node_6",0.001f, "");
AddEnemyPatrolNode("CellGuardGrunt", "Node_10",0.001f, "");
AddEnemyPatrolNode("CellGuardGrunt", "Node_15",0.001f, "");
AddEnemyPatrolNode("CellGuardGrunt", "Node_18",0.001f, "");
}


void AttachLever(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("Lever", true);

    SetEntityActive(asParent, false);
    PlayGuiSound("04_place_wood.ogg", 1);
    AutoSave();
    SetEntityActive("Mount", false);

}

void UnlockDoor(string &in asEntity, int LeverState)
{
    if(LeverState == 1)
    {
        SetSwingDoorLocked("Open", false, true);
    SetPropStaticPhysics("Open", false);
      SetEntityActive("Message", false);
        GiveSanityBoostSmall();
        PlaySoundAtEntity("", "unlock_door.ogg", "Open", 0, false);
        SetLeverStuckState(asEntity, LeverState, false);
    }
}


void SanityDec(string &in asParent, string &in asChild, int alState)
{
PlayGuiSound("react_scare1.ogg", 1);
GiveSanityDamage(15, true);
}

void int01(string &in asEntity)
{
SetMessage("Messages", "Message", 5);
}

void changemap(string &in asParent, string &in asChild, int alState)
    {
        StopMusic(3.0, 0);
        ChangeMap("cellartest","PlayerStartArea_1","","");
    }


void EventDoor(string &in asParent, string &in asChild, int alState)
{
        SetSwingDoorClosed("Door", false, false);
        SetSwingDoorDisableAutoClose("Door", true);

        PlaySoundAtEntity("creak", "joint_door_move_special.snt", "Door", 1, false);
    PlaySoundAtEntity("Wind", "general_wind_whirl", "Player", 2, false);
    PlaySoundAtEntity("scare", "react_scare.snt", "Player", 0.75f, false);
    PlaySoundAtEntity("SoundBong", "scare_tingeling.snt", "Player", 0.0f, false);
    PlayMusic("18_amb.ogg", true, 1.0f, 0, 0, true);
    CreateParticleSystemAtEntity("PSDoor_3", "ps_dust_push.ps", "Door", false);
    CreateParticleSystemAtEntity("PSDoor_4", "ps_dust_push.ps", "Door", false);
    GiveSanityDamage(10, true);    

        AddTimer("", 2, "TimerStopSound");
        AddTimer("Door", 0, "TimerMoveDoor");
}

void TimerMoveDoor(string &in asTimer)
{
        if(GetLocalVarInt("VarDoor") == 50) return;
        AddLocalVarInt("VarDoor", 1);

        AddTimer(asTimer, 0.03, "TimerMoveDoor");

        AddPropForce(asTimer, 70, 0, 0, "world");
}

void TimerStopSound(string &in asTimer)
{
        StopSound("creak", 0.4);
}


void PickUpLantern(string &in asEntity, string &in type)
{
    AddQuest("lantern", "pickuplantern");
}

void EventQuest(string &in asParent, string &in asChild, int alState)
{
    AddQuest("area", "enterarea");
}

void OnLeave()
{    
    SetupLoadScreen("LoadingScreen", "LoadScreen1", 0, "LoadScreen1_1.jpg");
}

but when I load my cs this error pops up

---------------------------
FATAL ERROR
---------------------------
FATAL ERROR: Could not load script file 'custom_stories/Lifeless_The Abandon/maps/Lifeless_The Abandon.hps'!
main (15, 1) : ERR  : Unexpected token '{'

---------------------------
OK  
---------------------------

Now I know how to deal with errors... sometimes Confused but "unexpected token {" does that mean that I have another same token? or I'm missing one, that's the problem, and I really don't like people doing it for me, I would love to solve it myself but how? I don't know what unexpected token { means!!! Sad
(This post was last modified: 03-09-2014, 10:52 AM by Radical Batz.)
03-09-2014, 10:22 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#2
RE: Error unexpected token {

PHP Code: (Select All)
void OnStart()
{
    
FadeOut(0);
    
AddEffectVoice("intro_1""""Voice""intro1",
false""05);
AddEffectVoice("intro_2""""Voice""intro2",
false""05);
AddEffectVoice("intro_3""""Voice""intro3",
false""05);
AddEffectVoice("intro_4""""Voice""intro4",
false""05); 
    
SetEffectVoiceOverCallback("VoicesDone"); //This enables a callback that happens when the voices are done.
}

{
AddEntityCollideCallback("Player","CollideOpeningDustDoor","AreaTriggerDoor_1",true,1);
AddEntityCollideCallback("JumpscareDoor""AreaJumpscare""SanityDec"true1);
AddEntityCollideCallback("Handle""AreaConnect""AttachLever"true1);
AddEntityCollideCallback("Player""teleport""changemap"true 1);
AddEntityCollideCallback("Player""AreaDoor""EventDoor"true1);
AddEntityCollideCallback("Player""AreaMemento""EventQuest"true1);
GiveItemFromFile("tinderbox_"+1"tinderbox.ent");
GiveItemFromFile("tinderbox_"+1"tinderbox.ent");
GiveItemFromFile("tinderbox_"+1"tinderbox.ent");
AddTimer("voicesintro_1"6"VoicesIntro_1");

wakeUp();
}



void wakeUp()
{
FadeIn(2);
SetPlayerActive(true);
SetSanityDrainDisabled(false);
ShowPlayerCrossHairIcons(true);
FadeOut(0); // Instantly fades the screen out. (Good for starting the game)
FadeIn(10); // Amount of seconds the fade in takes
FadeImageTrailTo(22);
PlayGuiSound("react_pant3.ogg"1);
FadeSepiaColorTo(02);
SetPlayerActive(false); 
FadePlayerRollTo(50220220); // "Tilts" the players head
FadeRadialBlurTo(0.52);
SetPlayerCrouching(true); // Simulates being on the ground
AddEntityCollideCallback("Player""AreaCollide""EventCollide"true1);
AddTimer("trig1"11.0f"beginStory"); // Change '11.0f' to however long you want the 'unconciousness' to last


Above is incorrect. They're all should be in OnStart.

Spoiler below!

CORRECT
PHP Code: (Select All)
void OnStart()
{
    
FadeOut(0);
    
AddEffectVoice("intro_1""""Voice""intro1",
false""05);
AddEffectVoice("intro_2""""Voice""intro2",
false""05);
AddEffectVoice("intro_3""""Voice""intro3",
false""05);
AddEffectVoice("intro_4""""Voice""intro4",
false""05); 
    
SetEffectVoiceOverCallback("VoicesDone"); //This enables a callback that happens when the voices are done.
AddEntityCollideCallback("Player","CollideOpeningDustDoor","AreaTriggerDoor_1",true,1);
AddEntityCollideCallback("JumpscareDoor""AreaJumpscare""SanityDec"true1);
AddEntityCollideCallback("Handle""AreaConnect""AttachLever"true1);
AddEntityCollideCallback("Player""teleport""changemap"true 1);
AddEntityCollideCallback("Player""AreaDoor""EventDoor"true1);
AddEntityCollideCallback("Player""AreaMemento""EventQuest"true1);
GiveItemFromFile("tinderbox_"+1"tinderbox.ent");
GiveItemFromFile("tinderbox_"+1"tinderbox.ent");
GiveItemFromFile("tinderbox_"+1"tinderbox.ent");
AddTimer("voicesintro_1"6"VoicesIntro_1");
wakeUp();
}

void wakeUp()
{
FadeIn(2);
SetPlayerActive(true);
SetSanityDrainDisabled(false);
ShowPlayerCrossHairIcons(true);
FadeOut(0); // Instantly fades the screen out. (Good for starting the game)
FadeIn(10); // Amount of seconds the fade in takes
FadeImageTrailTo(22);
PlayGuiSound("react_pant3.ogg"1);
FadeSepiaColorTo(02);
SetPlayerActive(false); 
FadePlayerRollTo(50220220); // "Tilts" the players head
FadeRadialBlurTo(0.52);
SetPlayerCrouching(true); // Simulates being on the ground
AddEntityCollideCallback("Player""AreaCollide""EventCollide"true1);
AddTimer("trig1"11.0f"beginStory"); // Change '11.0f' to however long you want the 'unconciousness' to last



"Veni, vidi, vici."
"I came, I saw, I conquered."
03-09-2014, 10:46 AM
Find
Radical Batz Offline
Posting Freak

Posts: 953
Threads: 145
Joined: Dec 2013
Reputation: 25
#3
RE: Error unexpected token { pls help

Thanks man it's working perfectly now, but one more thing! the voices are working but I don't want the voices to start when you wake up in the cell, I want the voices to start when it's a black screen and there's no noise then after the voices are done I want the player to start the waking script and in the cell! how do I do that pls? Smile

I hope you know what exactly I'm trying to say
(This post was last modified: 03-09-2014, 10:55 AM by Radical Batz.)
03-09-2014, 10:51 AM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#4
RE: Error unexpected token {

Add a timer on start...
Then put your voices in that timer. UBER easy Wink
Btw..
For every question you have you make a tread....
Can''t you make more things into 1 post?
There are over 30 posts from you in 1 months i guess...
Just, try to lern and read the wiki a bit more?
03-09-2014, 03:12 PM
Find




Users browsing this thread: 1 Guest(s)