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
unexpected end of file, what's the problem?
P44RTHURN4X Offline
Junior Member

Posts: 35
Threads: 16
Joined: Apr 2012
Reputation: 0
#1
unexpected end of file, what's the problem?

Hey to all,

i was scripting 4 hours yet, and i added some timers, then my Custom Story don't works anyway! And there was an Error:
FATAL ERROR: Could not load script file 'custom_stories/House of Nightmare/maps/HoNmapSTART_STRT.hps'!
main (148,2) : ERR : Unexpected end of file
What is the Problem in my .hps file here?:

////////////////////////////
// Run first time starting map
void OnStart()
{
GiveItemFromFile("lantern", "lantern.ent");
AddEntityCollideCallback("Player", "enemy2_1_obj_wnodes_scf", "Enemy21ObjWnodesScf_1", true, 1);
AddUseItemCallback("", "doorkey_door_hon_scarechamber_obj_obj", "door_hon_scarechamber_obj", "DoorKeyDoorHonScarechamberObjObj_1", true);
AddEntityCollideCallback("Player", "carbinet_monster_smash_scf", "CarbinetMonsterSmashSCF_1", true, 1);
AddEntityCollideCallback("Player", "sc_door_smash_scf", "SCDoorSmashSCF_1", true, 1);
AddEntityCollideCallback("Player", "sc_go_slower_scf", "SCGoSlowerSCF_1", true, 1);
AddEntityCollideCallback("Player", "sc_smash_chest_open_scf", "SCSmashChestOpenSCF_1", true, 1);
AddEntityCollideCallback("Player", "sc_port_sc_scf", "SCPortSCSCF_1", true, 1);
}


