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
Expcected Error help!
FoodOnCrack Offline
Junior Member

Posts: 5
Threads: 3
Joined: Feb 2014
Reputation: 0
#1
Tongue  Expcected Error help!

Hi there, I have made my first custom story, the map is working fine. I have a line of commands for a key and door which worked at first, now i have added a jumpscare which i have seen in a tutorial on youtube. It crashes immediatly and says: main 14,19 EXPECTED IDENTIFIER. I can also give a screenshot of the code in notepad ++, private message me.

My codes are:
PHP Code: (Select All)
void OnStart()
{
    
AddEntityCollideCallback("Player""Teleport_Script_1""jumpscare"true1);
}

void jumpscare(string &in asParentstring &in asChildint alStates)

{
    
SetEntityActive("corpse_male_3"true);
    
AddPropForce("corpse_male_3"00100"world");
}


AddUseItemCallback(" ""key_tower_1""castle_1""KeyOnDoor"true); 

void KeyOnDoor(string &in asItemstring &in asEntity)

{
SetSwingDoorLocked("castle_1"falsetrue);
PlaySoundAtEntity("""unlock_door""castle_1"0false);
RemoveItem("key_tower_1");


void OnStart()
{
AddEntityCollideCallback("Player""Teleport_Script_1""jumpscare"true1);
}

void jumpscare(string &in asParentstring &in asChildint alStates)

{
    
SetEntityActive("corpse_male_3"true);
    
AddPropForce("corpse_male_3"00100"world");


Is there anyone who understands the scripting better than me and can help me out? Thank you!!!
(This post was last modified: 02-14-2014, 01:08 AM by FoodOnCrack.)
02-14-2014, 01:05 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#2
RE: Expcected Error help!

First off, you can only have 1 script block with the same name (for example OnStart). Having multiple will cause a crash. If you need more script inside your OnStart block, just add it all inside the same one.

For example:
void OnStart()
{
    code1();
    code2();
}

Secondly, you can not have a callback script outside a block. This line:

AddUseItemCallback(" ", "key_tower_1", "castle_1", "KeyOnDoor", true);

is located between 2 blocks, therefore causing a crash as well. You want to move this within your OnStart block.

Try that and tell me how it goes. I'll assist further if you need more help (that is, if I can cause I'm about to go to bed. If I can't, there are many others here).

(This post was last modified: 02-14-2014, 01:14 AM by Mudbill.)
02-14-2014, 01:14 AM
Find
FoodOnCrack Offline
Junior Member

Posts: 5
Threads: 3
Joined: Feb 2014
Reputation: 0
#3
RE: Expcected Error help!

(02-14-2014, 01:14 AM)Mudbill Wrote: First off, you can only have 1 script block with the same name (for example OnStart). Having multiple will cause a crash. If you need more script inside your OnStart block, just add it all inside the same one.

For example:
void OnStart()
{
    code1();
    code2();
}

Secondly, you can not have a callback script outside a block. This line:

AddUseItemCallback(" ", "key_tower_1", "castle_1", "KeyOnDoor", true);

is located between 2 blocks, therefore causing a crash as well. You want to move this within your OnStart block.

Try that and tell me how it goes. I'll assist further if you need more help (that is, if I can cause I'm about to go to bed. If I can't, there are many others here).



Thanks a lot! I have learned way more from scripting since i started a few weeks ago. I also use Geany now instead of Notepad++. A guy on youtube called ThisIsYourComputer has a good tutorial on how to set up geany for amnesia scripting.
02-23-2014, 07:45 PM
Find
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
#4
RE: Expcected Error help!

ThisIsYourComputer xD
Yeap, it's YourComputer, he's been off since 10-31-2013 (last visit)
I wonder what happened to him?

02-24-2014, 12:24 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#5
RE: Expcected Error help!

31/10/2013 was halloween... :o

Discord: Romulator#0001
[Image: 3f6f01a904.png]
02-24-2014, 08:50 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#6
RE: Expcected Error help!

I'm not saying it was aliens, but... Aliens.

02-24-2014, 08:58 AM
Find
davide32 Offline
Junior Member

Posts: 27
Threads: 6
Joined: Nov 2013
Reputation: 0
#7
RE: Expcected Error help!

Look at what you type:
void OnStart()
{
AddEntityCollideCallback("Player", "Teleport_Script_1", "jumpscare", true, 1);
}

void jumpscare(string &in asParent, string &in asChild, int alStates)

{
SetEntityActive("corpse_male_3", true);
AddPropForce("corpse_male_3", 0, 0, 100, "world");
}


AddUseItemCallback(" ", "key_tower_1", "castle_1", "KeyOnDoor", true);

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

{
SetSwingDoorLocked("castle_1", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_1", 0, false);
RemoveItem("key_tower_1");
}

but it might be:
void OnStart()
{
AddEntityCollideCallback("Player", "Teleport_Script_1", "jumpscare", true, 1);
}
void jumpscare(string &in asParent, string &in asChild, int alState)

{
SetEntityActive("corpse_male_3", true);
AddPropForce("corpse_male_3", 0, 0, 100, "world");
}
Errors: 2 voids OnStart()
else:
void jumpscares(string &in asParent, string &in asChild, int alState)
(This post was last modified: 02-24-2014, 02:05 PM by davide32.)
02-24-2014, 02:02 PM
Find




Users browsing this thread: 1 Guest(s)