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


Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fatal Error Help!!
tigerlillymaya13 Offline
Junior Member

Posts: 43
Threads: 7
Joined: Feb 2017
Reputation: 0
#1
Not Solved Fatal Error Help!!

I had my first map working, after someone on this site, figured out what I done wrong with scripting. I have watched many video for scripting and have compared my scripting for my map scripting, it looks the same, but I keep getting a Fatal Error could not load script file.......I am reinstalling Amnesia to see if that will help. Here is what I have so far...For my Extra English.lang and my custom stories settings
For my Extra English.lang file below:
LANGUAGE>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description"> </Entry>
</CATEGORY>

<CATEGORY Name="Journal">

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//---------------------------------------Notes--------------------------------------------------------------------//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
<Entry Name="Note_Dear Samantha_Name"> Dear Samantha</Entry>
<Entry Name="Note_Dear Samantha_Text"> Dear Samantha, I hope you will find the answers you are looking for about your uncle. I cannot stress this enough be careful, your uncle did alot of research in that house and who knows what chemicals he worked with. Anyways, we miss you and please keep in touch. Love Mom. </Entry>

<Entry Name="Note_Statues Are Watching_Name"> They Are Watching Note</Entry>
<Entry Name="Note_Statues Are Watching_Text"> I cannot take it anymore. [br] I am going crazy. They are watching my every move, I just know it. Those creepy statues. Whoever reads this letter, I fear it is too late, they already know you are here...[br] they are always watching... [br] unless you can find the...[br] </Entry>

<Entry Name="Note__Research_Name"> Research</Entry>
<Entry Name="Note_Research_Text"> My worst fears have come true. Jackson has gone mad, I knew this was bad idea. Now we our trapped </Entry>

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//---------------------------------------Diaries-------------------------------------------------------------------//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
<Entry Name="Note_NoteStranger_Name">
<Entry Name="Note_NoteStranger_Text"> </Entry>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//---------------------------------------Levels-------------------------------------------------------------------//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
<CATEGORY Name="Levels">
<Entry Name="MainHallLevel"MainHall Level </Entry>
<Entry Name="RoomLevel" Room Level </Entry>
</CATEGORY>

<CATEGORY Name="CustomCatLevels">
<Entry Name="CustomEntryLevel"> The door is locked.</Entry>
</CATEGORY>

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------Messages---------------------------------------------------------//
//////////////////////////////////////////////////////////////////////////////////////

and my Custom Stories Settings... Listed below
<Main
ImgFile = ""
Name = "Deadly Secrets"
Author = "Tigerlillymaya"

MapsFolder = "maps"
StartMap = "01.room.map"
StartPos = "PlayerStartArea_1"

/>
(This post was last modified: 12-11-2017, 12:05 AM by tigerlillymaya13.)
12-10-2017, 07:11 PM
Find Reply
Mudbill Offline
Muderator

Posts: 3,734
Threads: 59
Joined: Apr 2013
Reputation: 173
#2
Not Solved RE: Fatal Error Help!!

If you get a "Fatal error: Could not load script file" then that means you have a syntax error in your script file. The custom_story_settings.cfg and extra_english.lang files should not have any impact on that fact.

What's useful for us to know is the contents of your script file and the error message you get. The error will say something like (5, 20) which means line 5, character 20. That will say where the error started.

PS: I recommend you paste the contents into [ php] tags here. Makes it easier to read. Example:
Spoiler below!

[php]void code()[/php]
becomes:
PHP Code: (Select All)
void code() 


(This post was last modified: 12-11-2017, 01:25 AM by Mudbill.)
12-11-2017, 01:21 AM
Find Reply
tigerlillymaya13 Offline
Junior Member

Posts: 43
Threads: 7
Joined: Feb 2017
Reputation: 0
#3
Not Solved RE: Fatal Error Help!!

It says Fatal Error could not load script file, customstories/deadly secrets/maps/rooms.hps, main (20, 1), if the error is referring to the room map line 20 has nothing...

///////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "Room Key, "Bedroom", "UsekeyOnDoor", true);
}


Void UseKeyOnDoor(string &in asItem, string &in asEntity);
{
SetLevelDoorLocked(Bedroom, false, true);
void PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);
RemoveItem(asItem);
}

