GScript is the proprietary scripting language of Graal Online. Its syntax and lexicon are very similar to that of C, with alterations made to cater to programming novices.History
At first, gscript followed a console syntax and had a small library of functionality and operations. e.g.
if (created||playerenters) {
message Hello World!;
}
The above would output the string "Hello World!" as text for an NPC whenever somebody entered a level. Scripts were ran in a client to client mesh, allowing for various security holes.NPC Server
Around 2001, the NPC Server came out. This feature allowed for scripts to be run clientside or serverside. Some things were(are) not possible to do clientside and vice versa, causing some confusion in the comparatively unexperienced development community. This new principle allowed for vast security improvements aswell as increased functionality.
if (playerchats) {
if (strequals(#c,buy seed)) {
player.rupees--;
message Thank you for your business!;
addweapon Seed;
}
}
//#CLIENTSIDE
The above would be a simple, yet structurally sound method of having a player purchase a weapon NPC.
The clientside and serverside parts were(are) still stored in the same text on the server, but were deliminated by the line "//#CLIENTSIDE" Soon communication between server and client was made more easy with the advent of the commandGS2
In the middle of 2005, an almost complete renovation of the language was made public. Dubbed "GS2", vast functi0nality and syntax changes were made. Function could be passed parameters and return values, jagged arrays were introduced, and an overall more object oriented feel came about. This came about after the purchase of a Torque Game Engine license whereafter 3d capability was added to the game aswell as the new scripting language. Now, it is possible to script almost all aspects of the game (the playerlist and server login menus are scripted).
//#CLIENTSIDE
function onWeaponfired() {
this.go = 1-this.go;
if (this.go == 1) {
this.im = 0;
//this.SV = {{.9,-.5},{-.7,.4}};// Skew Vectors
//this.SV = {{.7,-.5},{-.25,.6}};
this.SV = "";
this.d = 3;
for (i=0;i<9;i++) {
if (keydown2(i+49,false)) this.d = i+1;
}
for (i=0;i
This is a simple yet functional weapon NPC that will show a basic, random fractal based on vectors.Current FunctionalityOverview
Gscript is a weak typed language and is not case-sensitive, variable names can be any combiniation of a-Z, 0-9 and "_". Variables are automatically typed, so one can do
foo = 5;
foo = "string";
(foo is now "string" and only "string")
without errors.
Functions are the mainstay of code blocks and follow the form:
function onFunctionName(arguments) {
return value;//if desired
}
Arrays can be created in several ways:
myarray = new;
myarray2 = new;
myarray3 = {0,1,{11,12},"strings too!"};
myarray4 = 5;
myarray4.add(6);
For more information, see the [ Visit the complete Wikipedia entry for GScript ]
| Searches on eBay |