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 Unexpected End of File
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#1
Unexpected End of File

I really didn't want to resort to this because this is such a silly problem. I know exactly what an unexpected end of file means, but, after going through the .hps file numerous times (seriously, for the past two and a half hours I've been going through this darn thing) I found one missing quotation mark. But fixing that did nothing. The error box says the problem is at the very end of the file and obviously there is nothing wrong with that.

This problem wasn't happening until I put in this script for void Open (a working script from another map I made a while back), and I've gone through that script looking for any errors: nothing. I tried removing it: nothing.

I'm at my wit's end. At this point, I've probably stared at this for so long, I'm not bound to notice anything. -.-

EDIT: I went the through .hps again, putting in everything a little bit at a time to find out which section is causing the trouble. I've edited down the code to show only this problem code.

void Open(string &in asItem, string &in asEntity)
{
    SetEntityInteractionDisabled("door", false);

    SetWheelInteractionDisablesStuck(asEntity, false);
    SetWheelStuckState(asEntity, alState, false);
    SetEntityInteractionDisabled("key", false);
    PlaySoundAtEntity("", "lapeurdelaverite.snt", "door", 0, false);
    AddDebugMessage("State changed to: "+alState, false);
}

(This post was last modified: 01-19-2015, 03:49 AM by AGP.)
01-19-2015, 02:14 AM
Find Reply
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#2
RE: Unexpected End of File

Give us your WHOLE hps. It is possible that the problem is not at this function, but it's callback syntax, or it's calling function or something.

"Veni, vidi, vici."
"I came, I saw, I conquered."
01-19-2015, 07:34 AM
Find Reply
Mudbill Offline
Muderator

Posts: 3,880
Threads: 59
Joined: Apr 2013
Reputation: 179
#3
RE: Unexpected End of File

PHP Code: (Select All)
SetWheelStuckState(asEntityalStatefalse); 

There is no alState in the parameters. Same goes for the debug message.
Looks like this callback was originally a ConnectionStateChangeCallback, then you changed it to a UseItemCallback?

(This post was last modified: 01-19-2015, 08:32 AM by Mudbill.)
01-19-2015, 08:31 AM
Find Reply
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#4
RE: Unexpected End of File

I went through the whole thing bit by by and those two (SetWheelStuckState and debug) were the causes of the error.

I ended up taking both out and did manage to get everything working, only to have that script stop functioning as intended.

Here is the updated .hps file:

void OnStart()
{    
    SetSanityDrainDisabled(true);
    SetEntityActive("BWingUnlock", false);

    SetEntityInteractionDisabled("candymountain", true);
    SetEntityInteractionDisabled("ladder_grab_1", true);
    SetEntityInteractionDisabled("ladder_grab_2", true);
    SetEntityInteractionDisabled("door_0", true);
    SetEntityInteractionDisabled("grand_piano_3", true);
    SetEntityInteractionDisabled("mansion_double_door_1", true);
    
    SetLocalVarInt("BWing", 0);
    
    AddEntityCollideCallback("Player", "BWingUnlock1", "BWingUnlockA", true, 1);
    AddEntityCollideCallback("Player", "BWingUnlock2", "BWingUnlockB", true, 1);
    AddEntityCollideCallback("Player", "BWingUnlock3", "BWingUnlockC", true, 1);
    AddEntityCollideCallback("Player", "BWingUnlock4", "BWingUnlockD", true, 1);
    AddEntityCollideCallback("Player", "BWingUnlock5", "BWingUnlockE", true, 1);
    AddEntityCollideCallback("Player", "BWingUnlock6", "BWingUnlockF", true, 1);
    AddEntityCollideCallback("Player", "BWingUnlock", "BWingOpen", true, 1);
    
    AddEntityCollideCallback("Player", "entrezvous", "ComeIn", true, -1);
    AddEntityCollideCallback("Player", "angelscare_1", "SheMoved", true, -1);
    AddEntityCollideCallback("Player", "angelscare_2", "SheMovedAgain", true, -1);
    AddEntityCollideCallback("Player", "lightson", "GiveLight", true, -1);
    AddEntityCollideCallback("Player", "lightsout", "NoLight", true, -1);
    AddEntityCollideCallback("Player", "officelightson", "LetThereBe", false, 0);
    AddEntityCollideCallback("Player", "passagelightson", "LetThereBeTwo", false, 0);
    AddUseItemCallback("", "key", "door_0", "Open", false);
    AddEntityCollideCallback("Player", "PlayerStartArea_1", "Checkpoint", true, 1);
    ///AddEntityCollideCallback("Player", "ludwighome", "Home", true, 1);
    AddEntityCollideCallback("Player", "solangedeath", "Justice", true, 1);
    AddEntityCollideCallback("Player", "uninvited", "StopCarmel", true, 1);
    AddEntityCollideCallback("leverbelowhandle", "attach", "ConnectLever", true, 1);
    AddEntityCollideCallback("Player", "unlockrec", "OpenRec", true, 1);
    AddEntityCollideCallback("Player", "shecries", "Calling", true, -1);
    AddEntityCollideCallback("book_1", "ScriptArea_1", "UnlockDesk", true, 1);
    AddEntityCollideCallback("Player", "ScriptArea_3", "CellarMemento", true, 1);
    
    for(int i = 1; i <= 4; i++) {
    AddUseItemCallback("crowbarondoors", "crowbar", "Door_"+i, "UseCrowbarOnDoor", false);
    AddEntityCollideCallback("Joint_Door_"+i, "AreaBreak_"+i, "BreakDoor", true, 1);
    }
}

