Post: GSC Tutorial: Tutorial 1: Variables And The Basics
04-24-2011, 07:49 AM #1
pcfreak30
>> PCFreak30.com Happy<<
(adsbygoogle = window.adsbygoogle || []).push({}); Ok everyone. For now this is the only tut in this hopeful series I will share with NGU.

If you want anymore, give feedback here or on my blog.

Enjoy.

Originally posted by another user
Ok, so I originally WAS going to do this as a video series, but then I thought about it, and decided on a blog-based series.

If I get enough feedback, I will continue . Lets begin..



Background Information:

I have beeen recently corrected in the fact that mostly ALL COD games use the QUAKE game engine.

In a game there are 2 parts. The content and the engine. The engine can be thought up as the frame of a car. It the foundation and it is what makes it “work”. The content are the seats and internals. They are what you can interact and have fun with.

You can have just the engine, and no content to play, or have the content but nothing to run it. In call of duty, the content files are in a format called FastFiles, or ff files (file extension). They are compressed with zlib compression. They hold game models, audio, game settings, video, challenges and stuff, and picture/textures.

The game developers update the game by providing a patch_mp.ff file. Since this fastfile is on HDD and not disk, we can modify it and create “mods”. The game also has a order in how it searches for content. If it is in the patch, it takes priority over that file to the one(s) on disc. You can rename the files to something else and it will do the same.

COD is also know for horrible debugging. It gives almost no information to a scripting error..



The Basics:

Thing back to algebra, were you solved for X. Now put those teachings to this as it is similar.

A variable contains a value, its that simple. Noe for the more complex thing is what type of value?

The following are data types, also know as value types:

Integer which is a number
String which is text
Boolean with is simply true or false
Float which is a decimal like .12345
An array, which is a slightly harder thing to explain and we will soon cover it.


test = 2;



That sets a integer value of 2 to the variable “test”. The semi-colon means the end of a line.



test = “hello”;



This sets “test” to the string (text) “hello”.



test = true;



This sets “test” to the boolean value of true.



test = false;



This sets “test” to the boolean value of false.



Now about arrays. Arrays are a set of data. They are like a group of variables in a way.

Arrays use what are called “keys” and “values”. You use a key to access a value. Arrays are also like matrices. Array keys can be strings or integers.



arraya = [];

Sets the variable “arraya” to an array.



arraya["key1"] = “hello”;



That creates an array element with a key of “key1″ and a value of “hello”.



arraya[0] = “hello”;

That creates an array element with a key of 0 and a value of “hello”.



In arrays, when looping or iterating though them, the key always starts at 0. Now I know you thinking, “wait! hold up, I what about array keys being strings?”. Well that IS true, but you can also access using a integer key based on the position of the array element in the group, as well as the key you used yourself. This will be mostly used in for loops and getting the size of an array (how many elements it has)..



Here is a example array set:

b= [];

b["a"] = 1;

b[2] = true;

b["pcfreak"] = “is cool”;



This can be shown in a diagram view:



b

“a” = 1


2 = true


“pcfreak” = “is cool”




You can do multi-dimensional arrays to. Thats simple nesting arrays, or one array inside another.



a= [];

a[0] = [];

a["hi"] = “test”;



To access the value test, you would do=



varc =a[0]["hi"];

That returns the element with the key of “hi” which is under the key of 0 as well to the variable “varc”. The key of 0 also has a value of an array..



A diagram could be shown as:



a

0


“hi” = “test”




Well that about covers this tutorial. If you liked. it, please comment. If I get enough feedback I shall continue. If you have any questions about this tutorial, do ask away.



Have fun coding ..


Source: You must login or register to view this content.

See Ya..
(adsbygoogle = window.adsbygoogle || []).push({});

The following 6 users say thank you to pcfreak30 for this useful post:

.Pluto, add_me, Amazingpwner, Casper_HD, echo_destroyer, KeithH4666
04-24-2011, 07:54 AM #2
Casper_HD
Gym leader
Bro You Help The Community Out So Much! :love:
04-24-2011, 08:02 AM #3
pcfreak30
>> PCFreak30.com Happy<<
Originally posted by HD View Post
Bro You Help The Community Out So Much! :love:


Thanks. Just wish more would pay attention to my ads. Supports me back.

Oh I have said this, and if anyone spams me about it nothing will come of it.

But I see CL in our future, mwhaha. You can think what you want, but if I say anymore it will spoil it, and anything that comes of it. If you spam me, it will never come.

Enjoy the tut and I hope it helps you see how to mod.
04-24-2011, 09:41 AM #4
whats a variable? :derp: :carling:

jk, great tutorial man

this really helps out people begining to mod with .gsc
04-24-2011, 09:47 AM #5
nice tut :y:
04-24-2011, 12:18 PM #6
anddrew
League Champion
what is the point of this? sorry
04-24-2011, 12:36 PM #7
egoDream
Can’t trickshot me!
Originally posted by pcfreak30 View Post
Ok everyone. For now this is the only tut in this hopeful series I will share with NGU.

If you want anymore, give feedback here or on my blog.

Enjoy.



Source: You must login or register to view this content.

See Ya..


u should change ur name to Ps3Freak30
04-24-2011, 01:02 PM #8
.Pluto
Splicer
Thanks was this made for me lol!
04-24-2011, 05:39 PM #9
pcfreak30
>> PCFreak30.com Happy<<
Originally posted by GlitchEXPLOIT View Post
u should change ur name to Ps3Freak30


What would be the fun in that. I don't like limiting myself..
04-24-2011, 06:27 PM #10
Merkii
Former Staff
Originally posted by anddrew View Post
what is the point of this? sorry


It helps to know how to code GSC for future purposes and maybe you can impress a girl with it?
Like
if (girl == "Insert Name" && Hotness == 100/100)
Self.isHot();
else
Envy'sHer();

Say that and she will be all over you.

The following 2 users say thank you to Merkii for this useful post:

TheFallen, TRBZA

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo