Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-03-2007, 08:11 PM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
Question 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;

__________________
**FLIP OUT**
Reply With Quote
  #2  
Old 03-03-2007, 08:14 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
GS1


GS2 would be:

PHP Code:
function onPlayerTouchsMe()
{
  
hide();
  
sleep(3);
  
show();

Reply With Quote
  #3  
Old 03-03-2007, 08:27 PM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
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?
__________________
**FLIP OUT**
Reply With Quote
  #4  
Old 03-03-2007, 08:51 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by theHAWKER View Post
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.
Reply With Quote
  #5  
Old 03-03-2007, 09:03 PM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
Quote:
Originally Posted by theHAWKER View Post
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();

__________________
Reply With Quote
  #6  
Old 03-03-2007, 11:13 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by theHAWKER View Post
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
__________________

Last edited by cbk1994; 03-03-2007 at 11:14 PM.. Reason: typo
Reply With Quote
  #7  
Old 03-03-2007, 11:28 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by theHAWKER View Post
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.
__________________
Skyld
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:05 AM.


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