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?
Rapsis Offline
Member

Posts: 69
Threads: 6
Joined: Oct 2012
Reputation: 0
#1
Script fatal error?

Hey everyone,
I'm making a custom story, and I get this error:
FATAL ERROR:
Could not load script file 'custom_stories/*secret*/maps/map1.hps'!
main (10,11) : ERR : Expected identifier
main (11,1) : ERR : Unexpected token '{'

My map1.hps


void OnStart()
{
AddEntityCollideCallback("Player", "Studydooropen", "CollideRoomTwo", true, -1);
}

void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_2", true, true);
}
AddUseItemCallback("", "bedroomkey_1", "mansion_1", "UsedKeyOnDoor", true);
{
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("bedroomkey_1");
}

void OnLeave()
{

}

Could you explain what am I doing wrong? I'm just a beginner at both HTML and the level editor, so if anybody could fix the code and explain, it would mean a lot to me as I would learn.

P.S. Sorry for my terrible English!
10-13-2012, 06:12 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#2
RE: Script fatal error?

Hello! There is one error in your script file:

Spoiler below!

AddUseItemCallback("", "bedroomkey_1", "mansion_1", "UsedKeyOnDoor", true);
{
}




-You cannot use a function as a header; it has to be something like: void func(callback syntax)
-All callbacks should be placed under OnStart (very few exceptions) regardless of when they're used in the map.

Here's a fix, simply delete your current .hps file's content then copy & paste this in:

Spoiler below!


void OnStart()
{
AddEntityCollideCallback("Player", "Studydooropen", "CollideRoomTwo", true, 0);
AddUseItemCallback("", "bedroomkey_1", "mansion_1", "UsedKeyOnDoor", true);
}

void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_2", true, true);
}

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

void OnLeave()
{

}


I rate it 3 memes.
(This post was last modified: 10-13-2012, 06:23 PM by Adny.)
10-13-2012, 06:22 PM
Find
Rapsis Offline
Member

Posts: 69
Threads: 6
Joined: Oct 2012
Reputation: 0
#3
RE: Script fatal error?

(10-13-2012, 06:22 PM)andyrockin123 Wrote: Hello! There is one error in your script file:

Spoiler below!

AddUseItemCallback("", "bedroomkey_1", "mansion_1", "UsedKeyOnDoor", true);
{
}




-You cannot use a function as a header; it has to be something like: void func(callback syntax)
-All callbacks should be placed under OnStart (very few exceptions) regardless of when they're used in the map.

Here's a fix, simply delete your current .hps file's content then copy & paste this in:

Spoiler below!


void OnStart()
{
AddEntityCollideCallback("Player", "Studydooropen", "CollideRoomTwo", true, 0);
AddUseItemCallback("", "bedroomkey_1", "mansion_1", "UsedKeyOnDoor", true);
}

void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_2", true, true);
}

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

void OnLeave()
{

}

Yes, this made my game turn on, thanks! Though the door doesn't open when I enter the script area. None of the names have mistakes. Any help?

Whoops, silly me, I'm doing it wrong! Thanks for the help!

Ok, I don't get this at all, I simply added a new line:


void OnStart()
{
AddEntityCollideCallback("Player", "Studydooropen", "CollideRoomTwo", true, 0);
AddUseItemCallback("", "bedroomkey_1", "mansion_1", "UsedKeyOnDoor", true);
}

void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_2", true, true);
SetSwingDoorLocked("mansion_2");
}

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

void OnLeave()
{

}

And now it gives me a "No matching signatures" error!
(This post was last modified: 10-13-2012, 06:45 PM by Rapsis.)
10-13-2012, 06:31 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#4
RE: Script fatal error?

No matching signatures means you don't have the proper amount/type of arguments in the function:

SetSwingDoorLocked(string& asName, bool abLocked, bool abEffects);

SetSwingDoorLocked("mansion_2", true, true);

I rate it 3 memes.
10-13-2012, 06:47 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#5
RE: Script fatal error?

(10-13-2012, 06:31 PM)Rapsis Wrote:
(10-13-2012, 06:22 PM)andyrockin123 Wrote: Hello! There is one error in your script file:

Spoiler below!

AddUseItemCallback("", "bedroomkey_1", "mansion_1", "UsedKeyOnDoor", true);
{
}




-You cannot use a function as a header; it has to be something like: void func(callback syntax)
-All callbacks should be placed under OnStart (very few exceptions) regardless of when they're used in the map.

