Frictional Games Forum (read-only)

Full Version: Help! Script error!!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So I am working on my custom story and I have a scripted sequence that is set to start 1 second after player collides with a script area.

I will qoute the file below, upon entering the map it says there is some kind of error with the signature on the AddEntityCollideCallback that I have, I don't see anything wrong with it. granted im not a pro scripter Tongue

Please help! I have put alot of work into what I have so far and want to keep making progress on it so i can put it up on ModDB. Please and thank you for your help Big Grin

Quote: //////////////
void OnStart()
{
AddEntityCollideCalback("Player", "ChaseStart", "ChaseStartFunc", true, 1);
}

/////////////////////////////////////////////////////////////////////////
void ChaseStartFunc(string &in asParent, string &in asChild, int alState)
{
SetPlayerActive(false);
StartPlayerLookAt("scratches_7", 5, 10, "");
AddTimer("tmrChase", 1.0f, "ChaseSequence");
}
void ChaseSequence(string &in asTimer)
{
AddLocalVarInt("iIntroPart", 1);
float partSpeed = 1.5f;
switch (GetLocalVarInt("iIntroPart"))
{
case 1: // First part
partSpeed = 3.0f;
StartPlayerLookAt("ink_bottle_1", 2, 5, "");
PlaySoundAtEntity("", "00_laugh.snt", "Player", 0, false);
break;
case 2: // Second part
partSpeed = 8.0f;
StartPlayerLookAt("barrel01_1", 5, 10, "");
AddPropForce("wine02_1", 0, 0, 1000, "World");
break;
case 3: // Third part
partSpeed = 2.0f;
SetEntityActive("enemy_suitor_malo_1", true);
SetPropHealth("prison_4", 0.0f);
ShowEnemyPlayerPosition("enemy_suitor_malo_1");
SetPlayerActive(true);
break;
}

if (GetLocalVarInt("iIntroPart") <3)
{
AddTimer("tmrChase", partSpeed, "ChaseSequence");
}
}

//////////////
void OnEnter()
{

}

//////////////
void OnLeave()
{

}
PHP Code:
void ChaseSequence(string &in asTimer)
{
AddLocalVarInt("iIntroPart"1);
float partSpeed 1.5f;
switch (
GetLocalVarInt("iIntroPart"))
{ <-- 
you placed it the wrong way ''}''
PHP Code:
if (GetLocalVarInt("iIntroPart") <3)
{
AddTimer("tmrChase"partSpeed"ChaseSequence");
}
}<-- 

When you add script functions, without using it. The error wont show what the problem is. sometime...
Actually, the problem is that you are missing an "l" in AddEntityCollideCallback:
Code:
//////////////
void OnStart()
{
AddEntityCollideCallback("Player", "ChaseStart", "ChaseStartFunc", true, 1);
}
Thanks Big Grin Im horrible when it comes to those stupid brackets lol
(03-10-2012, 10:09 PM)UnseenLegend ( NL ) Wrote: [ -> ]
PHP Code:
void ChaseSequence(string &in asTimer)
{
AddLocalVarInt("iIntroPart"1);
float partSpeed 1.5f;
switch (
GetLocalVarInt("iIntroPart"))
{ <-- 
you placed it the wrong way ''}''
PHP Code:
if (GetLocalVarInt("iIntroPart") <3)
{
AddTimer("tmrChase"partSpeed"ChaseSequence");
}
}<-- 

When you add script functions, without using it. The error wont show what the problem is. sometime...


Thanks Big Grin I would have never spotted that lol
(03-10-2012, 11:07 PM)Apjjm Wrote: [ -> ]Actually, the problem is that you are missing an "l" in AddEntityCollideCallback:
Code:
//////////////
void OnStart()
{
AddEntityCollideCallback("Player", "ChaseStart", "ChaseStartFunc", true, 1);
}

Your bracketing on the switch statement is fine.

(03-10-2012, 11:07 PM)Apjjm Wrote: [ -> ]Your bracketing on the switch statement is fine.
Wait What ?
When i do this.

}
AddEntityCollideCallback("Player", "ChaseStart", "ChaseStartFunc", true, 1);
}

Will the trigger be not active.
Second when you got fatal error, you cannot find where the problem is. mostly..
When you getting a fatal error check first on bracketing. It saves you time believe me.
Syntactically, the braces were fine: the interpreter will always throw bracketing errors before any errors to do with function signatures. If you re-read the first post you will notice that the error reported is a function signature error. If a bracketing error occurs the interpreter will not look for errors past that stage and as such a bracketing error could not have been the source of the problem reported. If you want to test this, try:
Code:
void errorMe() { {    Invalid_Function_Name(123); }
Even though "Invalid_Function_Name(int)" is not defined, that error is not reported as the bracketing error takes precedence. If I altered the code in some way and an error about that function signature was reported, the brackets therefore, must be fine / have been fixed.