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
More scripting issues -.-
7thProductions Offline
Junior Member

Posts: 42
Threads: 17
Joined: Mar 2012
Reputation: 0
#1
More scripting issues -.-

what I'm trying to do is have the player look at a object/decal and display a message and after toying with the script I almost got it right, only it wouldn't display the message and now I keep getting the same error:

"main (60, 6): ERR: Expected '('"

Here's my script:

////////////////////////////
// Run first time starting map
void OnStart()
{
SetPlayerCrouching(true);
SetPlayerActive(false);
ShowPlayerCrossHairIcons(false);
SetSanityDrainDisabled(true);
SetPlayerHealth(10.0);
AddPlayerBodyForce(0, 0, -10000, true);
FadeOut(0.0f);
FadeIn(5.0f);
SetPlayerSanity(1);
AddTimer("T1", 3, "Intro");
AddTimer("T2", 6, "Intro");
AddTimer("T3", 8, "Intro");
AddTimer("T4", 10, "Intro");
AddTimer("T5", 12, "Intro");
}
void Intro(string &in asTimer)
{
string x = asTimer;
if (x == "T1")
{
PlaySoundAtEntity("", "react_sigh.snt", "Player", 0, false);
FadeOut(3);
}
else if (x == "T2")
{
FadeIn(3);
PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false);
StartPlayerLookAt("ScriptArea_1", 2, 2, "");
}
else if (x == "T3")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_2", 2, 2, "");
}
else if (x == "T4")
{
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
StopPlayerLookAt();
}
else if (x == "T5")
{
SetPlayerCrouching(false);
SetPlayerActive(true);
ShowPlayerCrossHairIcons(true);
SetPlayerMoveSpeedMul(0.3);
SetPlayerJumpDisabled(true);
SetPlayerCrouchDisabled(true);
SetPlayerRunSpeedMul(0.0);
StartPlayerLookAt("blood_spatter01_1", 2, 2, "violetedwards_speak_1");
StartEffectEmotionFlash("Messages", "violetedwards_speak_1", "");
SetEntityPlayerInteractCallback("blood_spatter01_1", "SetMessage", true);
}

void MyFunc(string &in asEntity)
{
SetMessage("Messages", "violetedwards_speak_1", 0);
AddEntityCollideCallback("Player", "blood_spatter01_1", "bloodspatter011", true, 1);
}

}
////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

could someone please tell me what I did wrong?



03-22-2012, 08:21 PM
Find
ClayPigeon Offline
Member

Posts: 214
Threads: 13
Joined: Mar 2012
Reputation: 8
#2
RE: More scripting issues -.-

In T5:

SetEntityPlayerInteractCallback("blood_spatter01_1", "SetMessage", true);


Change to:

SetEntityPlayerInteractCallback("blood_spatter01_1", "MyFunc", true);
03-22-2012, 08:33 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#3
RE: More scripting issues -.-

You cannot define functions within functions. Take MyFunc out of Intro.

Tutorials: From Noob to Pro
03-22-2012, 08:54 PM
Website Find
7thProductions Offline
Junior Member

Posts: 42
Threads: 17
Joined: Mar 2012
Reputation: 0
#4
RE: More scripting issues -.-

(03-22-2012, 08:21 PM)7thProductions Wrote: what I'm trying to do is have the player look at a object/decal and display a message and after toying with the script I almost got it right, only it wouldn't display the message and now I keep getting the same error:

"main (60, 6): ERR: Expected '('"

Here's my script:

