View Single Post
  #2  
Old 01-21-2008, 03:02 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
My C/C++ and Java are both quite scratchy, so forgive me if this is not totally accurate, but from what I remember:

C/C++ is statically typed (in terms of variable data types), GScript uses variant types which adapt to the type of data automatically.

Classes are very different in GScript to Java. Obviously in C classes do not exist, and I cannot say about C++ since I don't know enough about it. In GScript typically you implement class-like functionality using object joins, which are dynamic. You can "invent" class-like functionality in GScript by using these joinable class scripts, and also by using function prototyping and such.

You don't think about allocation in GScript, since that is all done by the engine, whereas C/C++ (and maybe Java to an extent), you must set aside space to work with before you work with it.

GScript uses built-in event-handling functions quite heavily to handle user/player interaction, whereas this functionality would not usually be implemented by default in C/C++.

Scripts in GScript work quite heavily on an instance basis, i.e. an NPC, weapon script, GANI script, etc, which means that extra functionality like trigger and such are added to allow communication between these instances. Similar to Java's object instances, I guess.

Flow control is pretty much identical (break, continue, return), as are many of the syntax structures (for, while, do, if), functions are defined in much the same way (with the function keyword instead of the expected datatype), and functions are called in the same way. Variable scoping isn't really vastly different to Java, not sure about C/C++ though without checking.

GScript is quite a lot more like ECMAScript/JavaScript in terms of structure though.
Reply With Quote