void OnEnter()
{

}

void OnLeave()
{

}

///-------------------------------------------------------------------------------
///-------------------------------VOICES------------------------------------------
///-------------------------------------------------------------------------------

void Home(string &in asParent, string &in asChild, int alState)
{
    AddEffectVoice("ludwig_home01", "", "Dialogue", "ludwig_home01", true, "", 5, 20);
    AddEffectVoice("ludwig_home02", "", "Dialogue", "ludwig_home02", false, "", 5, 20);
}

void Justice(string &in asParent, string &in asChild, int alState)
{
    AddEffectVoice("solange_death01", "", "Dialogue", "solange_death01", true, "solange", 5, 30);
    AddEffectVoice("solange_death02", "", "Dialogue", "solange_death02", true, "solange", 5, 30);
}

void StopCarmel(string &in asParent, string &in asChild, int alState)
{
    PlaySoundAtEntity("", "sob02", "DRcellar", 0, false);
}

///-------------------------------------------------------------------------------
///-------------------------------MEMENTOS----------------------------------------
///-------------------------------------------------------------------------------

void LockedQuest(string &in entity)
{
        AddQuest("", "memento1");
}

void PickUpCrowbar(string &in asEntity, string &in type)
{
        AddQuest("crowbar", "memento2");
}

void CellarMemento(string &in entity)
{
        AddQuest("", "memento3");
        SetEntityActive("ScriptArea_3", false);
}

void ElevatorMemento(string &in asEntity, int alState)
{
    if(alState == 1)
    {
        AddQuest("", "memento4");
    }
}

///-------------------------------------------------------------------------------
///-------------------------------SWING REC DOOR----------------------------------
///-------------------------------------------------------------------------------

void OpenRec(string &in asParent, string &in asChild, int alState)
{
        SetEntityActive("chair", false);
        SetSwingDoorClosed("mansion_14", false, false);
        SetSwingDoorDisableAutoClose("mansion_14", true);
        PlaySoundAtEntity("", "dragchair", "mansion_14", 0, false);
}

///-------------------------------------------------------------------------------
///-------------------------------UNLOCKING DOORS---------------------------------
///-------------------------------------------------------------------------------

void CellarDoor(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked(asEntity, false, true);
    PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
}

void UnlockDesk(string &in asParent, string &in asChild, int alState)
{
  if(alState == 1)
  {
     SetSwingDoorLocked("deskdoor", false, true);
     PlayGuiSound("unlock_door.snt", 0.9f);
     StartPlayerLookAt("ScriptArea_2", 2.0f, 1.8f, "");
     SetPropObjectStuckState("book_1", 1);
     AddTimer("Endlook", 0.6, "Stop");
  }
}

void Stop(string &in asTimer)
{
     if(asTimer == "Endlook")
     {
      StopPlayerLookAt();
     }
}

///-------------------------------------------------------------------------------
///-------------------------------CROWBAR REUSE-----------------------------------
///-------------------------------------------------------------------------------

void UseCrowbarOnDoor(string &in asItem, string &in asEntity)
{
    RemoveItem(asItem);
    PlaySoundAtEntity("", "player_crouch.snt", "Player", 0.05, false);
    AddTimer(asEntity, 0.2, "TimerPlaceCrowbar");

    SetLocalVarString("CrowbarDoor", asEntity);
}
    
void TimerPlaceCrowbar(string &in asTimer)
{
    SetEntityActive("Joint_"+asTimer, true);
    PlaySoundAtEntity("", "puzzle_place_jar.snt", asTimer, 0, false);
}
    