Here's a fix, simply delete your current .hps file's content then copy & paste this in:

Spoiler below!


void OnStart()
{
AddEntityCollideCallback("Player", "Studydooropen", "CollideRoomTwo", true, 0);
AddUseItemCallback("", "bedroomkey_1", "mansion_1", "UsedKeyOnDoor", true);
}

void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_2", true, true);
}

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

void OnLeave()
{

}

Yes, this made my game turn on, thanks! Though the door doesn't open when I enter the script area. None of the names have mistakes. Any help?

Whoops, silly me, I'm doing it wrong! Thanks for the help!

Ok, I don't get this at all, I simply added a new line:


void OnStart()
{
AddEntityCollideCallback("Player", "Studydooropen", "CollideRoomTwo", true, 0);
AddUseItemCallback("", "bedroomkey_1", "mansion_1", "UsedKeyOnDoor", true);
}

void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_2", true, true);
SetSwingDoorLocked("mansion_2");
}

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

void OnLeave()
{

}

And now it gives me a "No matching signatures" error!
void OnStart()
{
AddEntityCollideCallback("Player", "Studydooropen", "CollideRoomTwo", true, 0);
AddUseItemCallback("", "bedroomkey_1", "mansion_1", "UsedKeyOnDoor", true);
}

void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_2", true, true);
SetSwingDoorLocked("mansion_2", false, true);
}

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

void OnLeave()
{

}

This should solve the problem. The structure of SetSwingDoorLocked is:
void SetSwingDoorLocked(string& asName, bool abLocked, bool abEffects);

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
10-13-2012, 06:48 PM
Find
Rapsis Offline
Member

Posts: 69
Threads: 6
Joined: Oct 2012
Reputation: 0
#6
RE: Script fatal error?

(10-13-2012, 06:48 PM)The chaser Wrote:
(10-13-2012, 06:31 PM)Rapsis Wrote:
(10-13-2012, 06:22 PM)andyrockin123 Wrote: Hello! There is one error in your script file:

Spoiler below!

AddUseItemCallback("", "bedroomkey_1", "mansion_1", "UsedKeyOnDoor", true);
{
}




-You cannot use a function as a header; it has to be something like: void func(callback syntax)
-All callbacks should be placed under OnStart (very few exceptions) regardless of when they're used in the map.

Here's a fix, simply delete your current .hps file's content then copy & paste this in:

Spoiler below!


void OnStart()
{
AddEntityCollideCallback("Player", "Studydooropen", "CollideRoomTwo", true, 0);
AddUseItemCallback("", "bedroomkey_1", "mansion_1", "UsedKeyOnDoor", true);
}

void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_2", true, true);
}

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

void OnLeave()
{

}

Yes, this made my game turn on, thanks! Though the door doesn't open when I enter the script area. None of the names have mistakes. Any help?

Whoops, silly me, I'm doing it wrong! Thanks for the help!

Ok, I don't get this at all, I simply added a new line:


void OnStart()
{
AddEntityCollideCallback("Player", "Studydooropen", "CollideRoomTwo", true, 0);
AddUseItemCallback("", "bedroomkey_1", "mansion_1", "UsedKeyOnDoor", true);
}

void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_2", true, true);
SetSwingDoorLocked("mansion_2");
}

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

void OnLeave()
{

}

And now it gives me a "No matching signatures" error!
void OnStart()
{
AddEntityCollideCallback("Player", "Studydooropen", "CollideRoomTwo", true, 0);
AddUseItemCallback("", "bedroomkey_1", "mansion_1", "UsedKeyOnDoor", true);
}

void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_2", true, true);
SetSwingDoorLocked("mansion_2", false, true);
}

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

void OnLeave()
{

}

This should solve the problem. The structure of SetSwingDoorLocked is:
void SetSwingDoorLocked(string& asName, bool abLocked, bool abEffects);
It worked when you did it, though when I did it 10 minutes ago, it didn't! Dafuq?
10-13-2012, 06:52 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#7
RE: Script fatal error?

Strange things happen. And remember: If there is a map.cache file, delete it. That may solve your problem.

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
10-13-2012, 06:56 PM
Find
Rapsis Offline
Member

Posts: 69
Threads: 6
Joined: Oct 2012
Reputation: 0
#8
RE: Script fatal error?

