Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Local Variables - problem
Elven Offline
Posting Freak

Posts: 862
Threads: 37
Joined: Aug 2011
Reputation: 26
#1
Local Variables - problem

I dont get it. What's the problem Sad. How can I use steps actually in there? It gives me error that for example in if statement, I cant use string and int, even tho int is stored inside the string :/.

void stepadder(string &in asTimer)
{
GetLocalVarInt("steps");
if("steps" < 24)
{
AddLocalVarInt("steps", 1);
AddTimer("", 1, "stepadder");
AddTimer("", 0, "stepeffect");
}
else
{
//finish stepping
}
}

void stepeffect(string &in asTimer)
{
GetLocalVarInt("steps");
CreateParticleSystemAtEntity("step" + "steps", "ps_guardian_appear_explosion.ps", "ScriptArea_" + "steps" ,false);
}

Ok, never mind Smile. I changed "steps" with GetLocalVarInt("steps") and it solved my problem!

I didn't do proper research Smile!

Sad part it really doesn't still work as I want, but I'll get it to work! Got it to work Wink

The Interrogation
Chapter 1

My tutorials
(This post was last modified: 08-22-2011, 12:30 PM by Elven.)
08-22-2011, 12:08 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#2
RE: Local Variables - problem

Erg, only if you still had the problem so then I could explain it more proper. xD

08-22-2011, 01:41 PM
Find
Elven Offline
Posting Freak

Posts: 862
Threads: 37
Joined: Aug 2011
Reputation: 26
#3
RE: Local Variables - problem

I don't mind if you explain it properly. But I think I got it. My scripts are working all perfectly with no problem. Basically local works on one map, global works on all maps. Some kind of text, value or whatever thing, right Smile?

The Interrogation
Chapter 1

My tutorials
08-22-2011, 02:58 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#4
RE: Local Variables - problem

(08-22-2011, 02:58 PM)Elven Wrote: I don't mind if you explain it properly. But I think I got it. My scripts are working all perfectly with no problem. Basically local works on one map, global works on all maps. Some kind of text, value or whatever thing, right Smile?

GetLocalVar<Type>() doesn't magically create a local function variable for you to use. You're supposed to store or use the return value of the function yourself.

For example:
string value = GetLocalVarString("steps");
if (value == "something")
     // do something...

// Or...
int value = GetLocalVarInt("steps");
if (value == 1)
     // do something...

// Or...
if (GetLocalVarInt("steps") == 1)
     // do something...

These functions are for the game to store in a save file (i.e. when the user or game saves). If you don't need these values to be saved by the game in a save file, then you can use normal variables.

Tutorials: From Noob to Pro
(This post was last modified: 08-22-2011, 06:45 PM by Your Computer.)
08-22-2011, 06:43 PM
Website Find
Elven Offline
Posting Freak

Posts: 862
Threads: 37
Joined: Aug 2011
Reputation: 26
#5
RE: Local Variables - problem

Thx, figured it out already Smile. But for others who have same problem Smile

The Interrogation
Chapter 1

My tutorials
08-22-2011, 06:47 PM
Find




Users browsing this thread: 1 Guest(s)