Script Questions: Global Var/Functions and the C language.
Posted: Fri Aug 25, 2006 4:39 am
I am a bit confused when it comes to using script in the GE - for example, let's say, I wanna declare a couple of global variables to store the player's name, age and gender -
The question I have: where do I define them to make them global? I can hardly create them before a main loop as there is no centralized cpp file, right?
Also, where do I declare & define global functions, so that all actors have access to it? Are there things like headers in GE?
Sorry if this is stupid question, I just never worked with game editors before. It was always simple source code. I mean, I think I understand writing script bound to specific events, not sure about general global definitions.
Also - I never worked with C, only with C++. Apart from the OOP elements, are there major differences? I assume the loops, arrays, ifs, pointers and things like that remain the same.
Thank you.
- Code: Select all
String g_PlayerName = null;
int g_PlayerAge;
char g_PlayerGender;
The question I have: where do I define them to make them global? I can hardly create them before a main loop as there is no centralized cpp file, right?
Also, where do I declare & define global functions, so that all actors have access to it? Are there things like headers in GE?
Sorry if this is stupid question, I just never worked with game editors before. It was always simple source code. I mean, I think I understand writing script bound to specific events, not sure about general global definitions.
Also - I never worked with C, only with C++. Apart from the OOP elements, are there major differences? I assume the loops, arrays, ifs, pointers and things like that remain the same.
Thank you.