Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved Scripting Problem
Author Message
DubbaNinja Offline
Junior Member

Posts: 4
Joined: Apr 2012
Reputation: 0
Post: #1
Scripting Problem
Hi, I am a noob to making maps on Amnesia and game development. Especially scripting. Evereytime I run this (Doorslam Scare) script, I get (FATAL ERROR: Could not load script file 'custom_stories/Retorta_Cerebrum/maps/Mansion01.hps'! main (26,1) : ERR : Unexpected token '{'

I have followed the Wiki for this script to the letter but everytime is the same! Here is my script:


////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}


void OnStart()
{
AddUseItemCallback("", "studykey_1", "mansiondoor_1", "FUNCTION", true);
}
void FUNCTION(string &in item, string &in door)
{
SetSwingDoorLocked(door, false, true);
PlaySoundAtEntity("", "unlock_door", door, 0, false);
RemoveItem("studykey_1");
}


{
AddEntityCollideCallback("Player", "doorslam_1", "Collidedoorslam_1", true, 1);
}

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






_____


Please help,
Dubba
(This post was last modified: 04-24-2012 05:57 AM by DubbaNinja.)
04-23-2012 09:58 PM
Find all posts by this user Quote this message in a reply
Cranky Old Man Offline
Posting Freak

Posts: 925
Joined: Apr 2012
Reputation: 37
Post: #2
RE: Scripting Problem
How many times did you go over your code while missing this:

***Completely missing function header***
{

AddEntityCollideCallback("Player", "doorslam_1", "Collidedoorslam_1", true, 1);

}

Noob scripting tutorial: From Noob to Pro

04-23-2012 11:08 PM
Find all posts by this user Quote this message in a reply
JenniferOrange Offline
Senior Member

Posts: 428
Joined: Jun 2011
Reputation: 33
Post: #3
RE: Scripting Problem
(04-23-2012 11:08 PM)Cranky Old Man Wrote:  How many times did you go over your code while missing this:

***Completely missing function header***
{

AddEntityCollideCallback("Player", "doorslam_1", "Collidedoorslam_1", true, 1);

}
This sir is correct.
Toss AddEntityCollideCallback("Player", "doorslam_1", "Collidedoorslam_1", true, 1); with his buddies up under void OnStart.

void OnStart()
{
AddUseItemCallback("", "studykey_1", "mansiondoor_1", "FUNCTION", true);
AddEntityCollideCallback("Player", "doorslam_1", "Collidedoorslam_1", true, 1);
}

void FUNCTION(string &in item, string &in door)
{
SetSwingDoorLocked(door, false, true);
PlaySoundAtEntity("", "unlock_door", door, 0, false);
RemoveItem("studykey_1");
}

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

[Image: button.png]
(This post was last modified: 04-23-2012 11:39 PM by JenniferOrange.)
04-23-2012 11:37 PM
Find all posts by this user Quote this message in a reply
DubbaNinja Offline
Junior Member

Posts: 4
Joined: Apr 2012
Reputation: 0
Post: #4
RE: Scripting Problem
(04-23-2012 11:37 PM)JenniferOrange Wrote:  
(04-23-2012 11:08 PM)Cranky Old Man Wrote:  How many times did you go over your code while missing this:

***Completely missing function header***
{

AddEntityCollideCallback("Player", "doorslam_1", "Collidedoorslam_1", true, 1);

}
This sir is correct.
Toss AddEntityCollideCallback("Player", "doorslam_1", "Collidedoorslam_1", true, 1); with his buddies up under void OnStart.

void OnStart()
{
AddUseItemCallback("", "studykey_1", "mansiondoor_1", "FUNCTION", true);
AddEntityCollideCallback("Player", "doorslam_1", "Collidedoorslam_1", true, 1);
}

void FUNCTION(string &in item, string &in door)
{
SetSwingDoorLocked(door, false, true);
PlaySoundAtEntity("", "unlock_door", door, 0, false);
RemoveItem("studykey_1");
}

void Collidedoorslam_1(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansiondoor_1", true, true);
}
Thanks! It works now Smile
04-24-2012 05:56 AM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)