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


Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Advanced script widgets
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#6
RE: Script widgets for new modders!

Quote:I might want to make a request about how to use local and global variables.

I'm used to using something like having an "int x = 0;" and then something happens causing int x to become 1 (x = 1; ) thus causing events to change because x = 1.

Ahh I see. Those indeed will serve your purpose, but only within the same function. If you set int x = 0, you will only be able to call "x" in that same function. Local variables, however, you can call anywhere within that same script.

So do SetLocalVarInt("var1", 0); and then you can do all kinds of stuff like

GetLocalVarInt("var1");
AddLocalVarInt("var1", x); //where x is any integer you choose

and combine those with if statements to give you more functionality.

Global variables work the same way, but you need to set up a global.hps file under your custom story's root. In that file you have to put

void OnGameStart()
{
    SetGlobalVarInt("gvar1", 0);

}

Then you can toy with those variables anywhere within the same custom story! Just use

GetGlobalVarInt("gvar1");
AddGlobalVarInt("gvar1", x); //where x is any integer

and also use if statements too! Smile

04-24-2011, 02:52 AM
Find


Messages In This Thread
Advanced script widgets - by palistov - 04-24-2011, 01:22 AM
RE: Script widgets for new modders! - by Kyle - 04-24-2011, 02:11 AM
RE: Script widgets for new modders! - by palistov - 04-24-2011, 02:25 AM
RE: Script widgets for new modders! - by MrBigzy - 04-24-2011, 02:36 AM
RE: Script widgets for new modders! - by Kyle - 04-24-2011, 02:37 AM
RE: Script widgets for new modders! - by palistov - 04-24-2011, 02:52 AM
RE: Script widgets for new modders! - by Kyle - 04-24-2011, 03:06 AM
RE: Advanced script widgets - by laser50 - 04-24-2011, 09:27 AM
RE: Advanced script widgets - by Kyle - 04-24-2011, 11:11 AM
RE: Advanced script widgets - by Henriksen - 04-25-2011, 09:10 PM
RE: Advanced script widgets - by palistov - 04-26-2011, 03:43 PM
RE: Advanced script widgets - by Exostalker - 04-26-2011, 05:22 PM
RE: Advanced script widgets - by Apjjm - 04-27-2011, 09:21 PM
RE: Advanced script widgets - by palistov - 04-27-2011, 10:01 PM
RE: Advanced script widgets - by Simpanra - 05-01-2011, 10:31 PM



Users browsing this thread: 1 Guest(s)