////////////////////////////
// Run first time starting map
void OnStart()
{
SetPlayerCrouching(true);
SetPlayerActive(false);
ShowPlayerCrossHairIcons(false);
SetSanityDrainDisabled(true);
SetPlayerHealth(10.0);
AddPlayerBodyForce(0, 0, -10000, true);
FadeOut(0.0f);
FadeIn(5.0f);
SetPlayerSanity(1);
AddTimer("T1", 3, "Intro");
AddTimer("T2", 6, "Intro");
AddTimer("T3", 8, "Intro");
AddTimer("T4", 10, "Intro");
AddTimer("T5", 12, "Intro");
}
void Intro(string &in asTimer)
{
string x = asTimer;
if (x == "T1")
{
PlaySoundAtEntity("", "react_sigh.snt", "Player", 0, false);
FadeOut(3);
}
else if (x == "T2")
{
FadeIn(3);
PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false);
StartPlayerLookAt("ScriptArea_1", 2, 2, "");
}
else if (x == "T3")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_2", 2, 2, "");
}
else if (x == "T4")
{
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
StopPlayerLookAt();
}
else if (x == "T5")
{
SetPlayerCrouching(false);
SetPlayerActive(true);
ShowPlayerCrossHairIcons(true);
SetPlayerMoveSpeedMul(0.3);
SetPlayerJumpDisabled(true);
SetPlayerCrouchDisabled(true);
SetPlayerRunSpeedMul(0.0);
StartPlayerLookAt("blood_spatter01_1", 2, 2, "violetedwards_speak_1");
StartEffectEmotionFlash("Messages", "violetedwards_speak_1", "");
SetEntityPlayerInteractCallback("blood_spatter01_1", "SetMessage", true);
}

void MyFunc(string &in asEntity)
{
SetMessage("Messages", "violetedwards_speak_1", 0);
AddEntityCollideCallback("Player", "blood_spatter01_1", "bloodspatter011", true, 1);
}

}
////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

could someone please tell me what I did wrong?


okay...now I have another problem

error: "main (79, 2) : ERR : Unexpected end of file"

script (does anyone see anything wrong here?):

////////////////////////////
// Run first time starting map
void OnStart()
{
SetPlayerCrouching(true);
SetPlayerActive(false);
ShowPlayerCrossHairIcons(false);
SetSanityDrainDisabled(true);
SetPlayerHealth(10.0);
AddPlayerBodyForce(0, 0, -10000, true);
FadeOut(0.0f);
FadeIn(5.0f);
SetPlayerSanity(1);
AddTimer("T1", 3, "Intro");
AddTimer("T2", 6, "Intro");
AddTimer("T3", 8, "Intro");
AddTimer("T4", 10, "Intro");
AddTimer("T5", 12, "Intro");
}
void Intro(string &in asTimer)
{
string x = asTimer;
if (x == "T1")
{
PlaySoundAtEntity("", "react_sigh.snt", "Player", 0, false);
FadeOut(3);
}
else if (x == "T2")
{
FadeIn(3);
PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false);
StartPlayerLookAt("ScriptArea_1", 2, 2, "");
}
else if (x == "T3")
{
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_2", 2, 2, "");
}
else if (x == "T4")
{
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
StopPlayerLookAt();
}
else if (x == "T5")
{
SetPlayerCrouching(false);
SetPlayerActive(true);
ShowPlayerCrossHairIcons(true);
SetPlayerMoveSpeedMul(0.3);
SetPlayerJumpDisabled(true);
SetPlayerCrouchDisabled(true);
SetPlayerRunSpeedMul(0.0);
AddEntityPlayerInteractCallback("Player", "violetedwards_speak_1", "VioletEdwardsMessage1", true, 1);
}

void VioletEdwardsMessage1(string &in asEntity)
{
StartPlayerLookAt("blood_spatter01_1, 2, 2, "");
SetMessage("Messages", "violetedwards_speak_1", 0);
StopPlayerLookAt();
}

}
////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{
}




(03-22-2012, 08:54 PM)Your Computer Wrote: You cannot define functions within functions. Take MyFunc out of Intro.
okay I changed that, but everytime I try and launch the map it says there is an unexpected end to the file after 'void OnLeave()' which is werid because I've never messed with that before... do you know how to fix this?

(This post was last modified: 03-22-2012, 11:18 PM by 7thProductions.)
03-22-2012, 11:07 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#5
RE: More scripting issues -.-

(03-22-2012, 11:07 PM)7thProductions Wrote: okay I changed that, but everytime I try and launch the map it says there is an unexpected end to the file after 'void OnLeave()' which is werid because I've never messed with that before... do you know how to fix this?

Changing the name of the MyFunc function to VioletEdwardsMessage1 does nothing to fix the issue. I repeat, you cannot define functions within a function; AngelScript scripting does not support lambda functions. Take VioletEdwardsMessage1 out of Intro.

Tutorials: From Noob to Pro
03-23-2012, 05:11 AM
Website Find




Users browsing this thread: 3 Guest(s)