Post: GSC coding for n`00bs
06-02-2013, 06:21 PM #1
KingcreekS
NOTHING IS IMPOSSIBL
(adsbygoogle = window.adsbygoogle || []).push({}); Hello people , whats going on?

I want the 1.11 community to start again , so ill be teaching you guys how to code in GSC .


---------------------------------

¿What lenguage COD uses?

Ok , first of all , GSC is what cod use , GSC comes from QuakeC , from c#/c++ , GSC is a coding lenguage that has a lot of own classes , because its a company.
Coding in gsc is a little more difficult than java , php , c# , objective c , pascal... , you will need to have a little of knowledge of some coding lenguage to code something.
Today im here for the people who want to start from 0 .
Want to learn how to code but don't know where to start? I got you covered.I'll be teaching you the basics all week, and here's your first lesson.

Let's get started!

---------------------------------

What Are Variables?


You can think of variables as labeled jars that store different types of data. While there are several kinds of variables, today we're only going to look at three:

String- A string variable is a string of alphanumeric characters and allowed symbols that are contained within quotation marks. For example, "Hello world, I'm 102 years old today!" is an example of a string. Strings can also be contained within single quotes, which is useful if you want to have a string with a quotation like this: '"I hate the snow," Laurel said.' Strings are basically used for storing text.

Number- A number variable couldn't be more straightforward because all number variables store are numbers. You don't store them within quotes like strings. Instead, numbers can just be written as they are. If you want to store the number 9 in a variable, you just write 9.

Boolean- A boolean variable is one of two things: true or false. This data type is kind of like an on and off switch, so you can ask true or false questions in your code. For example, you might ask "is the video currently playing?" The response you'd get would be a boolean variable. True would mean the video is currently playing and false would mean it is not.


So how do you putt a variable to your code:
Heres an example:
    
myVariable = "Hello world!";

There are a few of things to notice here. First, the name myVariable. All programming languages have something called reserved words, which means you can't use them as variable names. What they varies, but if the name is sufficiently generic, there's a chance it could be a reserved word. To avoid using reserved words and screwing up your code, just decide on a naming scheme for your variables. I've put "my" in front of my example variable, but you'll probably want to come up with something else. Second, you'll notice a semicolon at the end of the line. A semicolon is like a period at the end of a sentence in many programming languages. In nearly every situation, you need to end your code sentences with a semicolon so your code doesn't get confused when reading it. The semicolon tells the computer, "Okay I'm all done with this statement.".


---------------------------------


The if , else statement

The if steatment is something that ask if the variable is true or false , if its true, it do something , if its false another thing.

EX:

    
Numero(){

num = randomIntRange( 1 , 3 );//this choose a random number between 1 ,2 ,3

if(num > 1 && num < 3){//check if the random number is bigger than 1 and less than 3 (2)
number = 2;//set the number
self.setText(number);//print the number given
}else if(num == 1){//if number is equal to 1
number = 1;//number 1
self.setText(number);//print the number given
}else if(num == 3){
number = 3;
self.setText(number);




Thats a longer way to do it , there is another one that is easier that is "SWITCH", but we will see that later.

SYMBOLS:

    
|| Or
&& And
; Semi-Colon
= Assigning to something
== equal
( Opening Parenthesis
) Closing Parenthesis
< Less-Than
> Greater-than
++ Add to Something By 1
-- Subtract Something By 1
// make a 1 line comment
/* */ make a longer comment



---------------------------------

Foreach statement

The foreach make something start doing something in the array.

EX:
    
foreach(player in level.players){// for all the players in the match
player DropItem( self getCurrentWeapon() );//drop his weapon
player itemWeaponSetAmmo( 2, 15 );// set ammo into 2 or 15 int
}


---------------------------------

The switch statement:
Switch its used for the same thing as an if .

EX:
    
num = 3;//number set to 3
switch(num){
case 1://if the number is 1 and not 3
self iPrintLnBold("you are not 3");//the console write this
break;//you need to put break in each of the cases that you make
case 3://if the number is 3
self iPrintLnBold("you are 3");//the console write this
break;


---------------------------------

Loops
A loop make something repeat all the times you want.

EX:
    
BABY(){//thread
hi = self iPrintBold("hi");//choosing what the class hi will do

while(time that you want){//while
self.setText(hi);//console print hi
}
}




I hope you enjoy the tutorial , Update coming soon with more.
Last edited by KingcreekS ; 06-03-2013 at 04:18 PM.

The following 5 users say thank you to KingcreekS for this useful post:

TheDeadLift, matt0897, MW2TopTenWORLD, Obris,
06-02-2013, 06:49 PM #2
John Leepe
< ^ > < ^ >
I wonder what Rohan is going to say about this thread :thinking:
06-02-2013, 07:01 PM #3
ImGsus
Little One
Well. I Don't Think We Need More Shit About GSC As Its Dead Now.. But I Can Help People Out For COD4 And W@W For Sure. I'm Just Saying MW2 GSC Is Dead.
But On The Other Side. Nice Thread.
06-02-2013, 09:06 PM #4
Originally posted by monium View Post
Hello people , whats going on?

I want the 1.11 comunnity to start again , so ill be teaching you guys how to code in GSC .


---------------------------------

¿What lenguage COD uses?

Ok , first of all , GSC is what cod use , GSC comes from QuackeC , from c#/c++ , GSC is a coding lenguage that has a lot of own classes , because its a company.
Coding in gsc is a little more difficult than java , php , c# , objective c , pascal... , you will need to have a little of knowledge of some coding lenguage to code something.
Today im here for the people who want to start from 0 , so lets start.

---------------------------------

The if , else steatment

The if steatment is something that ask if the variable is true or false , if its true, it do something , if its false another thing.

EX:

    
Numero(){

num = randomIntRange( 1 , 3 );//this choose a random number between 1 ,2 ,3

if(num > 1 && num < 3){//check if the random number is bigger than 1 and less than 3 (2)
number = 2;//set the number
self.setText(number);//print the number given
}else if(num == 1){//if number is equal to 1
number = 1;//number 1
self.setText(number);//print the number given
}else if(num == 3){
number = 3;
self.setText(number);




Thats a longer way to do it , there is another one that is easier that is "SWITCH", but we will see that later.

SYMBOLS:

    
|| Or
&& And
; Semi-Colon
= Assigning to something
== equal
( Opening Parenthesis
) Closing Parenthesis
< Less-Than
> Greater-than
++ Add to Something By 1
-- Subtract Something By 1
// make a 1 line comment
/* */ make a longer comment



---------------------------------

Foreach steatment

The foreach make something start doing something in the array.

EX:
    
foreach(player in level.players){// for all the players in the match
player DropItem( self getCurrentWeapon() );//drop his weapon
player itemWeaponSetAmmo( 2, 15 );// set ammo into 2 or 15 int
}


---------------------------------

The switch steatment:
Switch its used for the same thing as an if .

EX:
    
num = 3;//number set to 3
switch(num){
case 1://if the number is 1 and not 3
self iPrintLnBold("you are not 3");//the console write this
break;//you need to put break in each of the cases that you make
case 3://if the number is 3
self iPrintLnBold("you are 3");//the console write this
break;


---------------------------------

Loops
A loop make something repeat all the times you want.

EX:
    
BABY(){//thread
hi = self iPrintBold("hi");//choosing what the class hi will do

while(time that you want){//while
self.setText(hi);//console print hi
}
}




I hope you enjoy the tutorial , Update coming soon with more.


Nice thread.Smile I hope you'll continue to update this for there are alot of things missing.
I also think this should of been posted in the COD4 or WAW section.
06-03-2013, 12:26 AM #5
KingcreekS
NOTHING IS IMPOSSIBL
thanks dude Smile
06-03-2013, 08:02 AM #6
HackersForHire
Climbing up the ladder
Originally posted by another user

¿What lenguage COD uses?

The if , else steatment

Foreach steatment

The switch steatment:



When you can spell correctly, maybe I'd read the thread...
Last edited by HackersForHire ; 06-03-2013 at 08:08 AM.

The following 5 users say thank you to HackersForHire for this useful post:

aerosoul94, SubwayMonkey, Frost Mods, Jeremy,
06-03-2013, 02:22 PM #7
you need to sort the spelling mistakes out.

comunnity > community
lenguage > language
QuackeC > QuakeC
steatment > statement
06-03-2013, 07:06 PM #8
KingcreekS
NOTHING IS IMPOSSIBL
sorry guys , i ll edit that now

---------- Post added at 02:06 PM ---------- Previous post was at 10:25 AM ----------

edited
06-04-2013, 08:04 PM #9
spudeeelad
I defeated!
Originally posted by monium View Post
Alot


You might want to explain when to use ifs and elses and when switch would be better;
ifs are best for bools, if X == true . . . else . . .
Whereas a case statement is better when you have a lot of scenarios, or in other words, when you'd have to write alot of ifs.

Basically the difference is mostly in performance because when using ifs, it actually has to check whether each if is true or not, whereas for a case, it knows exactly which case it is at the start.

Generally, if you have more than 6 if's in the same function, then it's time to swap to a switch/case. If you've got 2 or 3 ifs, then there is no real difference.


Also, for loops, you don't have to use while, because that only covers one type of loop - a loop when you want something to remain constant until something else happens, such as a certain waiting for a certain amount of time to elapse.
So, you also need to cover for and foreach, like for example;

For (p=0; p< level.players.size;p++)
{
// Do something
}

This would be saying, starting at 0, for every player within lobby's list of players, do something to them, until every player is done, then end the loop.
Last edited by spudeeelad ; 06-04-2013 at 08:12 PM. Reason: Re-format

The following user thanked spudeeelad for this useful post:

JackMods-
09-20-2015, 01:58 PM #10
Nothing is impossible well i found one thing there is for you, you can't spell impossible REKT

Copyright © 2025, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo