Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help! Script error!!
Author Message
xxR3LoaD3dxx Offline
Junior Member

Posts: 5
Joined: Mar 2012
Reputation: 0
Post: #1
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 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()
{

}

Nothings scarier then a screaming naked man flying down a hallway at 200mph.....wait...what?
03-10-2012 07:39 PM
Find all posts by this user Quote this message in a reply
UnseenLegend ( NL ) Offline
Member

Posts: 173
Joined: Sep 2011
Reputation: 12
Post: #2
RE: Help! Script error!!
PHP Code: (Select All)
void ChaseSequence(string &in asTimer)
{
AddLocalVarInt("iIntroPart"1);
float partSpeed 1.5f;
switch (
GetLocalVarInt("iIntroPart"))
{ <-- 
you placed it the wrong way ''}''
PHP Code: (Select All)
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...

[Image: read-image.asp?n=n-20121202110321-m.jpg&r=8]
(This post was last modified: 03-10-2012 10:21 PM by UnseenLegend ( NL ).)
03-10-2012 10:09 PM
Find all posts by this user Quote this message in a reply
Apjjm Offline
Super Moderator

Posts: 444
Joined: Apr 2011
Reputation: 42
Post: #3
RE: Help! Script error!!
Actually, the problem is that you are missing an "l" in AddEntityCollideCallback:
//////////////
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
Find all posts by this user Quote this message in a reply
xxR3LoaD3dxx Offline
Junior Member

Posts: 5
Joined: Mar 2012
Reputation: 0
Post: #4
RE: Help! Script error!!
Thanks Big Grin Im horrible when it comes to those stupid brackets lol
(03-10-2012 10:09 PM)UnseenLegend ( NL ) Wrote:  
PHP Code: (Select All)
void ChaseSequence(string &in asTimer)
{
AddLocalVarInt("iIntroPart"1);
float partSpeed 1.5f;
switch (
GetLocalVarInt("iIntroPart"))
{ <-- 
you placed it the wrong way ''}''
PHP Code: (Select All)
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:
//////////////
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
Find all posts by this user Quote this message in a reply
UnseenLegend ( NL ) Offline
Member

Posts: 173
Joined: Sep 2011
Reputation: 12
Post: #5
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.

[Image: read-image.asp?n=n-20121202110321-m.jpg&r=8]
(This post was last modified: 03-11-2012 02:06 PM by UnseenLegend ( NL ).)
03-11-2012 02:06 PM
Find all posts by this user Quote this message in a reply
Apjjm Offline
Super Moderator

Posts: 444
Joined: Apr 2011
Reputation: 42
Post: #6
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
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)