Frictional Games Forum (read-only)

Full Version: A script problem. [SOLVED]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey. I have a problem with this script. Since I'm really new to C++ as a whole, I cannot actually see what I am doing wrong. But here is the script. An explanation of what I am doing wrong and why, would be appreciated.

Seragath.

Code:
void OnStart()
{
AddEntityCollideCallback("Player", "Faint","Faint_scare", true, 1);
}

////Room_With_Key_Scare//////////
/////////////////////////////////

void Faint_scare(string &in asParent, string &in asChild, int alState)
{
GiveSanityDamage(1000, true);
AddTimer("Doom", 2, "TeleportPlayer");
FadeOut(0)
}

void TeleportPlayer(string &in asParent, string &in asChild, string &in asTimer, int alState)
{
TeleportPlayer("PlayerStartArea_2");
FadeIn(20);
AddTimer("Doom_end", 2, "Teleportback");
}

void Teleportback(string &in asParent, string &in asChild, string &in asTimer, int alState)
{
TeleportPlayer("PlayerStartArea_3");
}
////Room_With_Key_Scare_Ends///////
///////////////////////////////////

It does trigger the first FadeOut(0) etc. But not the rest of it. (And this "string &in asSomething") is still quite confusing for me. Sad
change
(string &in asParent, string &in asChild, string &in asTimer, int alState)

to
(string &in asTimer)

for your two timer functions and it should work.
(01-12-2011, 11:40 AM)jens Wrote: [ -> ]change
(string &in asParent, string &in asChild, string &in asTimer, int alState)

to
(string &in asTimer)

for your two timer functions and it should work.

Yeah but then the string to

TeleportPlayer won't work. >.>

The error:

Main(149,1): ERR: A function with the same name and parameters already exist
main(147,1):ERR: Expected';'
main(151,1):ERR :Multiple matching signatures to 'TeleportPlayer(String@&)'
main 158,1):ERR : (Same as the one above)

Sadly I do not know what this means....At all. >.> (Of course the game crashes with this error.)
Go to line 149 in your script file, and check if you're using the proper function. Smile
Found the mistake. What I did wrong was that I did

Code:
void TeleportPlayer

I had to change the name. I guess it got confused when I did it like that.

And that FadeOut(0) was missing a ";" in the end. (>.<)

Code:
FadeOut(0);

Since I have this thread open still, I have another question. When I add a code with a timer,

Code:
AddTimer("Something", 5f, "Somethingelse"

What does the 5f mean ? I see some use 5f while others just use 5.

And thanks for the help! Tongue

EDIT:

So basically what the code says now is that.

When Faint_Scare triggers there will go 2 seconds before it calls TelePortPlayer and another 2 seconds till it calls TelePortback ?
f means float, meaning a 1.0 number unlike an integer which would only be 1. You don't have to use f to specify a float, but I personally do it because I think the script is easier to read.

yes, what you say should happen is what the script should do.
(01-12-2011, 01:18 PM)jens Wrote: [ -> ]f means float, meaning a 1.0 number unlike an integer which would only be 1. You don't have to use f to specify a float, but I personally do it because I think the script is easier to read.

yes, what you say should happen is what the script should do.

Okey, thanks for the help. Smile

Huff, it's already getting confusing when I have to look through 200 or something lines...I will be insane by the time I'm done. >.<
(01-12-2011, 01:40 PM)Seragath Wrote: [ -> ]Huff, it's already getting confusing when I have to look through 200 or something lines...I will be insane by the time I'm done. >.<

http://en.wikipedia.org/wiki/Indent_style

I can really suggest you to read and use that then. Smile
(01-12-2011, 01:46 PM)Tottel Wrote: [ -> ]
(01-12-2011, 01:40 PM)Seragath Wrote: [ -> ]Huff, it's already getting confusing when I have to look through 200 or something lines...I will be insane by the time I'm done. >.<

http://en.wikipedia.org/wiki/Indent_style

I can really suggest you to read and use that then. Smile

Thanks I'll read it once I get the time. Smile