In Java and all other OOP languages, you have to declare the data type of every variable. In GSC Scripting, you don't declare the data type since it automatically selects it for you if you haven't noticed already. Also, with variables if you want to declare it using a global scope you cant just put it floating outside the functions. You'd have to use something like: self.thisValue, player.thisValue, level.thisValue depending on who you want to globally assign the variable to. Notice the entity.variableName format when declaring global variables.
Declaring arrays in GSC Scripting is different aswell. In C++ if you wanted to create a dynamic array you'd have to use a vector but in GSC Scripting it's dead easy. Multi-dimensional arrays are also supported.
It may seem more tedious declaring arrays in GSC Scripting but it's really handy. Resizing arrays is just the matter of pushing an object to the end of an array using arrayName.size as the index. You can even use strings as the array index!
The thread command (like CreateThread in C++) runs a function asynchronously/using multithreading without having to wait for the function to return a value or finish doing what is needs to do.
There are also a whole bunch of built in functions that vary in every COD game there is. There is a comprehensive function list here for COD4 but many of them work in Black Ops. The site provides details about what each function does, returns and all the arguments required for it to work.
You also may of noticed that some strings have an ampersand before the string like in: precacheString( &"RANK_PLAYER_WAS_PROMOTED_N" );
What it basically does is get the localized string tied to that value which depends on what language the game is set to.
Example: If my game language was set to English then "RANK_PLAYER_WAS_PROMOTED_N" might mean "Player has been promoted to " but if my game language was set to German it might say "Player wurde gefrdert, um " (Google Translate ) instead.
I hope you learnt something from this, good luck coding mods! If you have any questions just ask.
~ master131
Declaring arrays in GSC Scripting is different aswell. In C++ if you wanted to create a dynamic array you'd have to use a vector but in GSC Scripting it's dead easy. Multi-dimensional arrays are also supported.
Code:
//C++ Version
int SomeArray[] = {15, 73, 45, 29};
//Java Version
int[] SomeArray = {15, 73, 45, 29};
//GSC Version
/* Dynamic version */
SomeArray = [];
SomeArray[SomeArray.size] = 15;
SomeArray[SomeArray.size] = 73;
SomeArray[SomeArray.size] = 45;
SomeArray[SomeArray.size] = 29;
//OR
/* Standard version */
SomeArray = [];
SomeArray[0] = 15;
SomeArray[1] = 73;
SomeArray[2] = 45;
SomeArray[3] = 29;
//Multi-dimensional GSC Array
SomeArray = [];
SomeArray["something"] = [];
SomeArray["something"][0] = "SomeStringValue";
It may seem more tedious declaring arrays in GSC Scripting but it's really handy. Resizing arrays is just the matter of pushing an object to the end of an array using arrayName.size as the index. You can even use strings as the array index!
The thread command (like CreateThread in C++) runs a function asynchronously/using multithreading without having to wait for the function to return a value or finish doing what is needs to do.
There are also a whole bunch of built in functions that vary in every COD game there is. There is a comprehensive function list here for COD4 but many of them work in Black Ops. The site provides details about what each function does, returns and all the arguments required for it to work.
You also may of noticed that some strings have an ampersand before the string like in: precacheString( &"RANK_PLAYER_WAS_PROMOTED_N" );
What it basically does is get the localized string tied to that value which depends on what language the game is set to.
Example: If my game language was set to English then "RANK_PLAYER_WAS_PROMOTED_N" might mean "Player has been promoted to " but if my game language was set to German it might say "Player wurde gefrdert, um " (Google Translate ) instead.
I hope you learnt something from this, good luck coding mods! If you have any questions just ask.
~ master131
A casual conversation between barata and I about Nukem.