{
void OnLeave()

{

}
(This post was last modified: 12-11-2017, 05:06 PM by tigerlillymaya13.)
12-11-2017, 04:27 PM
Find Reply
Mudbill Offline
Muderator

Posts: 3,734
Threads: 59
Joined: Apr 2013
Reputation: 173
#4
Not Solved RE: Fatal Error Help!!

Void UseKeyOnDoor(string &in asItem, string &in asEntity);

This line has 2 issues. First, void should be lower case. Second, the semi-colon at the end is messing things up, because this is a constructor for a function, not a function call.

The numbers in parenthesis will usually say where the issue occurs, but certain issues makes this impossible, and it will simply state either the first or last character of the file.

Edit:
AddUseItemCallback("", "Room Key, "Bedroom", "UsekeyOnDoor", true);
This line also has at least one issue, and that is the missing quote after "Room Key". Another potential issue is that you're using a space in the Room Key name, which may or may not actually work. Lastly, UsekeyOnDoor does not match your function name in regards to capital letters. Be careful with those!

Edit 2:
SetLevelDoorLocked(Bedroom, false, true);
Here, Bedroom is lacking quotes around it, so it gives an error.

void PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);
Remove "void" from here, because you're not declaring a function, you're calling one.

Right before "void OnLeave()" you have an opening bracket for whatever reason. That is also an error. Remove it.

(This post was last modified: 12-11-2017, 10:59 PM by Mudbill.)
12-11-2017, 10:54 PM
Find Reply
tigerlillymaya13 Offline
Junior Member

Posts: 43
Threads: 7
Joined: Feb 2017
Reputation: 0
#5
Not Solved RE: Fatal Error Help!!

Does this look right to you? I made the changes you suggested and even matched the names in my map and lang file. Now it is saying that here is an error with 9,20, 10,19,11,12 and 14,1.

///////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "RoomKey", "Bedroom", "usekeyondoor", true);
}

void usekeyondoor(string &in asItem, string &in asEntity);
SetLevelDoorLocked("Bedroom", false, true);
PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);
RemoveItem(asItem);

void OnLeave()
}
(This post was last modified: 12-12-2017, 04:58 PM by tigerlillymaya13.)
12-12-2017, 04:57 PM
Find Reply
Abion47 Offline
Senior Member

Posts: 355
Threads: 22
Joined: Oct 2015
Reputation: 46
#6
Not Solved RE: Fatal Error Help!!

Okay.

First, you NEED to start practicing proper indenting of your code. Not only does it make your code much cleaner and easier to read and write, it also pinpoints simple mistakes. For example, if I was to take your code and indent it based on the placements of curly braces, several sources of the problem becomes obvious:

PHP Code: (Select All)
///////////////////////////
// Run when the map starts
void OnStart()
{
    
AddUseItemCallback("""RoomKey""Bedroom""usekeyondoor"true);
}

void usekeyondoor(string &in asItemstring &in asEntity);
SetLevelDoorLocked("Bedroom"falsetrue);
PlaySoundAtEntity("""unlock_door.snt"asEntity0false);
RemoveItem(asItem);

void OnLeave()


Every single line of code after void usekeyondoor(string &in asItem, string &in asEntity); is orphaned, meaning it has no function that it belongs to. This is not allowed in this scripting language - the vast majority of code that you write for HPL2 has to exist within a function.

The reason that it is orphaned is because of two things. First, you put a semicolon (";") at the end of the function declaration, which effectively ends the function. Second, you did not put any curly braces ("{" and "}") after the function declaration to encapsulate the code that will be inside the function. The engine cannot magically read your mind and deduce what you want it to do. If you want the code to be in a function, you have to tell it to be in a function.

Another issue is that last trailing closing curly brace ("}") at the end of your code. This has no preceding open curly brace ("{") and so is going to be orphaned as well, causing an error.

However, if in either my or Modbull's explanation of things you ever got confused by terminology such as "function declaration", then there is a more fundamental issue here. Your understanding of programming is extremely piecemeal, and you don't have the base knowledge required to read and write functional scripts. Rather than spend weeks or months trying to cobble together a general understanding, it will be much easier for you to go through a proper tutorial series and learn programming properly. I recommend a language like Javascript as a balance of ease of learning and similarity to HPL2. Go through the lessons at the link below, then revisit your code, at which point many of the mistakes you're making will become more clear.

http://www.learn-js.org/

12-12-2017, 11:51 PM
Find Reply
tigerlillymaya13 Offline
Junior Member

Posts: 43
Threads: 7
Joined: Feb 2017
Reputation: 0
#7
Not Solved RE: Fatal Error Help!!

Thank you for your help. I am very, very new at this and have no experience in coding. I have watched many YouTube videos on coding for Amnesia, especially videos by Mudbill. I have gone to the site where it lists the various codes for the different functions. I will take a look at the link you provided.
(This post was last modified: 12-13-2017, 08:35 PM by tigerlillymaya13.)
12-13-2017, 05:05 PM
Find Reply
tigerlillymaya13 Offline
Junior Member

Posts: 43
Threads: 7
Joined: Feb 2017
Reputation: 0
#8
Not Solved RE: Fatal Error Help!!

I solved the problem. I ended up getting rid of the coding that I had, I used an old one that I had done and it worked. Thank you for all help!
(This post was last modified: 12-13-2017, 11:21 PM by tigerlillymaya13.)
12-13-2017, 11:20 PM
Find Reply


[-]
Quick Reply
Message
Type your reply to this message here.

Human Verification
Please tick the checkbox that you see below. This process is used to prevent automated spam bots.



Users browsing this thread: 1 Guest(s)