UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

How to learn GSC/C++

broken avatar :(
Created 8 years ago
by WigglyWorm
0 Members and 1 Guest are viewing this topic.
4,970 views
broken avatar :(
×
broken avatar :(
Location: gbEngland
Date Registered: 25 June 2015
Last active: 1 month ago
Posts
40
Respect
Forum Rank
Legless Crawler
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
I am a guitarist, that makes me creative. BOOM!
Signature
le Dank Meme
le Musician
le Guitarist
×
WigglyWorm's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
WigglyWorm's Contact & Social Linksluke0chicken
I am literally a noob for this, but I want to learn what to do when scripting in a map.

I understand how functions work ( a bit) and understand vars and stuff, but can someone explain to me what the hell is all means. I really want to create my own stuff, but I need to know what code is for what, and how to make stuff happen. YouTube has nothing for it, all I ask is someone to explain what you can do in a GSC and what each individual var/function does.

Not expecting someone to spend time writing it, but anything that will help a complete new comer to scripting will be nice.

Love you  :D
Last Edit: June 22, 2016, 11:58:17 pm by WigglyWorm
broken avatar :(
×
broken avatar :(
Location: br
Date Registered: 10 December 2013
Last active: 2 years ago
Posts
159
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
Linoxet's Groups
Linoxet's Contact & Social LinksTutizillalinoxetbanguela
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 8 years ago
Posts
2,790
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
Signature
Let's keep this thread on topic from here on in. -DBZ

+1 to off-topic reply -DBZ

lmao. Too funny.

Goliath Script Placer: http://ugx-mods.com/forum/index.php/topic,11234.msg125257/topicseen.html#new

"...Christ, people. Learn C, instead of just stringing random characters
together until it compiles (with warnings)..."

-Linus Torvalds
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
Each function does whatever code is inside it:


Code Snippet
Plaintext
a_function()
{
   iprintln("Printing something");
}


Variables in GSC are either local(only exists within that function) or global(level, can be accessed from any function):


Code Snippet
Plaintext
a_function()
{
   str = "Something to print"; // a local string variable
   println(str); // prints the local str variable that holds a string
}


Code Snippet
Plaintext
a_function()
{
   iprintln(level.script); // prints the global variable's "script" property that is associated with the global variable
}


of course, if you want to pass a local variable from one function to another to do logic on, you can pass that function a "paramater" that is then turned into that function's "argument(s)":


Code Snippet
Plaintext
a_function()
{
   a = 1;
   b = 5;
   a_function_calc(a, b);
}
a_function_calc(num_one, num_two)
{
   iprintln((num_one + num_two));
}


(note how the variable names for a and b are not the same as num_one and num_two)


Objects on the other hand(as you may have noticed) are a bit of a exception. Objects are "referenced" meaning that any changes to that object in one function will affect any other references to that object.


Code Snippet
Plaintext
a_function()
{
   trig = spawn("trigger_radius", (0,0,0), 0, 36,36);
   trig thread a_function_obj();
   trig.a_num = 1;
   trig notify("exec");   
}
a_function_calc()
{
   self waittill("exec");
   iprintln(self.a_num);
}

 
Loading ...