void Enemy21ObjWnodesScf_1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("enemy2_1_obj_wnodes", true);
AddEnemyPatrolNode("enemy2_1_obj_wnodes", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("enemy2_1_obj_wnodes", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("enemy2_1_obj_wnodes", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("enemy2_1_obj_wnodes", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("enemy2_1_obj_wnodes", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("enemy2_1_obj_wnodes", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("enemy2_1_obj_wnodes", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("enemy2_1_obj_wnodes", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("enemy2_1_obj_wnodes", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("enemy2_1_obj_wnodes", "PathNodeArea_10", 4, "");
AddEnemyPatrolNode("enemy2_1_obj_wnodes", "PathNodeArea_11", 4, "");
ShowEnemyPlayerPosition("enemy2_1_obj_wnodes");
AddTimer("Timer_1", 4, "Timer_LookAt_1");
AddTimer("Timer_1_2", 4, "Timer_LookAt_1");
}


void Timer_LookAt_1(string &in asTimer)
{
string x = asTimer;
if (x == "Timer_1")
{
StartPlayerLookAt("enemy2_1_obj_wnodes");
FadeIn(1);
}
else if (x == "Timer_1_2")
{
StopPlayerLookAt();
PlaySoundAtEntity("", "react_sigh.snt", "Player", 0, false);
}
}


void DoorKeyDoorHonScarechamberObjObj_1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_hon_scarechamber_obj", false, false);
PlaySoundAtEntity("unlock_door.ogg", "unlock_door.snt", "door_hon_scarechamber_obj", 0, false);
RemoveItem("doorkey_door_hon_scarechamber_obj_obj");
AddDebugMessage("KeyOnDoor", false);
AddTimer("Timer_2", 2, "Timer_LookAt_2");
AddTimer("Timer_2_2", 2, "Timer_LookAt_2");
}


void Timer_LookAt_2(string &in asTimer)
{
string x = asTimer;
if (x == "Timer_2")
{
StartPlayerLookAt("door_hon_scarechamber_obj");
FadeIn(3);
}
else if(x == "Timer_2_2)
{
StopPlayerLookAt();
SetPlayerCrouching(false);
}
}


void CarbinetMonsterSmashSCF_1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("enemy1_1_obj_wnodes", true);
AddEnemyPatrolNode("enemy2_1_obj_wnodes", "PathNodeArea_12", 2, "");
AddEnemyPatrolNode("enemy2_1_obj_wnodes", "PathNodeArea_13", 4, "");
AddEnemyPatrolNode("enemy2_1_obj_wnodes", "PathNodeArea_14", 5, "");
AddEnemyPatrolNode("enemy2_1_obj_wnodes", "PathNodeArea_15", 2, "");
AddEnemyPatrolNode("enemy2_1_obj_wnodes", "PathNodeArea_16", 3, "");
AddEnemyPatrolNode("enemy2_1_obj_wnodes", "PathNodeArea_17", 0, "");
SetSwingDoorOpen("carbinet_smash_obj", ture, true);
PlaySoundAtEntity("react_pant_snt", "enemy_hallucination_disappear.snt", 0, false);
AddTimer("Timer_3", 1, "Timer_LookAt_3");
AddTimer("Timer_3_2", 1, "Timer_LookAt_3");
}


void Timer_LookAt_3(string &in asTimer)
{
string x = asTimer;
if (x == "Timer_3")
{
StartPlayerLookAt("enemy1_1_obj_wnodes");
FadeIn(2);
GiveSanityBoostSmall();
}
else if(x == "Timer_3_2")
{
StopPlayerLookAt();
FadeOut(0);
}
}


void SCDoorSmashSCF_1(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("door_hon_scarechamber_obj", true, true);
SetSwingDoorLocked("door_hon_scarechamber_obj", true, true);
PlaySoundAtEntity("guardboo", "guardian_distant1", "Player", 0, false);
PlaySoundAtEntity("thunderboo", "general_thunder.snt", "Player", 0, false);
}


void SCGoSlowerSCF_1(string &in asParent, string &in asChild, int alState)
{
SetPlayerSpeedMul(0.5f);
}


void SCSmashChestOpenSCF_1(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorOpen("chest_smash_open_obj", true, true);
PlaySoundAtEntity("react_pant.snt", "04_scream.snt", "Player", 0, false);
}


void SCPortSCSCF_1(string &in asParent, string &in asChild, int alState)
{
TeleportPlayer("that_is_your_nightmare_scf");
FadeOut(10);
FadeIn(07);
}


////////////////////////////
// Run when leaving map
void OnLeave()
{
SetPlayerActive(false);
SetPlayerCrouching(true);
}

since i was take the timers in the script file, it could not load my map! That is a really big project that i was making and i don't want to give it up!
Please help



GReeZe' P44
04-20-2012, 04:56 PM
Find
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#2
RE: unexpected end of file, what's the problem?

else if(x == "Timer_2_2)

Noob scripting tutorial: From Noob to Pro

04-20-2012, 05:15 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#3
RE: unexpected end of file, what's the problem?

When making if timers I would suggest you make it like this since it's easier:

here's an example
AddTimer("1", 2, "StartTimers");
AddTimer("2", 4, "StartTimers");
AddTimer("3", 6, "StartTimers");

void StartTimers(string &in asTimer)
{
if(asTimer == "1")
  {
    //Do stuff
  }
else if(asTimer == "2")
  {
   //Do Other stuff
  }
else if(asTimer == "3")
  {
  // Do even more stuff
  }
}

04-20-2012, 05:58 PM
Find
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#4
RE: unexpected end of file, what's the problem?

(04-20-2012, 05:58 PM)SilentStriker Wrote: When making if timers I would suggest you make it like this since it's easier:

here's an example
AddTimer("1", 2, "StartTimers");
AddTimer("2", 4, "StartTimers");
AddTimer("3", 6, "StartTimers");

void StartTimers(string &in asTimer)
{
if(asTimer == "1")
  {
    //Do stuff
  }
else if(asTimer == "2")
  {
   //Do Other stuff
  }
else if(asTimer == "3")
  {
  // Do even more stuff
  }
}
Well, there's always "case" if you are looking to optimize.


Noob scripting tutorial: From Noob to Pro

04-20-2012, 06:04 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#5
RE: unexpected end of file, what's the problem?

Yes that's true, I just thought this as a bit more simpler than having to declare x Smile

04-20-2012, 06:09 PM
Find
P44RTHURN4X Offline
Junior Member

Posts: 35
Threads: 16
Joined: Apr 2012
Reputation: 0
#6
RE: unexpected end of file, what's the problem?

(04-20-2012, 06:04 PM)Cranky Old Man Wrote:
(04-20-2012, 05:58 PM)SilentStriker Wrote: When making if timers I would suggest you make it like this since it's easier:

here's an example
AddTimer("1", 2, "StartTimers");
AddTimer("2", 4, "StartTimers");
AddTimer("3", 6, "StartTimers");

void StartTimers(string &in asTimer)
{
if(asTimer == "1")
  {
    //Do stuff
  }
else if(asTimer == "2")
  {
   //Do Other stuff
  }
else if(asTimer == "3")
  {
  // Do even more stuff
  }
}
Well, there's always "case" if you are looking to optimize.
No, this also don't works anyway... So I have to make maps completely without Timer-Scripting Sad


04-21-2012, 05:59 PM
Find
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#7
RE: unexpected end of file, what's the problem?

(04-21-2012, 05:59 PM)P44RTHURN4X Wrote: No, this also don't works anyway... So I have to make maps completely without Timer-Scripting Sad

Updated:
SetSwingDoorOpen("carbinet_smash_obj", ture, true);
PlaySoundAtEntity("react_pant_snt", "enemy_hallucination_disappear.snt", 0, false);

Simply proof-reading your code could go a long way, and you should also download either Geany or Notepad++ to do some of your proof-reading for you.

I removed two of the errors, because I saw that they were names.


Edit 3:
After actually looking at the code, I spotted it: You're calling each timer twice, essentially ending what you're doing a microsecond after you've done it. Don't call them at the same time. Actually, don't call the functions twice at all.

If we're going to use SilentStrikers code:

AddTimer("Timer_1",    2,  "StartTimers");
AddTimer("Timer_1_2",  4, "StartTimers");
AddTimer("Timer_2",    6,  "StartTimers");
AddTimer("Timer_2_2",  8, "StartTimers");
AddTimer("Timer_3",   10,  "StartTimers");
AddTimer("Timer_3_2", 12, "StartTimers");
}


void StartTimers(string &in asTimer)
{
if(asTimer == "Timer_1")
  {
  //Do stuff
  }
else if(asTimer == "Timer_1_2")
  {
  //Do Other stuff
  }
else if(asTimer == "Timer_2")
  {
  // Do even more stuff
  }

// ...and so on...

}


Noob scripting tutorial: From Noob to Pro

(This post was last modified: 04-21-2012, 06:49 PM by Cranky Old Man.)
04-21-2012, 06:17 PM
Find
P44RTHURN4X Offline
Junior Member

Posts: 35
Threads: 16
Joined: Apr 2012
Reputation: 0
#8
RE: unexpected end of file, what's the problem?

TO ALL:
thanks for your help, i have found another kind of scripting the timers. Thats really working, Wink
But I need help again!
I've another problem:
What's wrong with that script?:
hps:
AddEntityCollideCallback("Player", "set_message_scf", "SetMessageSCF_1", true, 1);
}


void SetMessageSCF_1(string &in asParent, string &in asChild, int alState)
{
SetMessage("SetMes_1", 1.0f, "set_message_test");
}


englang:
<CATEGORY Name="SetMes_1">
<Entry Name="set_message_test">This is test 1</Entry>
</CATEGORY>
04-22-2012, 07:55 PM
Find
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#9
RE: unexpected end of file, what's the problem?

Your SetMessage() syntax is wrong. Check the wiki.


Noob scripting tutorial: From Noob to Pro

(This post was last modified: 04-22-2012, 08:21 PM by Cranky Old Man.)
04-22-2012, 08:21 PM
Find
P44RTHURN4X Offline
Junior Member

Posts: 35
Threads: 16
Joined: Apr 2012
Reputation: 0
#10
RE: unexpected end of file, what's the problem?

(04-22-2012, 08:21 PM)Cranky Old Man Wrote: Your SetMessage() syntax is wrong. Check the wiki.
What is the right "syntax"? SetMessageCallback()?
04-23-2012, 06:42 PM
Find




Users browsing this thread: 1 Guest(s)