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.
DRedshot Offline
Senior Member

Posts: 374
Threads: 23
Joined: Jun 2011
Reputation: 11
#19
RE: Global Variables and Local Variables, God Damn! (sorry)

1. AddLocalVarInt adds the value which is already there, rather than set it. lets say the value is 3,
SetLocalVarInt("Value" , 2); will set that value to 2, Whereas
AddLocalVarInt("Value" , 2); will add 2 to the value, making it 5

2. Global variables are very similar to Local variables, the only difference is that they can be used between multiple maps, and they require their own .hps file to run, callsed global.hps This file should be located in exactly the same folder as your other .hps files, (such as maps and inventory.hps)

the contents of this file look like this:

void OnGameStart()
{
// Add/Set your global variables here
}

The problem with the global.hps, it that you cannot use functions like AddEntityCollideCallback, or AddUseItemCallback, they simply wont work i don't even know if you will get an error. you should use these functios only in your map.hps

AddGlobalVarInt("" , ); and SetGlobalVarInt("" , ); work just like
AddLocalVarInt("" , ); and SetLocalVarInt("" , );

also side note: AddLocalVarString("String" , "hi"); will add "hi" onto the end of the local variable,
so if the LocalVariable was "hello", it will become "hellohi"

07-25-2011, 08:11 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 DRedshot - 07-25-2011, 08:11 PM



Users browsing this thread: 1 Guest(s)