void BreakDoor(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive(asParent, false);
  
    SetSwingDoorLocked(GetLocalVarString("CrowbarDoor"), false, false);
    SetSwingDoorClosed(GetLocalVarString("CrowbarDoor"), false, false);
    SetSwingDoorDisableAutoClose(GetLocalVarString("CrowbarDoor"), true);
    
    AddPropImpulse(GetLocalVarString("CrowbarDoor"), 0, 0, 3, "world");

    CreateParticleSystemAtEntity("", "ps_hit_wood.ps", "AreaEffect_"+asChild, false);
    PlaySoundAtEntity("", "break_wood_metal", "AreaEffect_"+asChild, 0, false);
    
    AddTimer("", 0.1, "TimerPushDoor");

    GiveItem("crowbar", "Puzzle", "crowbar", "crowbar.tga", 1);
}

void TimerPushDoor(string &in asTimer)
{
        AddPropImpulse(GetLocalVarString("CrowbarDoor"), -4, 2, 1, "world");
        AddTimer("", 1.1, "TimerDoorCanClose");
}
    
void TimerDoorCanClose(string &in asTimer)
{
        SetSwingDoorDisableAutoClose(GetLocalVarString("CrowbarDoor"), false);
}

///-------------------------------------------------------------------------------
///--------------------------------CANDY MOUNTAIN---------------------------------
///-------------------------------------------------------------------------------

void ConnectLever(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("leverbelowcomp", true);
    SetEntityActive(asParent, false);
    SetEntityActive("leverbelow", false);
}

void OpenSeasame(string &in asEntity, int alState)
{
    if (GetLocalVarInt("Check") == 0)
    {
        if (alState == 1)
        {
            SetMoveObjectState("candymountain", 1);

            PlaySoundAtEntity("", "", "candymountain", 0, false);

            SetLocalVarInt("Check", 1);

            return;
        }
    }
}

///-------------------------------------------------------------------------------
///--------------------------------GHOSTILY DOOR----------------------------------
///-------------------------------------------------------------------------------

