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 Fatal Error
SystemFail Offline
Junior Member

Posts: 11
Threads: 2
Joined: Jun 2013
Reputation: 0
#1
Sad  Script Fatal Error

Hi everyone. I am new at forum and my english is not very good really, so i need help about my script. My script in .hps file is
void OnStart()
{
AddUseItemCallback("", "TheKey_1", "door_1", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem("TheKey_1");
}



{
AddEntityCollideCallback("Player", "The_Quest_Area", "GetTheQuest", true, 1);
AddEntityCollideCallback("Player", "The_Complete_Area", "FinishTheQuest", true, 1);
}

void GetTheQuest(string &in asParent, string &in asChild, int alState)
{
AddQuest("thequest", "TheQuest");
}

void FinishTheQuest(string &in asParent, string &in asChild, int alState)
{
CompleteQuest("thequest", "TheQuest");
}
I am getting the Fatal error when i try to enter my custom story. The error is; FATAL ERROR:Could not load script file custom_stories/bla/maps/bla.hps!
main(15,1):ERR:Unexpected '{'
Thanks for your help,
06-15-2013, 08:09 PM
Find
7heDubz Offline
Posting Freak

Posts: 1,329
Threads: 40
Joined: Feb 2013
Reputation: 41
#2
RE: Script Fatal Error

{
AddEntityCollideCallback("Player", "The_Quest_Area", "GetTheQuest", true, 1);
AddEntityCollideCallback("Player", "The_Complete_Area", "FinishTheQuest", true, 1);
}


it has nothing to trigger it. no void coming before it. Its just kind of ... there. try putting it in the brackets under void onstart, unless of course you only want it to happen if UsedKeyOnDoor in which case it needs to go in those brackets.


For future trouble shooting (x,y) when the game gives you that error those number mean the following


x = which line it is on
y = how many character to the right the problem is occurring at.


if you take a look at the error code (15/1) it is pointing directly at the brackets. specifically the end bracket.

06-15-2013, 08:17 PM
Find
SystemFail Offline
Junior Member

Posts: 11
Threads: 2
Joined: Jun 2013
Reputation: 0
#3
RE: Script Fatal Error

It's not working anyway.
06-15-2013, 08:39 PM
Find
7heDubz Offline
Posting Freak

Posts: 1,329
Threads: 40
Joined: Feb 2013
Reputation: 41
#4
RE: Script Fatal Error

new code? (x,y)

06-15-2013, 08:42 PM
Find
SystemFail Offline
Junior Member

Posts: 11
Threads: 2
Joined: Jun 2013
Reputation: 0
#5
RE: Script Fatal Error

Expected identifier
06-15-2013, 08:44 PM
Find
7heDubz Offline
Posting Freak

Posts: 1,329
Threads: 40
Joined: Feb 2013
Reputation: 41
#6
RE: Script Fatal Error

what are the numbers???

it might be talking about this line


PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);



asSoundName - internal name
asSoundFile - the sound to use + extension .snt
asEntity - the entity to create the sound at, can be “Player”
afFadeTime- time in seconds the sound needs to fade. Avoids enemies hearing the sound if afFadeTime is at least 0.1f
abSaveSound - if true, a looping sound will “remember” its playback state (currently playing/stopped), and that state will be restored the next time the level is entered. If true, the sound is never attached to the entity! Note that saving should only be used on looping sounds!



this PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
should turn into this
PlaySoundAtEntity("", "unlock_door.snt", "door_1", 0f, false);

(This post was last modified: 06-15-2013, 08:57 PM by 7heDubz.)
06-15-2013, 08:56 PM
Find
SystemFail Offline
Junior Member

Posts: 11
Threads: 2
Joined: Jun 2013
Reputation: 0
#7
RE: Script Fatal Error

Sory, its still unexpected token '{'. I putted in brackets under void OnStart as you said. But im getting the same error. And the numbers are 19,1.
I have no problems about door. Door and sound are working perfect. Now my script is

void OnStart()
{
AddEntityCollideCallback("Player", "Ahmet_Quest_Area", "GetAhmetQuest", true, 1);
AddEntityCollideCallback("Player", "Ahmet_Complete_Area", "FinishAhmetQuest", true, 1);
}

void GetTheQuest(string &in asParent, string &in asChild, int alState)
{
AddQuest("ahmetquest", "AhmetQuest");
}

void FinishTheQuest(string &in asParent, string &in asChild, int alState)
{
CompleteQuest("ahmetquest", "AhmetQuest");
}



