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
Global Variables and Local Variables.
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#4
RE: Global Variables and Local Variables, God Damn! (sorry)

What is there to not understand? They're very simple. Normal variables like "int x = 1" and "float i = 5.12" can only be used in a function that it is created in unless being transfered to another one with it's data. Local variables are variables that can be used within an entire script without it having to be transfered from one function to another. Global variables can be used like local variables except that they can be used in all the scripts in the folder it is created in with a "global.hps". In this "global.hps" file, it needs to have this:

void OnGameStart()
{
    
}

In the "OnGameStart" function global variables can be set up when the custom story starts and not a specific level. I don't exactly know the limits of this "global.hps", but I know that it can do this.

I hope this helps. :/

I also want to say that, for example, a SetLocalVarInt command sets the number for the indicated variable name's value. It can also work in different ways from integers, strings, and floats. And, for example, a AddLocalVarInt command adds the number to the variable's value, also as I said it works differently even in global variables.

(This post was last modified: 07-23-2011, 09:55 PM by Kyle.)
07-23-2011, 09:50 PM
Find


Messages In This Thread
RE: Variables, God Damn! (sorry) - by xtron - 07-23-2011, 08:59 PM
RE: Global Variables and Local Variables, God Damn! (sorry) - by Kyle - 07-23-2011, 09:50 PM



Users browsing this thread: 2 Guest(s)