Frictional Games Forum (read-only)

Full Version: Need help with my script!!!!!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi. I'm new to this level editor, and I'm having problems understanding what can be wrong with my script-code. Can anyone please tell me, it would be great if someone could Big Grin



errors:
main (13,6) ERR: Expected "("
main (21,6) ERR: Expected "("
main (29,6) ERR: Expected "("
main (35,6) ERR: Expected "("
main (47,6) ERR: Expected "("


Here's the code:

void OnStart()
{
{
AddEntityCollideCallback("Player", "BildeShow", "ActivateBildeShow", true, 1);
AddEntityCollideCallback("Player", "Monster1Area", "ActivateMonster", true, 1 );
AddUseItemCallback("", "SkapNokkel", "Skap1", "OpenDoor1", true);
AddUseItemCallBack("", "DoorKey", "Door1", "OpenDoor2", true);
SetSwingDoorLocked("Skap1", true, true);
SetSwingDoorDisableAutoClose("Skap1", true);
SetSwingDoorClosed("Skap1", false, true);
}

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

{
AddPropForce("Bilde1", -1000, 0, 0, "world");
SetPlayerSanity(10);
}


void OpenDoor1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Skap1", false, false);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
SetPlayerSanity(1);
AddTimer("Timer1", 0.5, "ReleaseMartin");
}
void ReleaseMartin(string &in asTimer)
{
AddPropForce("Martin", 10000, 0, 0, "world");

}

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

{

ShowEnemyPlayerPosition("Monster1");
AddQuest("Quest1", "Welcome");
SetEntityActive("Monster1", true);
AddEnemyPatrolNode("Monster1", "PathNodeArea_1", 0, "Idle");
AddQuest("Quest2", "KeyToLocker");
}


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

{
SetSwingDoorLocked("Door1", false, true);
PlaySoundAtEntity("", "unlock_door", "Door1", 0, false);
RemoveItem(DoorKey);
}

}

void OnEnter(){}

void OnExit(){}
Remove one of these brackets:

PHP Code:
void OnStart()
{



And one of these:

PHP Code:
void OpenDoor2(string &in asItemstring &in asEntity)
//Close up this space here. The compiler probably doesn't care, it's just good form
{
SetSwingDoorLocked("Door1"falsetrue);
PlaySoundAtEntity("""unlock_door""Door1"0false);
RemoveItem(DoorKey);
}

//This one 


This, also:

PHP Code:
void ActivateBildeShow(string &in asParentstring &in asChildint alState)
//This space, as well
{
AddPropForce("Bilde1", -100000"world");
SetPlayerSanity(10);


There might be more, but try that and see what happens.
You could always look for it yourself. The error message:

main (13,6) ERR: Expected "("
main (21,6) ERR: Expected "("
main (29,6) ERR: Expected "("
main (35,6) ERR: Expected "("
main (47,6) ERR: Expected "("

Just means there is something wrong in the 13th line, 6th digit. Expected "(" probably means you're missing a ( or you placed anything else wrong there.

Right?
(05-05-2013, 04:58 PM)MrNord94 Wrote: [ -> ]Hi. I'm new to this level editor, and I'm having problems understanding what can be wrong with my script-code. Can anyone please tell me, it would be great if someone could Big Grin

errors:
main (13,6) ERR: Expected "("
main (21,6) ERR: Expected "("
main (29,6) ERR: Expected "("
main (35,6) ERR: Expected "("
main (47,6) ERR: Expected "("
Smoke and Mr Credits have already explained what's wrong with your script, so I won't parrot them Smile I'm just going to add something:

Those numbers in brackets ((13,6) for example) tell you where in your script the error is. If you're using Notepad++, the bottom of your window tells you what line and column you're in. The bracketed numbers correspond with this. The 13 tells you that it's line 13 and the 6 tells you that it's the 6th column in the line.

Your errors are at:
Line 13, column 6
Line 21, column 6
Line 29, column 6
Line 35, column 6
and line 47, column 6

Just checked in Notepad++, column 6 is one letter/character past a TAB space. So it'll probably be the first or second character of the line which needs to be fixed.

The part that comes after the coordinates tells you what's wrong with that spot. "Expected "("" means it's missing a ( - as Smoke already said.

If you're missing a closing bracket "}", or a semicolon ";" in one of your statements, it'll just give you the coordinates for the last character in your script and say "unexpected end of file" which is really super not useful! Took me forever to figure out that the end of the file was not where the error actually was the first time this happened to me!

Edit: I second Smoke's statement below
I just looked a little more in the script and it looks like youre going to use a flying naked guy named martin... Please dont do this, no one would really appreciate it Wink