ohheylookitsmax
Junior Member
Posts: 13
Threads: 1
Joined: May 2013
Reputation:
0
|
New To Scripting
Hi everyone. I'm really new to scripting and creating custom stories. I keep trying to test out my map so far, but each time, I get an error notice as follows: FATAL ERROR: Could not load script file(my directories for my .hps)! main (10,1) : ERR : Unexpected token '{'
I assume it has something to do with the way I set up the script file. Here is my .hps file.
void OnStart()
{
AddUseItemCallback("", "FrontDoorKey", "Front_door", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
PlaySoundAtEntity("", "pick_key", "FrontDoorKey", 0, false);
}
{
SetSwingDoorLocked("Front_door", false, true);
PlaySoundAtEntity("", "unlock_door", "Front_door", 0, false);
RemoveItem("FrontDoorKey");
}
Any help would be greatly appreciated. I'm not sure where I can go online to learn about scripting, so if anyone knows where I might find that, it would also be a LARGE help. Thank you. Also, here while I'm doing this, I'm going to put my extra_english.lang script file down below as well to see if anyone can correct it, if needed.
<LANGUAGE>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">Willam Thomas has always lived a simple, quiet life. This is all about to change on one spring morning in Wales, Ireland, in 1934.</Entry>
</CATEGORY>
</CATEGORY Name ="Inventory">
<Entry Name="ItemDesc_FrontDoorKey"> "Key to the front door."</Entry>
<Entry Name="ItemName_FrontDoorKey">Front Door Key</Entry>
</CATEGORY>
<CATEGORY Name="Journal">
<Entry Name="Note_ToDoList_Name">To Do List</Entry>
<Entry Name="Note_ToDoList_Text">Today is the big day. I've finally written down everything I need to do today. I've rang the taxi. I must meet them out side of town on the main road. Next, I must carry my belongings out to the road with me. I also shouldn't forget the taxi fare and, of course, my favorite little paperweight. I think I put it in a chest in the back somewhere...</Entry>
</CATEGORY>
</LANGUAGE>
To be clear, I read the important thread but I just don't get it. I tried following the instructions and it ended up creating more file problems.
Here's my file now:
void OnStart()
{
AddUseItemCallback("", "FrontDoorKey", "Front_door", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
PlaySoundAtEntity("", "pick_key", "FrontDoorKey", 0, false);
}
{
SetSwingDoorLocked("Front_door", false, true);
PlaySoundAtEntity("", "unlock_door", "Front_door", 0, false);
RemoveItem("FrontDoorKey");
}
the error report i get now is for lines 12 13 and 14 about needing expected identifiers. Basically they keep pointing out the parenthesis that I've marked in bold. I really don't know what to do. Please help.
|
|
05-24-2013, 08:16 PM |
|
The chaser
Posting Freak
Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation:
113
|
RE: New To Scripting
It's:
void OnStart()
{
AddUseItemCallback("", "FrontDoorKey", "Front_door", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
PlaySoundAtEntity("", "pick_key", "FrontDoorKey", 0, false);
SetSwingDoorLocked("Front_door", false, true);
PlaySoundAtEntity("", "unlock_door", "Front_door", 0, false);
RemoveItem("FrontDoorKey");
}
You had a few more innecessary things
THE OTHERWORLD (WIP)
Aculy iz dolan.
|
|
05-24-2013, 08:52 PM |
|
ohheylookitsmax
Junior Member
Posts: 13
Threads: 1
Joined: May 2013
Reputation:
0
|
RE: New To Scripting
(05-24-2013, 08:52 PM)The chaser Wrote: It's:
void OnStart()
{
AddUseItemCallback("", "FrontDoorKey", "Front_door", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
PlaySoundAtEntity("", "pick_key", "FrontDoorKey", 0, false);
SetSwingDoorLocked("Front_door", false, true);
PlaySoundAtEntity("", "unlock_door", "Front_door", 0, false);
RemoveItem("FrontDoorKey");
}
You had a few more innecessary things
I copied what you gave me into my hps and it worked! The only issue im having now is with my .lang file. None of the entities' names show up :/
|
|
05-24-2013, 09:12 PM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: New To Scripting
A single mistake in the .lang file can result in the whole file not working.
You could show us the file, if it isn't too long.
EDIT: I see you have already posted it. My mistake. I'll take a look
In your second question about the script:
{
SetSwingDoorLocked("Front_door", false, true);
PlaySoundAtEntity("", "unlock_door", "Front_door", 0, false);
RemoveItem("FrontDoorKey");
}
This part needs a "void something" to work.
when you want something to happen in your map, by script, it looks like this:
void NameOfScript(Parameters, specifying what kind of script)
{
Here you put all your script lines
}
///////////////////////////
Here is the mistake in the .lang file:
</CATEGORY Name ="Inventory">
It should be
<CATEGORY Name ="Inventory">
You only put a / when you want to end something. Here you are starting something
Trying is the first step to success.
|
|
05-24-2013, 09:40 PM |
|
ohheylookitsmax
Junior Member
Posts: 13
Threads: 1
Joined: May 2013
Reputation:
0
|
RE: New To Scripting
(05-24-2013, 09:40 PM)BeeKayK Wrote: A single mistake in the .lang file can result in the whole file not working.
You could show us the file, if it isn't too long.
EDIT: I see you have already posted it. My mistake. I'll take a look
In your second question about the script:
{
SetSwingDoorLocked("Front_door", false, true);
PlaySoundAtEntity("", "unlock_door", "Front_door", 0, false);
RemoveItem("FrontDoorKey");
}
This part needs a "void something" to work.
when you want something to happen in your map, by script, it looks like this:
void NameOfScript(Parameters, specifying what kind of script)
{
Here you put all your script lines
}
///////////////////////////
Here is the mistake in the .lang file:
</CATEGORY Name ="Inventory">
It should be
<CATEGORY Name ="Inventory">
You only put a / when you want to end something. Here you are starting something
I thought it was working and for some reason it's not. When I go to pick up the key and read the note, the text does not show up. Here is my .lang file now:
<LANGUAGE>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">Willam Thomas has always lived a simple, quiet life. This is all about to change on one spring morning in Wales, Ireland, in 1934.</Entry>
</CATEGORY>
<CATEGORY Name ="Inventory">
<Entry Name="ItemDesc_FrontDoorKey">"Key to the front door."</Entry>
<Entry Name="ItemName_FrontDoorKey">Front Door Key</Entry>
</CATEGORY>
<CATEGORY Name="Journal">
<Entry Name="Note_ToDoList_Name">To Do List</Entry>
<Entry Name="Note_ToDoList_Text">Today is the big day. I've finally written down everything I need to do today. I've rang the taxi. I must meet them out side of town on the main road. Next, I must carry my belongings out to the road with me. I also shouldn't forget the taxi fare and, of course, my favorite little paperweight. I think I put it in a chest around the side of the house...</Entry>
</CATEGORY>
</LANGUAGE>
Do you think there was anything else wrong with it?
|
|
05-24-2013, 11:24 PM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: New To Scripting
<Entry Name="ItemDesc_FrontDoorKey">"Key to the front door."</Entry>
This line. I don't think you can have quotations in there
Trying is the first step to success.
|
|
05-25-2013, 12:33 AM |
|
ohheylookitsmax
Junior Member
Posts: 13
Threads: 1
Joined: May 2013
Reputation:
0
|
RE: New To Scripting
(05-25-2013, 12:33 AM)BeeKayK Wrote: <Entry Name="ItemDesc_FrontDoorKey">"Key to the front door."</Entry>
This line. I don't think you can have quotations in there
I tried taking the quotes off of Key to the front door. It didn't work. :/ Any other suggestions?
|
|
05-25-2013, 01:26 AM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: New To Scripting
Give me the whole lang file. The one earlier is not enough. I need the whole thing.
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
05-25-2013, 02:03 AM |
|
ohheylookitsmax
Junior Member
Posts: 13
Threads: 1
Joined: May 2013
Reputation:
0
|
RE: New To Scripting
(05-25-2013, 02:03 AM)JustAnotherPlayer Wrote: Give me the whole lang file. The one earlier is not enough. I need the whole thing.
<LANGUAGE>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">Willam Thomas has always lived a simple, quiet life. This is all about to change on one spring morning in Wales, Ireland.</Entry>
</CATEGORY>
<CATEGORY Name ="Inventory">
<Entry Name="ItemDesc_FrontDoorKey">Key to the front door.</Entry>
<Entry Name="ItemName_FrontDoorKey">Front Door Key</Entry>
</CATEGORY>
<CATEGORY Name="Journal">
<Entry Name="Note_ToDoList_Name">To Do List</Entry>
<Entry Name="Note_ToDoList_Text">Today is the big day. I've finally written down everything I need to do today. I've rang the taxi. I must meet them out side of town on the main road. Next, I must carry my belongings out to the road with me. I also shouldn't forget the taxi fare and, of course, my favorite little paperweight. I think I put it in a chest around the side of the house...</Entry>
</CATEGORY>
</LANGUAGE>
Here is everything I have. Any suggestions you can offer would be of great help.
|
|
05-25-2013, 02:10 AM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: New To Scripting
Hmm. Nothing is wrong. I compare it with my own .lang file and check it with the Lang Editor. Nothing is wrong. Make sure the names in the Level Editor is the same as the one in the .lang file.
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
05-25-2013, 02:15 AM |
|
|