Roenlond
Senior Member
Posts: 331
Threads: 3
Joined: Apr 2011
Reputation:
0
|
RE: Anyone need help?
(05-15-2011, 05:45 PM)Dominic0904 Wrote: Thanks for the help with the Lamp thing...now, I got a timer problem. I want to add a timer in so the screen fades to black, this is the code so far.
((this is put here so you know where the timer came from))
AddTimer("FadeToBlackTimer", 5, "FadeToBlack_01");
((this is the part I mean))
void FadeToBlack_01(float string &in asTimer)
{
if (asTimer == "FadeToBlackTimer")
{
FadeOut("", 4);
return;
}
}
It keeps giving me an error saying "Expected ')' or ',' "
it says that it expects it right before "&in".
I think I know it's something to do with the whole "(float string &in asTimer)" part. Since I still don't really understand what I need to put in here.
(float string &in asTimer) should be (string &in asTimer)
|
|
05-15-2011, 05:47 PM |
|
Kyle
Posting Freak
Posts: 911
Threads: 36
Joined: Sep 2010
Reputation:
7
|
RE: Anyone need help?
You can't have it as a "float string &in asTimer". The "asTimer" is a string, not a number. I could see someone thinking that it's a float or integer, but it's not. :/
Just have this:
void FadeToBlack_01(string &in asTimer)
Darn, you beat me to it. On my own thread...
(This post was last modified: 05-15-2011, 05:50 PM by Kyle.)
|
|
05-15-2011, 05:49 PM |
|
Dominic0904
Member
Posts: 63
Threads: 14
Joined: Apr 2011
Reputation:
0
|
RE: Anyone need help?
That just gave me "No matching signatures to 'FadeOut(string@&, cost uint)' "
as well as
"Candidates are:
void FadeOut(float)"
that second part came up as INFO and not ERR
(This post was last modified: 05-15-2011, 05:51 PM by Dominic0904.)
|
|
05-15-2011, 05:50 PM |
|
Kyle
Posting Freak
Posts: 911
Threads: 36
Joined: Sep 2010
Reputation:
7
|
RE: Anyone need help?
Have it "FadeOut(4);"
|
|
05-15-2011, 05:51 PM |
|
Roenlond
Senior Member
Posts: 331
Threads: 3
Joined: Apr 2011
Reputation:
0
|
RE: Anyone need help?
(05-15-2011, 05:49 PM)Kyle Wrote: You can't have it as a "float string &in asTimer". The "asTimer" is a string, not a number. I could see someone thinking that it's a float or integer, but it's not. :/
Just have this:
void FadeToBlack_01(string &in asTimer)
Darn, you beat me to it. On my own thread...
I'm sorry, didn't really notice it
|
|
05-15-2011, 05:52 PM |
|
Dominic0904
Member
Posts: 63
Threads: 14
Joined: Apr 2011
Reputation:
0
|
RE: Anyone need help?
Thanks again Kyle! Worked great!
Btw you've made a really great thread haha, just gonna say thanks personally, you've helped me a lot.
|
|
05-15-2011, 06:00 PM |
|
nemesis567
Posting Freak
Posts: 874
Threads: 65
Joined: May 2011
Reputation:
10
|
RE: Anyone need help?
(05-15-2011, 05:45 PM)Dominic0904 Wrote: Thanks for the help with the Lamp thing...now, I got a timer problem. I want to add a timer in so the screen fades to black, this is the code so far.
((this is put here so you know where the timer came from))
AddTimer("FadeToBlackTimer", 5, "FadeToBlack_01");
((this is the part I mean))
void FadeToBlack_01(float string &in asTimer)
{
if (asTimer == "FadeToBlackTimer")
{
FadeOut("", 4);
return;
}
}
It keeps giving me an error saying "Expected ')' or ',' "
it says that it expects it right before "&in".
I think I know it's something to do with the whole "(float string &in asTimer)" part. Since I still don't really understand what I need to put in here.
Replace FadeOut("", 4); with FadeOut(4.0f);
How do you disable a normal player area or script area?
Today I dreamt the life I could live forever. You only know that when you feel it for you know not what you like until you've experienced it.
(This post was last modified: 05-15-2011, 06:56 PM by nemesis567.)
|
|
05-15-2011, 06:01 PM |
|
X4anco
Member
Posts: 157
Threads: 66
Joined: Apr 2011
Reputation:
0
|
RE: Anyone need help?
Hello peoples
What is a local variable and how do I set it up
etc...?
...
|
|
05-15-2011, 07:12 PM |
|
Kyle
Posting Freak
Posts: 911
Threads: 36
Joined: Sep 2010
Reputation:
7
|
RE: Anyone need help?
(05-15-2011, 07:12 PM)X4anco Wrote: Hello peoples
What is a local variable and how do I set it up
etc...?
A local variable is as simple as this:
x = 1
There are 3 different kinds of local variables, int, string, and float.
The difference from x = 1 and a local variable is that x can only be used in the function it is in mostly unless if you carry it over from one function to the next, but nevermind. A local variable can be used all within the whole script.
You can use a local variable if you want to check if 2 different things happened and then it check to see if the local variable is whatever.
Example:
void OnStart()
{
SetLocalVarInt("Var1", 0);
AddEntityCollideCallback("Player", "ScriptArea_1", "Func1", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "Func2", true, 1);
Func3();
}
void Func1(string &in asParent, string &in asChild, int alState)
{
AddLocalVarInt("Var1", 1);
}
void Func2(string &inn asParent, string &in asChild, int alState)
{
AddLocalVarInt("Var1", 1);
}
void Func3()
{
if (GetLocalVarInt("Var1") == 2)
{
AddEntityCollideCallback("Player", "ScriptArea_3", "Func4", true, 1);
return;
}
}
void Func4(string &in asParent, string &in asChild, int alState)
{
[whatever happens]
}
|
|
05-15-2011, 07:34 PM |
|
nemesis567
Posting Freak
Posts: 874
Threads: 65
Joined: May 2011
Reputation:
10
|
RE: Anyone need help?
A local variable is a variable that works on the script you're using. This is, it will only work on that map, while a global variable would work in all of them.
To set a local variable you use the function:
SetLocalVarInt(string& asName, int alVal); //If the variable is an integer, where asName is the variable name which can be anything you like, and alVal is the variable value(must be an integer)
GetLocalVarInt(string& asName); //Returns an integer and can only be used to get an integer variable. asName is the name of the local variable
SetLocalVarFloat(string& asName, float alVal); //If the variable is an float, where asName is the variable name which can be anything you like, and alVal is the variable value(must be a float var)
GetLocalVarFloat(string& asName); //Returns a float and can only be used to get an float variable. asName is the name of the local variable
SetLocalVarString(string& asName, const string& alVal); //If the variable is an string, where asName is the variable name which can be anything you like, and alVal is the variable value(must be a string)
GetLocalVarString(string& asName); //Returns a string and can only be used to get an string variable. asName is the name of the local variable
So, does anyone knows How do you disable a normal player area or script area?
Today I dreamt the life I could live forever. You only know that when you feel it for you know not what you like until you've experienced it.
(This post was last modified: 05-15-2011, 07:49 PM by nemesis567.)
|
|
05-15-2011, 07:34 PM |
|
|