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 Help Parentheses issue
Grimm101 Offline
Junior Member

Posts: 12
Threads: 3
Joined: Dec 2011
Reputation: 0
#1
Parentheses issue

Hey guys,

EDIT: Updated the script and managed to remove the error for line 20 but my current error is it points to the bracket below void doorclosebang

I've got an issue when I start my level, I want to make a door slam when I walk into a specific area and play a sound when it happens. I am getting an error on line 20 and line 25. Which are both curly brackets. I'm not sure what this means. This is my code below. The 20th line can be seen below //Triggers

PS: I'm new to PHP/C++ and I think this a good starting point. I'm good with VB and Ok ish with C#. So far i've found this the easiest code to understand and read fluently but this kind of issue I am unsure of. I'm sure it is something simple and silly. =)

Thanks


PHP Code: (Select All)
////////////////////////////////
// Run when starting the map
void OnStart()

////////////////////////////////
// Entities
{
    
AddUseItemCallback("""Bedroom_Key""Bedroom_Key_Door""UsedKeyOnDoor"true); //Assigns the key to the door and sets the action of this as UsedKeyOnDoor
    
AddEntityCollideCallback("Player""DoorCloseArea1""DoorCloseBang"true1); // Declaring when a player walks into an area called "Name" Deletes the possibility of it happening again so it can only happen once: Number = 1 for player enters. -1 for when player leaves. 0 for both
}

void UsedKeyOnDoor(string &in asItemstring &in asEntity//Declaring the Key as a string 
{
        
SetSwingDoorLocked("Bedroom_Key_Door"falsetrue); //Sets what door the key works on and it can only be used once
            
PlaySoundAtEntity("""unlock_door""Bedroom_Key_Door"0false); //Plays sound when the key is used on the door
            
RemoveItem("Bedroom_Key"); //Removes the key after it has been used
}

////////////////////////////////
// Triggers

void DoorCloseBang(string &in asParentstring &in asChildint alState); 
{
    
SetSwingDoorClosed("Bedroom_Key_Door"truetrue); //Closes a swing door: Effects indicate true to see the door close
    
PlaySoundAtEntity("""bang""DoorCloseBang"0false); //Create banging on the door sound when the door shuts
}

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

}

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


(This post was last modified: 12-22-2011, 11:54 PM by Grimm101.)
12-22-2011, 10:56 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Parentheses issue

I have trouble believing that is how your script actually looks. Could you edit your post with the forum's source editor and replace the script with the actual script?

Tutorials: From Noob to Pro
(This post was last modified: 12-22-2011, 11:45 PM by Your Computer.)
12-22-2011, 11:45 PM
Website Find
Grimm101 Offline
Junior Member

Posts: 12
Threads: 3
Joined: Dec 2011
Reputation: 0
#3
RE: Parentheses issue

Sorry mate didn't notice, there you go. I made an edit.
I notice that my post seems to be unexplained. After the recent changes I have made I fixed one of the issues. I understand that the main commands need to be under the same bracket. I can't put the code below anywhere else. My error says: "ERR Unexpected Token '{'" It seems it is to do with the bracket which holds the code below. I am not sure what to do.


SetSwingDoorClosed("Bedroom_Key_Door", true, true); //Closes a swing door: Effects indicate true to see the door close
PlaySoundAtEntity("", "bang", "DoorCloseBang", 0, false); //Create banging on the door sound when the door shuts
(This post was last modified: 12-23-2011, 12:12 AM by Grimm101.)
12-22-2011, 11:55 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#4
RE: Parentheses issue

You have a semicolon as part of the DoorCloseBang function header. That's a big no-no for function definitions.

Tutorials: From Noob to Pro
12-23-2011, 12:14 AM
Website Find
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#5
RE: Parentheses issue

You have a semi-colon at the end of
void DoorCloseBang(string &in asParent, string &in asChild, int alState); 
Edit: Ninja'd Tongue
(This post was last modified: 12-23-2011, 12:16 AM by Apjjm.)
12-23-2011, 12:15 AM
Find
Grimm101 Offline
Junior Member

Posts: 12
Threads: 3
Joined: Dec 2011
Reputation: 0
#6
RE: Parentheses issue

See, I knew it would be something stupid!! Thanks guys!! Your a great help.
I have a new issue with my code. It works fine and everything but as you can see, I want a sound to be played when the door shuts. The sound called "Bang.snt" Currently there is no sound being played. This is my new code

PHP Code: (Select All)
////////////////////////////////
// Run when starting the map
void OnStart()

////////////////////////////////
// Entities
{
    
AddUseItemCallback("""Bedroom_Key""Bedroom_Key_Door""UsedKeyOnDoor"true); //Assigns the key to the door and sets the action of this as UsedKeyOnDoor
    
AddEntityCollideCallback("Player""DoorCloseArea1""DoorCloseBang"true1); // Declaring when a player walks into an area called "Name" Deletes the possibility of it happening again so it can only happen once: Number = 1 for player enters. -1 for when player leaves. 0 for both
}

void UsedKeyOnDoor(string &in asItemstring &in asEntity//Declaring the Key as a string 
{
        
SetSwingDoorLocked("Bedroom_Key_Door"falsetrue); //Sets what door the key works on and it can only be used once
            
PlaySoundAtEntity("""unlock_door.snt""Bedroom_Key_Door"0false); //Plays sound when the key is used on the door
            
RemoveItem("Bedroom_Key"); //Removes the key after it has been used
}

void DoorCloseBang(string &in asParentstring &in asChildint alState
{
    
SetSwingDoorClosed("Bedroom_Key_Door"truetrue); //Closes a swing door: Effects indicate true to see the door close
    
PlaySoundAtEntity("""bang.snt""DoorCloseBang"0false); //Create banging on the door sound when the door shuts
}

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

}

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


(This post was last modified: 12-23-2011, 12:40 AM by Grimm101.)
12-23-2011, 12:21 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#7
RE: Parentheses issue

Where is bang.snt found in the original Amnesia sounds? Or did you make your own .snt file and called it bang?

Tutorials: From Noob to Pro
12-23-2011, 12:57 AM
Website Find
Grimm101 Offline
Junior Member

Posts: 12
Threads: 3
Joined: Dec 2011
Reputation: 0
#8
RE: Parentheses issue

(12-23-2011, 12:57 AM)Your Computer Wrote: Where is bang.snt found in the original Amnesia sounds? Or did you make your own .snt file and called it bang?
It's in "amnesia the dark descent/sounds/24"

Cheers =]
(This post was last modified: 12-23-2011, 01:01 AM by Grimm101.)
12-23-2011, 01:00 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#9
RE: Parentheses issue

Whether in 15 or 24, mine has a number in front on the name. Doesn't your's have a number prefixed too?

Tutorials: From Noob to Pro
12-23-2011, 01:06 AM
Website Find
Grimm101 Offline
Junior Member

Posts: 12
Threads: 3
Joined: Dec 2011
Reputation: 0
#10
RE: Parentheses issue

Yep I literally just noticed that too, added the number making it "24_Bang.snt" and still no sound. Is it correct of me to have "DoorCloseBang"? That is what I am unsure of.
12-23-2011, 01:08 AM
Find




Users browsing this thread: 1 Guest(s)