{
AddUseItemCallback("", "TheKey_1", "door_1", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem("TheKey_1");
}


I have a mistake, but i dont know what.

i found a random name on internet. It's ahmet. really i like it Big Grin
(This post was last modified: 06-15-2013, 09:14 PM by SystemFail.)
06-15-2013, 09:05 PM
Find
7heDubz Offline
Posting Freak

Posts: 1,329
Threads: 40
Joined: Feb 2013
Reputation: 41
#8
RE: Script Fatal Error

http://wiki.frictionalgames.com/hpl2/tut...t_beginner
Read this please.

Okay
Spoiler below!

void FinishTheQuest(string &in asParent, string &in asChild, int alState)
{
CompleteQuest("ahmetquest", "AhmetQuest");
}



{
AddUseItemCallback("", "TheKey_1", "door_1", "UsedKeyOnDoor", true);
}


the problem with this right here is that everytime you put void EVERYTHING you want to happen in it goes into ONE set of brackets
so
Spoiler below!

void FinishTheQuest(string &in asParent, string &in asChild, int alState)
{
EVERYTHING YOU WANT TO HAPPEN HERE HAS TO GO HERE INBETWEEN THESE BRACKETS.
}

Here's a rudimentary explanation
whats inside of the brackets define effect. the cause is written in above it. EX.
Spoiler below!

THE CAUSE
void OnStart()

THE EFFECT
{
AddUseItemCallback("", "TheKey_1", "door_1", "UsedKeyOnDoor", true);
}

You have some brackets just sitting there in your script randomly. (an effect without a cause) let me show you where exactly
Spoiler below!

void OnStart()
{
AddEntityCollideCallback("Player", "Ahmet_Quest_Area", "GetAhmetQuest", true, 1);
AddEntityCollideCallback("Player", "Ahmet_Complete_Area", "FinishAhmetQuest", true, 1);
}

void GetTheQuest(string &in asParent, string &in asChild, int alState)
{
AddQuest("ahmetquest", "AhmetQuest");
}

void FinishTheQuest(string &in asParent, string &in asChild, int alState)
{
CompleteQuest("ahmetquest", "AhmetQuest");
}



{
AddUseItemCallback("", "TheKey_1", "door_1", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem("TheKey_1");
}


THAT is why it is saying that "the { is unexpected because it has no cause so why is there an effect?"

(This post was last modified: 06-15-2013, 09:22 PM by 7heDubz.)
06-15-2013, 09:20 PM
Find
SystemFail Offline
Junior Member

Posts: 11
Threads: 2
Joined: Jun 2013
Reputation: 0
#9
RE: Script Fatal Error

I tried that a hour ago. When u said that I tried your settings as same as mine. But i am getting the same error. Really i read the scripting basics for many times.

Still in darkness...
06-15-2013, 09:27 PM
Find
7heDubz Offline
Posting Freak

Posts: 1,329
Threads: 40
Joined: Feb 2013
Reputation: 41
#10
RE: Script Fatal Error

(06-15-2013, 09:27 PM)SystemFail Wrote: I tried that a hour ago. When u said that I tried your settings as same as mine. But i am getting the same error. Really i read the scripting basics for many times.

Did you seriously read and understand everything i just wrote that fast?

take a look at your script again and make sure that EVERY effect has a cause. (of which yours doesnt)

Spoiler below!

void OnStart()
{
AddEntityCollideCallback("Player", "Ahmet_Quest_Area", "GetAhmetQuest", true, 1);
AddEntityCollideCallback("Player", "Ahmet_Complete_Area", "FinishAhmetQuest", true, 1);
}

void GetTheQuest(string &in asParent, string &in asChild, int alState)
{
AddQuest("ahmetquest", "AhmetQuest");
}

void FinishTheQuest(string &in asParent, string &in asChild, int alState)
{
CompleteQuest("ahmetquest", "AhmetQuest");
}

// Move this up and get rid of the brackets to void on start because its just using the key on the door. This is a CAUSE. the effect is in red in the next spoiler. \\

{
AddUseItemCallback("", "TheKey_1", "door_1", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem("TheKey_1");
}


Spoiler below!

void OnStart()
{
// this paticular peice here has no effect. its a cause without effect. your effect that this point to would be "void GetAhmetQuest" of which you have non. \\

AddEntityCollideCallback("Player", "Ahmet_Quest_Area", "GetAhmetQuest", true, 1);

// here it happens again. i assume you mean the one in this the code that doesnt have "Ah" in it but programs cant assume \\
AddEntityCollideCallback("Player", "Ahmet_Complete_Area", "FinishAhmetQuest", true, 1);


AddUseItemCallback("", "TheKey_1", "door_1", "UsedKeyOnDoor", true);

}

void GetTheQuest(string &in asParent, string &in asChild, int alState)
{
AddQuest("ahmetquest", "AhmetQuest");
}

void FinishTheQuest(string &in asParent, string &in asChild, int alState)
{
CompleteQuest("ahmetquest", "AhmetQuest");
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem("TheKey_1");
}


(This post was last modified: 06-15-2013, 09:48 PM by 7heDubz.)
06-15-2013, 09:46 PM
Find




Users browsing this thread: 1 Guest(s)