xxR3LoaD3dxx
Junior Member
Posts: 5
Threads: 3
Joined: Mar 2012
Reputation:
0
|
Help! Script error!!
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
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
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()
{
}
Nothings scarier then a screaming naked man flying down a hallway at 200mph.....wait...what?
|
|
03-10-2012, 07:39 PM |
|
UnseenLegend ( NL )
Member
Posts: 171
Threads: 10
Joined: Sep 2011
Reputation:
12
|
RE: Help! Script error!!
void ChaseSequence(string &in asTimer) { AddLocalVarInt("iIntroPart", 1); float partSpeed = 1.5f; switch (GetLocalVarInt("iIntroPart")) { <--
you placed it the wrong way ''}''
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...
|
|
03-10-2012, 10:09 PM |
|
Apjjm
Is easy to say
Posts: 496
Threads: 18
Joined: Apr 2011
Reputation:
52
|
RE: Help! Script error!!
Actually, the problem is that you are missing an "l" in AddEntityCollideCal lback:
//////////////
void OnStart()
{
AddEntityCollideCallback("Player", "ChaseStart", "ChaseStartFunc", true, 1);
}
(This post was last modified: 03-11-2012, 12:33 AM by Apjjm.)
|
|
03-10-2012, 11:07 PM |
|
xxR3LoaD3dxx
Junior Member
Posts: 5
Threads: 3
Joined: Mar 2012
Reputation:
0
|
RE: Help! Script error!!
Thanks Im horrible when it comes to those stupid brackets lol (03-10-2012, 10:09 PM)UnseenLegend ( NL ) Wrote: void ChaseSequence(string &in asTimer) { AddLocalVarInt("iIntroPart", 1); float partSpeed = 1.5f; switch (GetLocalVarInt("iIntroPart")) { <--
you placed it the wrong way ''}''
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 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:
//////////////
void OnStart()
{
AddEntityCollideCallback("Player", "ChaseStart", "ChaseStartFunc", true, 1);
}
Your bracketing on the switch statement is fine.
Nothings scarier then a screaming naked man flying down a hallway at 200mph.....wait...what?
(This post was last modified: 03-10-2012, 11:54 PM by xxR3LoaD3dxx.)
|
|
03-10-2012, 11:52 PM |
|
UnseenLegend ( NL )
Member
Posts: 171
Threads: 10
Joined: Sep 2011
Reputation:
12
|
RE: Help! Script error!!
(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.
|
|
03-11-2012, 02:06 PM |
|
Apjjm
Is easy to say
Posts: 496
Threads: 18
Joined: Apr 2011
Reputation:
52
|
RE: Help! Script error!!
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:
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.
(This post was last modified: 03-11-2012, 03:31 PM by Apjjm.)
|
|
03-11-2012, 03:10 PM |
|
|