void ComeIn(string &in asParent, string &in asChild, int alState)
{
        SetEntityActive("doorblock_01", false);
        SetSwingDoorClosed("carmel", false, false);
        SetSwingDoorDisableAutoClose("carmel", true);

        PlaySoundAtEntity("creak", "joint_door_move_special.snt", "carmel", 1, false);

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

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

        AddTimer(asTimer, 0.03, "TimerMoveDoor");

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

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

///-------------------------------------------------------------------------------
///--------------------------------GHOSTLY ANGEL----------------------------------
///-------------------------------------------------------------------------------

void SheMoved(string &in asParent, string &in asChild, int alState)
{
        SetEntityActive("weepangel_1", false);
        SetEntityActive("weepangel_2", true);
        SetLampLit("candlestick01_6", false, true);
        SetLightVisible("PointLight_8", false);
        
        PlaySoundAtEntity("", "attention.snt", "weepangel_2", 0, false);
}

void SheMovedAgain(string &in asParent, string &in asChild, int alState)
{
        SetEntityActive("weepangel_2", false);
        SetEntityActive("weepangel_3", true);
}

///-------------------------------------------------------------------------------
///--------------------------------BEDROOM UNLOCK---------------------------------
///-------------------------------------------------------------------------------

void BWingUnlockA(string &in asParent, string &in asChild, int alState)
{
    AddLocalVarInt("BWing", 1);
    UnlockBWing();
}

void BWingUnlockB(string &in asParent, string &in asChild, int alState)
{
    AddLocalVarInt("BWing", 1);
    UnlockBWing();
}

void BWingUnlockC(string &in asParent, string &in asChild, int alState)
{
    AddLocalVarInt("BWing", 1);
    UnlockBWing();
    
    AddEffectVoice("help", "", "Dialogue", "help01", true, "BWingUnlock3", 5, 30);
}

void BWingUnlockD(string &in asParent, string &in asChild, int alState)
{
    AddLocalVarInt("BWing", 1);
    UnlockBWing();
}

void BWingUnlockE(string &in asParent, string &in asChild, int alState)
{
    AddLocalVarInt("BWing", 1);
    UnlockBWing();
}

void BWingUnlockF(string &in asParent, string &in asChild, int alState)
{
    AddLocalVarInt("BWing", 1);
    UnlockBWing();
}

void Doors(string &in asTimer)
{
     if(asTimer == "Unlock")
     {
        AddLocalVarInt("Doors", 1);
        float fDefaultSpeed = 0.6f;
        switch (GetLocalVarInt("Doors"))

           {
             case 1:
                fDefaultSpeed = 1.2f;
                PlayGuiSound("close_gate.snt", 0.3f);
                PlayGuiSound("27_thump.snt", 0.8f);
                StartPlayerLookAt("ScriptArea_4", 4.0f, 3.8f, "");
                StartScreenShake(0.01, 0.7, 0.1, 0.5);
                SetPlayerActive(false);
             break;
             case 2:
             fDefaultSpeed = 0.1f;
             StopPlayerLookAt();
             break;
             case 3:
                fDefaultSpeed = 1.2f;
                PlayGuiSound("close_gate.snt", 0.3f);
                PlayGuiSound("27_thump.snt", 0.8f);
                StartPlayerLookAt("ScriptArea_5", 4.0f, 3.8f, "");
                StartScreenShake(0.01, 0.7, 0.1, 0.5);
             break;
             case 4:
             fDefaultSpeed = 0.1f;
             StopPlayerLookAt();
             break;            
             case 5:
                fDefaultSpeed = 1.2f;
                PlayGuiSound("close_gate.snt", 0.3f);
                PlayGuiSound("27_thump.snt", 0.8f);
                StartPlayerLookAt("ScriptArea_6", 4.0f, 3.8f, "");
                StartScreenShake(0.01, 0.7, 0.1, 0.5);
             break;
             case 6:
             fDefaultSpeed = 0.1f;            
             StopPlayerLookAt();
             SetPlayerActive(true);
             Destroycode();
             break;                
           }
                 if (GetLocalVarInt("Doors") <7)
             {
               AddTimer("Unlock", fDefaultSpeed, "Doors");
             }                  
     }
}

void Destroycode()
{
  SetEntityActive("ScriptArea_7", false);
}

void BWingOpen(string &in asParent, string &in asChild, int alState)
{  
       //StartScreenShake(0.2, 5.0, 3.0, 3.0);    
         SetLocalVarInt("Doors", 0);
         AddTimer("Unlock", 0.2, "Doors");                
          for(int x=0;x<3;x++)
          {
            SetLevelDoorLocked("level_wood_"+x, false);
          }
}

void UnlockBWing()
{
    if (GetLocalVarInt("BWing") == 4)
        {
          SetEntityActive("FlashbackArea_1", true);
        }

    if (GetLocalVarInt("BWing") == 6)
        {
            SetEntityActive("BWingUnlock", true);
        }
}

///-------------------------------------------------------------------------------
///--------------------------------LITTLE THINGS----------------------------------
///-------------------------------------------------------------------------------

void GiveLight(string &in asParent, string &in asChild, int alState)
{
    SetLampLit("lamp_6", true, true);
}

void NoLight(string &in asParent, string &in asChild, int alState)
{
    SetLampLit("lamp_6", false, true);
}

void LetThereBe(string &in asParent, string &in asChild, int alState)
{
    if(alState == 1) {
    SetLampLit("lamp_2", true, true); }
    else if(alState == -1) {
    SetLampLit("lamp_2", false, true); }
}

void LetThereBeTwo(string &in asParent, string &in asChild, int alState)
{
    if(alState == 1) {
    SetLampLit("elevator_lamp_5", true, true);
    SetLightVisible("SpotLight_14", true);    }
    else if(alState == -1) {
    SetLampLit("elevator_lamp_5", false, true);
    SetLightVisible("SpotLight_14", false);}
}

void Open(string &in asItem, string &in asEntity)
{
    SetEntityInteractionDisabled("door_0", false);
    SetWheelInteractionDisablesStuck(asEntity, false);
    SetWheelStuckState("door_0", 1, false);
    SetEntityInteractionDisabled("key", false);
}

Sorry about the length, but I'm pretty much done with this map, so this is the complete everything.

(This post was last modified: 01-19-2015, 08:49 AM by AGP.)
01-19-2015, 08:49 AM
Find Reply
Mudbill Offline
Muderator

Posts: 3,880
Threads: 59
Joined: Apr 2013
Reputation: 179
#5
RE: Unexpected End of File

Well, how is it working then? Not at all? What happens?

01-19-2015, 09:12 AM
Find Reply
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#6
RE: Unexpected End of File

Quote:[...]stop functioning as intended[...]

As intended? What was the intended occurence? What should happen?

"Veni, vidi, vici."
"I came, I saw, I conquered."
01-19-2015, 09:24 AM
Find Reply
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#7
RE: Unexpected End of File

Facepalm. I'm so sorry. I have figured out the problem. The script was intended for a phonograph, and it would constantly work incorrectly, however, I discovered the problem. The alState needed to be set to 0. Now everything runs just fine.

01-19-2015, 09:49 AM
Find Reply
Mudbill Offline
Muderator

Posts: 3,880
Threads: 59
Joined: Apr 2013
Reputation: 179
#8
RE: Unexpected End of File

Whoop whoop dee doo!

01-19-2015, 11:45 AM
Find Reply




Users browsing this thread: 1 Guest(s)