(10-13-2012, 06:52 PM)Rapsis Wrote:
(10-13-2012, 06:48 PM)The chaser Wrote:
(10-13-2012, 06:31 PM)Rapsis Wrote:
(10-13-2012, 06:22 PM)andyrockin123 Wrote: Hello! There is one error in your script file:

Spoiler below!

AddUseItemCallback("", "bedroomkey_1", "mansion_1", "UsedKeyOnDoor", true);
{
}




-You cannot use a function as a header; it has to be something like: void func(callback syntax)
-All callbacks should be placed under OnStart (very few exceptions) regardless of when they're used in the map.

Here's a fix, simply delete your current .hps file's content then copy & paste this in:

Spoiler below!


void OnStart()
{
AddEntityCollideCallback("Player", "Studydooropen", "CollideRoomTwo", true, 0);
AddUseItemCallback("", "bedroomkey_1", "mansion_1", "UsedKeyOnDoor", true);
}

void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_2", true, true);
}

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

void OnLeave()
{

}

Yes, this made my game turn on, thanks! Though the door doesn't open when I enter the script area. None of the names have mistakes. Any help?

Whoops, silly me, I'm doing it wrong! Thanks for the help!

Ok, I don't get this at all, I simply added a new line:


void OnStart()
{
AddEntityCollideCallback("Player", "Studydooropen", "CollideRoomTwo", true, 0);
AddUseItemCallback("", "bedroomkey_1", "mansion_1", "UsedKeyOnDoor", true);
}

void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_2", true, true);
SetSwingDoorLocked("mansion_2");
}

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

void OnLeave()
{

}

And now it gives me a "No matching signatures" error!
void OnStart()
{
AddEntityCollideCallback("Player", "Studydooropen", "CollideRoomTwo", true, 0);
AddUseItemCallback("", "bedroomkey_1", "mansion_1", "UsedKeyOnDoor", true);
}

void CollideRoomTwo(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_2", true, true);
SetSwingDoorLocked("mansion_2", false, true);
}

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

void OnLeave()
{

}

This should solve the problem. The structure of SetSwingDoorLocked is:
void SetSwingDoorLocked(string& asName, bool abLocked, bool abEffects);
It worked when you did it, though when I did it 10 minutes ago, it didn't! Dafuq?
...The door doesn't get locked. Why can't anything work right? D;

...Fixed it by changing "False to "True"
Thanks everyone!!!!!
(This post was last modified: 10-13-2012, 06:58 PM by Rapsis.)
10-13-2012, 06:57 PM
Find
Rapsis Offline
Member

Posts: 69
Threads: 6
Joined: Oct 2012
Reputation: 0
#9
RE: Script fatal error?

Hey people, I didn't change anything, the script is still how andyrockin told me, but it started crashing AGAIN, for no reason:

main (8,16) : ERR : expected data type

What the actuall f*** is wrong with this engine? Is it haunted or something?
(This post was last modified: 10-13-2012, 08:47 PM by Rapsis.)
10-13-2012, 08:47 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#10
RE: Script fatal error?

No, it's you Wink the engine does whatever it has to do. All the fails (or almost all) are human. So, let's see:

You have this:

void OnStart()

{

AddEntityCollideCallback("Player", "Studydooropen", "CollideRoomTwo", true, 0);

AddUseItemCallback("", "bedroomkey_1", "mansion_1", "UsedKeyOnDoor", true);

}



void CollideRoomTwo(string &in asParent, string &in asChild, int alState)

{

SetSwingDoorClosed("mansion_2", true, true);

}



void UsedKeyOnDoor(string &in asItem, string &in asEntity)

{

SetSwingDoorLocked("mansion_1", false, true);

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

RemoveItem("bedroomkey_1");

}



void OnLeave()

{



}


The error is here:

void OnStart()

{

AddEntityCollideCallback("Player", "Studydooropen", "CollideRoomTwo", true, 1);

AddUseItemCallback("", "bedroomkey_1", "mansion_1", "UsedKeyOnDoor", true);

}



void CollideRoomTwo(string &in asParent, string &in asChild, int alState)

{

SetSwingDoorClosed("mansion_2", true, true);

}



void UsedKeyOnDoor(string &in asItem, string &in asEntity)

{

SetSwingDoorLocked("mansion_1", false, true);

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

RemoveItem("bedroomkey_1");

}



void OnLeave()

{



}

The AddEntityCollideCallback always end with a 1 or a -1. When you put 0, the engine turns mad. That was the issue.

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
10-13-2012, 08:58 PM
Find




Users browsing this thread: 5 Guest(s)