Seragath
Junior Member
Posts: 34
Threads: 1
Joined: Jan 2011
Reputation:
0
|
A script problem. [SOLVED]
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.
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.
(This post was last modified: 01-12-2011, 01:41 PM by Seragath.)
|
|
01-12-2011, 11:20 AM |
|
jens
Frictional Games
Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation:
202
|
RE: A script problem.
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 |
|
Seragath
Junior Member
Posts: 34
Threads: 1
Joined: Jan 2011
Reputation:
0
|
RE: A script problem.
(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.)
|
|
01-12-2011, 12:48 PM |
|
Tottel
Senior Member
Posts: 307
Threads: 9
Joined: Nov 2010
Reputation:
0
|
RE: A script problem.
Go to line 149 in your script file, and check if you're using the proper function.
|
|
01-12-2011, 01:00 PM |
|
Seragath
Junior Member
Posts: 34
Threads: 1
Joined: Jan 2011
Reputation:
0
|
RE: A script problem.
Found the mistake. What I did wrong was that I did
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. (>.<)
Since I have this thread open still, I have another question. When I add a code with a timer,
AddTimer("Something", 5f, "Somethingelse"
What does the 5f mean ? I see some use 5f while others just use 5.
And thanks for the help!
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 ?
(This post was last modified: 01-12-2011, 01:14 PM by Seragath.)
|
|
01-12-2011, 01:10 PM |
|
jens
Frictional Games
Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation:
202
|
RE: A script problem.
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 |
|
Seragath
Junior Member
Posts: 34
Threads: 1
Joined: Jan 2011
Reputation:
0
|
RE: A script problem.
(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.
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 |
|
Tottel
Senior Member
Posts: 307
Threads: 9
Joined: Nov 2010
Reputation:
0
|
RE: A script problem.
(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.
|
|
01-12-2011, 01:46 PM |
|
Seragath
Junior Member
Posts: 34
Threads: 1
Joined: Jan 2011
Reputation:
0
|
RE: A script problem.
(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.
Thanks I'll read it once I get the time.
|
|
01-12-2011, 01:53 PM |
|
|