PDA

View Full Version : Gs1/gs2?


theHAWKER
03-03-2007, 08:11 PM
I dont know the dif between GS1 and GS2...
so is this GS1 or 2?:
if (playertouchsme) {
hide;
sleep 3;
show;
}

Gambet
03-03-2007, 08:14 PM
GS1


GS2 would be:


function onPlayerTouchsMe()
{
hide();
sleep(3);
show();
}

theHAWKER
03-03-2007, 08:27 PM
so if gs2 is newer then why is it more complex like instead of "if" u use function?
it seams like a downgrade...
does it have more posiblilitys or something?

Gambet
03-03-2007, 08:51 PM
so if gs2 is newer then why is it more complex like instead of "if" u use function?
it seams like a downgrade...
does it have more posiblilitys or something?



x-x


Go read on object-oriented programming.

Kristi
03-03-2007, 09:03 PM
so if gs2 is newer then why is it more complex like instead of "if" u use function?
it seams like a downgrade...
does it have more posiblilitys or something?

If's should not exist outside of a function or procedure in any language.

Besides, you cant "call" if (created), HOWEVER, this becomes possible in gs2


function onPlayerChats() {
if(player.chat == "init")
onCreated();
}

cbk1994
03-03-2007, 11:13 PM
so if gs2 is newer then why is it more complex like instead of "if" u use function?
it seams like a downgrade...
does it have more posiblilitys or something?

You decide which is simpler ...

GS1:

setstring this.blah,strtofloat(#s(this.blah))+strtofloat(#s( this.add));


GS2:

this.blah += this.add;


^^

Skyld
03-03-2007, 11:28 PM
so if gs2 is newer then why is it more complex like instead of "if" u use function?
it seams like a downgrade...
does it have more posiblilitys or something?
It's a much more powerful language. It suppors more, everything new that is added to the engine is put into the new language.

Since the language is dynamically typed, you don't have to worry about #v(), #s() and #I(). Just variablename = value;.

Because functions are more powerful in GScript2, with return values, public and "player" functions, it's much easier to organise and reuse code.

Because things are objects, they're much easier manipulated, used and understood (i.e. the player is the 'player' object, the NPC or current object is 'this', etc.), and scoping is much easier defined.

It all just makes more sense.