Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Gs1/gs2? (https://forums.graalonline.com/forums/showthread.php?t=72564)

theHAWKER 03-03-2007 08:11 PM

Gs1/gs2?
 
I dont know the dif between GS1 and GS2...
so is this GS1 or 2?:
PHP Code:

if (playertouchsme) {
  
hide;
  
sleep 3;
  
show;



Gambet 03-03-2007 08:14 PM

GS1


GS2 would be:

PHP Code:

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

Quote:

Originally Posted by theHAWKER (Post 1284127)
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

Quote:

Originally Posted by theHAWKER (Post 1284127)
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

PHP Code:

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



cbk1994 03-03-2007 11:13 PM

Quote:

Originally Posted by theHAWKER (Post 1284127)
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:
PHP Code:

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

GS2:
PHP Code:

this.blah += this.add

^^

Skyld 03-03-2007 11:28 PM

Quote:

Originally Posted by theHAWKER (Post 1284127)
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.


All times are GMT +2. The time now is 04:53 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.