Graal Forums  

Go Back   Graal Forums > Graal V6 forums > Announcements
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rating: Thread Rating: 10 votes, 4.60 average. Display Modes
  #1  
Old 04-12-2013, 03:24 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Smile Gs3

Hello Graalians,

We have just started the work on a new scripting project and want your ideas and feedback about it. The idea is to create new Graal Script version (GS3) which will make scripts faster and more fit for bigger projects.

The idea

We plan to introduce 'types' to Graal script. This first means some more work for scripters but it also has some dramatic advantages:
- Scripts can run faster
- More reliable because it will complain when a variable has not been declared or is used incorrectly. This is important when doing bigger projects.
- We can possibly convert the scripts to other languages (C++, Javascript etc.) so it can possibly run in a browser in the future
- Code will be more readable, you don't have to guess what kind of variables need to be passed to a function or is returned by a function

The progress

We are already working on a converter which helps to convert scripts from GS2 to GS3. So a lot of work will be lifted from the programmer, and you can also use this tool for testing how the new scripting will look like.
Additional following things can be important to know:
- existing scripts will still run, we don't force the new syntax and semantic, but it can be interesting for server-side logic and also new client-side code
- just add a //#GS3 line to your script to use the new syntax and semantic
- some syntax of the new Graal script is already supported but currently ignored (like var statements)

Examples

Functions:
Old:
PHP Code:
function getAddition(ab) {
  
temp.result b;
  return 
temp.result;

New:
PHP Code:
function getAddition(a:numberb:number):number {
  var 
result:number b;
  return 
result;

Gui:
Old:
PHP Code:
new GuiControlProfile("Games_Msg_BackProfile") {
  
modal false;

New:
PHP Code:
var profile:GuiControlProfile = new GuiControlProfile("Games_Msg_BackProfile");
profile.modal false
Type declarations:
Old:
PHP Code:
function saveOptions() {
  
temp.options.age 24;
  
temp.options.gender "female";
  
temp.options.city "Dallas";
  
temp.options.savevars("options.txt"0);

New:
PHP Code:
class Options extends TGraalVar {
  var 
age int;
  var 
gender string;
  var 
city string;
}
function 
saveOptions():void {
  var 
options:Options = new Options();
  
options.age 24;
  
options.gender "female";
  
options.city "Dallas";
  
options.savevars("options.txt"0);

What is changing

- You need to declare the type of variables: var myvar: int;
Available types: string, boolean, int, number, void, type[] (for arrays), dictionary<string, int>
- Use "var" declarations instead of temp.
- You can also declare variables of a weapon or NPC at the beginning of the script using var myvar: type;
- The "with" statement is removed and the "new" statement is single-line, you need to call addcontrol() manually
- The dictionary type is needed if you want to access variables with dynamic variable name like this.mydictionary.("start" @ 1)
- Flexible number of function parameters can be done using function(first:int, ... params) (params is a dictionary)
- Global variables can only be accessed directly if you provide a global declaration or if you use findobject("objectname")
- You need to call this.myfunction() instead of myfunction()
- join() works more like an include in C++, there is no this.join anymore
- You can declare new classes (also called structures, types) inline like class MyClass extend TStaticVar; weapons are automatically extending TServerWeapon, NPCs are automatically extending TServerNPC
- The for (member: array) syntax needs to be changed to for (member in array)

Your ideas

As you can see the new Graal script is basically adding type declarations and changing a few smaller things to be more compatible with other languages. Please tell us if you like the new scripting or not, and if you have some stuff which you would like to see in the new scripting language, such as private variables or getter and setter functions. We have just started the project so everything is still possible. We can imagine there are a lot of questions regarding compatiblity and similar.
Reply With Quote
  #2  
Old 04-12-2013, 03:49 PM
Hezzy002 Hezzy002 is offline
Registered User
Join Date: Jul 2011
Posts: 247
Hezzy002 is a jewel in the roughHezzy002 is a jewel in the rough
Why don't you use a popular scripting language like Lua, because there's a massive library of documentation and tutorials for it, and a massive group of people who actually know it already? And LuaJIT is way faster than anything you can develop in-house.

There are also dozens of things that should be a higher priority than this.
Reply With Quote
  #3  
Old 04-12-2013, 03:49 PM
Crono Crono is offline
:pluffy:
Join Date: Feb 2002
Location: Sweden
Posts: 20,000
Crono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond repute
will players notice a difference? do you think we'll see new features thanks to this upgrade? :}
__________________
Reply With Quote
  #4  
Old 04-12-2013, 04:24 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Your type syntax looks awful, I wouldn't ever want to use that. Also, one major good point about scripting languages is the lack of type definitions, at least in my opinion. Go with Hezzy's suggestions, use Lua, Python or something similar. Some types of calculations done in Lua can even be as fast as pure C code, or so I've heard.
Reply With Quote
  #5  
Old 04-12-2013, 04:47 PM
Gos_pira Gos_pira is offline
Registered Pirate Ghost
Gos_pira's Avatar
Join Date: Sep 2009
Location: Pirate Ghost Ship
Posts: 175
Gos_pira is a splendid one to beholdGos_pira is a splendid one to beholdGos_pira is a splendid one to beholdGos_pira is a splendid one to beholdGos_pira is a splendid one to behold
The C# syntax is nice. I never liked the LUA syntax. I'm for defining variable types and have a more object oriented language though.
Reply With Quote
  #6  
Old 04-12-2013, 05:08 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Gos_pira View Post
The C# syntax is nice. I never liked the LUA syntax. I'm for defining variable types and have a more object oriented language though.
Please, Lua. Not LUA. D:
Reply With Quote
  #7  
Old 04-12-2013, 05:26 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
I'm not learning another language when the language you have right now can more or less be edited and given just about whatever functionality you want. Why make the community learn a new syntax, especially when the scripting community on here isn't very big.
Reply With Quote
  #8  
Old 04-12-2013, 06:19 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Because a syntax isn't difficult to learn, especially not Lua's.
Reply With Quote
  #9  
Old 04-12-2013, 06:31 PM
smirt362 smirt362 is offline
Tee Hee
smirt362's Avatar
Join Date: Feb 2005
Location: Texas
Posts: 2,101
smirt362 has a brilliant futuresmirt362 has a brilliant futuresmirt362 has a brilliant futuresmirt362 has a brilliant futuresmirt362 has a brilliant futuresmirt362 has a brilliant futuresmirt362 has a brilliant future
Send a message via AIM to smirt362 Send a message via MSN to smirt362
Masking support. Lets get some classic SNES effects on Graal. I still want to make some crazy stuff.



Will we also be getting a new Gani and Level editor as well?
__________________

Don Hertzfeldt <3
Reply With Quote
  #10  
Old 04-12-2013, 06:51 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Is this really the best time to do this? Development on Graal is dwindling; there's hardly any scripters left. Do you really want to potentially isolate the few scripters left? GS2 was never documented that well, especially when new things were added. I still have to hunt around the forums looking for anything added in the last couple of years because it's not documented anywhere else. GS1 isn't properly phased out still, yet many people still use it in levels because we still don't have any updated tools. And with Testbed gone there's not even a place available to practice scripting.

edit: I guess since it isn't mandatory it isn't that bad... but I also imagine it's not going to be widely used either. Going to be honest, you're probably going to be the only person using it. I can't say I like the declaration syntax either.
Reply With Quote
  #11  
Old 04-12-2013, 07:32 PM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
First, are servers currently updated to support this?

I notice some things in the new GS3 that I catch myself trying to do in GS2.. so I am glad to see these changes.

Quote:
Originally Posted by smirt362 View Post
Masking support. Lets get some classic SNES effects on Graal. I still want to make some crazy stuff.



Will we also be getting a new Gani and Level editor as well?
Oh, I would love masking support... that would be awesome..

Quote:
Originally Posted by DustyPorViva View Post
Is this really the best time to do this? Development on Graal is dwindling; there's hardly any scripters left. Do you really want to potentially isolate the few scripters left? GS2 was never documented that well, especially when new things were added. I still have to hunt around the forums looking for anything added in the last couple of years because it's not documented anywhere else. GS1 isn't properly phased out still, yet many people still use it in levels because we still don't have any updated tools. And with Testbed gone there's not even a place available to practice scripting.

edit: I guess since it isn't mandatory it isn't that bad... but I also imagine it's not going to be widely used either. Going to be honest, you're probably going to be the only person using it. I can't say I like the declaration syntax either.
Yeah but unfortunately us Mac OS X 10.6 users have no level editor, and using macports with gonstruct seemed to get me no where at all. So I can't even develop levels right now due to the lack of tools. There really needs to be an SDK kit..
Reply With Quote
  #12  
Old 04-12-2013, 07:33 PM
BlueMelon BlueMelon is offline
asdfg
BlueMelon's Avatar
Join Date: Sep 2008
Posts: 1,481
BlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to behold
I develop on graal for the simplicity of the scripting language that is used...

This type of syntax would not fit well with graal scripters/developers introducing types makes it look more like you're building software. What I like about GS2 is the use of temp. this. thiso, etc.

Lua on the other hand is fast/flexible. Lua is a great language.
__________________
http://i.imgur.com/OOJbW.jpg
Reply With Quote
  #13  
Old 04-12-2013, 08:30 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
you should introduce it on one server which could be set up like testbed, but supported by you/graal. it also should be well documented so people could try it out and feedback could be given
__________________
MEEP!
Reply With Quote
  #14  
Old 04-12-2013, 08:36 PM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Quote:
Originally Posted by BlueMelon View Post
I develop on graal for the simplicity of the scripting language that is used...

This type of syntax would not fit well with graal scripters/developers introducing types makes it look more like you're building software. What I like about GS2 is the use of temp. this. thiso, etc.

Lua on the other hand is fast/flexible. Lua is a great language.
Thats the only thing I do not like. I do not want to have to declare the type before assigning it. Thats what made graal so fun to develop for (for me).. But the example for how he did the GUI and assigned the modal, is exactly how my instinct tries to do.. if i assign something to an object. i want to be able to change it that way. =/
Reply With Quote
  #15  
Old 04-12-2013, 08:54 PM
dylan dylan is offline
AGT
Join Date: Jul 2012
Location: United States
Posts: 60
dylan has a spectacular aura about
Aren't you a little late on April Fools? It's the twelfth. :[
__________________

<@Logan> I spent a minute looking at my own code by accident.
<@Logan> I was thinking "What the hell is this guy doing?"
Reply With Quote
  #16  
Old 04-12-2013, 08:56 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Personally prefer the Java-style of declaring variables/types than your current GS3 way, no need to carry over how we currently use temp to GS3 as it just adds unnecessary code.

type variable;

Being able to create global functions would be cool too, I imagine GS3 would be more flexible in some way that we can modify built-in functions?

I.e.

PHP Code:
class Options extends TGraalVar 
  
int age;
  
string gender;
  
string city;
}

function 
void saveOptions() { 
  
Options options = new Options(); 
  
options.age 24
  
options.gender "female"
  
options.city "Dallas"
  
options.savevars("options.txt"0); 
}

function 
number addNumbers(number anumber b) {
  return 
b;

__________________
Quote:
Reply With Quote
  #17  
Old 04-12-2013, 09:35 PM
MattKan MattKan is offline
the KattMan
Join Date: Aug 2010
Location: United States
Posts: 1,325
MattKan is a splendid one to beholdMattKan is a splendid one to beholdMattKan is a splendid one to beholdMattKan is a splendid one to beholdMattKan is a splendid one to behold
Send a message via AIM to MattKan
Are there any benefits to adopting GS3 or is just change for the sake of change?
__________________
Quote:
Originally Posted by Satoru Iwata
On the other hand, free-to-play games, if unbalanced, could result in some consumers paying extremely large amounts of money, and we can certainly not expect to build a good relationship with our consumers in this fashion. In order to have a favorable long-term relationship, we would like to offer free-to-play games that are balanced and reasonable.
Quote:
Originally Posted by Unximad
Eurocenter Games remains attached to the values of indies game developer and to the service our playerbase community.
Reply With Quote
  #18  
Old 04-12-2013, 09:39 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally Posted by fowlplay4 View Post
Personally prefer the Java-style of declaring variables/types
Ditto, but I felt biased saying that since I only know Java.
Reply With Quote
  #19  
Old 04-12-2013, 09:54 PM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Quote:
Originally Posted by MattKan View Post
Are there any benefits to adopting GS3 or is just change for the sake of change?
Yes.

Quote:
Originally Posted by Stefan View Post
dramatic advantages:
- Scripts can run faster
- More reliable because it will complain when a variable has not been declared or is used incorrectly. This is important when doing bigger projects.
- We can possibly convert the scripts to other languages (C++, Javascript etc.) so it can possibly run in a browser in the future
- Code will be more readable, you don't have to guess what kind of variables need to be passed to a function or is returned by a function
Reply With Quote
  #20  
Old 04-12-2013, 10:07 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by MattKan View Post
Are there any benefits to adopting GS3 or is just change for the sake of change?
According to Stefan: Faster, will run better on other platforms, forcing people to declare variables/types will make code more self-documenting (You can see that in the options example) and also more stricter so perhaps stuff won't break as easy.
__________________
Quote:
Reply With Quote
  #21  
Old 04-13-2013, 12:08 AM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
I would also prefer something similar to java like jerrets example. But just like dusty I am biased because I frequently use java.
Reply With Quote
  #22  
Old 04-13-2013, 01:14 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Also curious how this would look like in GS3.

Weapon: Example

PHP Code:
function onActionServerSide() {
  if (
params[0] == "hello") {
    
player.triggerclient("weapon"this.name"goodbye");
  }
}

//#CLIENTSIDE

function onCreated() {
  
triggerserver("gui"this.name"hello");
}

function 
onActionClientSide() {
  if (
params[0] == "goodbye") {
    
player.chat "*fistbump*";
  }

Also if there's no 'with' (I still think there should be) how would this work out:

Weapon: GUIExample

PHP Code:
//#CLIENTSIDE
function onCreated() {
  new 
GuiWindowCtrl("Example") {
    
profile GuiBlueButtonProfile;
    
width height 100;
    new 
GuiButtonCtrl("ButtonExample") {
      
profile GuiBlueButtonProfile;
      
width height 10;
    }
    new 
GuiButtonCtrl("ButtonExample2") {
      
profile GuiBlueButtonProfile;
      
width height 30;
    }  
  }

__________________
Quote:
Reply With Quote
  #23  
Old 04-13-2013, 02:26 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
PHP Code:
function onActionServerSide(action:string):void {
  if (
action == "hello")
    
player.triggerclient("weapon"this.name"goodbye");
}

//#CLIENTSIDE

function onCreated():void {
  
triggerserver("gui"this.name"hello");
}

function 
onActionClientSide(action:string) {
  if (
action == "goodbye")
    
player.chat "*fistbump*";

PHP Code:
//#CLIENTSIDE
function onCreated():void {
  var 
window:GuiWindowCtrl = new GuiWindowCtrl("Example");
  
window.profile findobject("GuiBlueButtonProfile");
  
window.window.window.width window.height 100;

  var 
button:GuiButtonCtrl = new GuiButtonCtrl("ButtonExample");
  
button.profile findobject("GuiBlueButtonProfile");
  
button.button.button.width button.height 10;
  
window.addcontrol(button);

  
button = new GuiButtonCtrl("ButtonExample2");
  
button.profile findobject("GuiBlueButtonProfile");
  
button.button.button.width button.height 30;
  
window.addcontrol(button);

The idea with tools is this:
We finish the scripted level editor by combining some of the best scripted/online editors, and convert it to GS3. This can be available online and we are also able to convert it to other scripting languages to import it into other development platforms. So we can also possibly offer new offline editors in the future.

So there are several additional advantages:
Graal script will not be a black box anymore, it will possible to bring it to faster scripting engines and platforms.
It will also be more close to other scripting languages, so you your knowledge will be more interesting for "real life" purposes, and more programmers from outside of Graal could be able to script in GS3. A lot of head-aches with variable lookups and such things are gone.

For script help normally /scripthelp is working quite fine, all new functionality is automatically added to /scripthelp or to the list you get by starting Graal with the "-listscriptfunctions" command-line option. The documentation on wiki.graal.net could be reorganized a little bit after we introduce GS3, although most global functions and GUI objects will be the same.
Reply With Quote
  #24  
Old 04-13-2013, 02:57 AM
Gos_pira Gos_pira is offline
Registered Pirate Ghost
Gos_pira's Avatar
Join Date: Sep 2009
Location: Pirate Ghost Ship
Posts: 175
Gos_pira is a splendid one to beholdGos_pira is a splendid one to beholdGos_pira is a splendid one to beholdGos_pira is a splendid one to beholdGos_pira is a splendid one to behold
Quote:
Originally Posted by fowlplay4 View Post
Personally prefer the Java-style of declaring variables/types than your current GS3 way, no need to carry over how we currently use temp to GS3 as it just adds unnecessary code.

type variable;

Being able to create global functions would be cool too, I imagine GS3 would be more flexible in some way that we can modify built-in functions?

I.e.

PHP Code:
class Options extends TGraalVar 
  
int age;
  
string gender;
  
string city;
}

function 
void saveOptions() { 
  
Options options = new Options(); 
  
options.age 24
  
options.gender "female"
  
options.city "Dallas"
  
options.savevars("options.txt"0); 
}

function 
number addNumbers(number anumber b) {
  return 
b;

I'd personally prefer:

PHP Code:
public class Options TGraalVar 

  
int age;
  
string gender;
  
string city;
}

public class 
Npc
{
    public 
void saveOptions()
    { 
        
Options options = new Options(); 
        
options.age 24
        
options.gender "female"
        
options.city "Dallas"
        
options.savevars("options.txt"0); 
    }

    public 
float addNumbers(float afloat b)
    {
        return 
b;
    }

Reply With Quote
  #25  
Old 04-13-2013, 03:30 AM
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
I like the changes you're considering quite a bit, but the syntax definitely feels clunky. Is there any reason you couldn't just do C-style variable types?

Also, is it necessary to keep "function"? Why not just use the return type:

PHP Code:
// double return value
double mean(double adouble b) {
  return (
b) / 2;
}

// no return value
void log(string message) {
  echo(
message);
}

// returns something, "def" is a type that can hold anything
def anything() {
  
def[] array = [playerthis"a"];
  return array[
int(random(0, array.size()))];

This syntax would be more comfortable for a lot of amateur and professional programmers.
__________________
Reply With Quote
  #26  
Old 04-13-2013, 03:52 AM
devilsknite1 devilsknite1 is offline
C:
devilsknite1's Avatar
Join Date: Jul 2006
Location: Florida, USA
Posts: 269
devilsknite1 has a spectacular aura about
Send a message via AIM to devilsknite1 Send a message via MSN to devilsknite1 Send a message via Yahoo to devilsknite1
I do not want to reject change just for doing it, but Dusty's post captures my thoughts practically verbatim. I don't mind a new coding language, especially if there will be visible benefits to the game, but I would really like to see thorough documentation on this if other languages like Lua will not be used. It wouldn't be wise to just release it with poor instruction on how the code functions with proper syntax and examples, very much like how GS2 was released. You should be wanting to bring in more coders, not making them know GS2, then go learn other coding fundamentals from other languages (declaring variables, when to use void, etc.), then come back to Graal and implement GS2 and guess at the structure of GS3 using a different syntax knowledge from another language, then have no idea where to proceed since there is no trace of documentation anywhere.

Quote:
Originally Posted by Stefan View Post
For script help normally /scripthelp is working quite fine, all new functionality is automatically added to /scripthelp or to the list you get by starting Graal with the "-listscriptfunctions" command-line option.
Back to the not wanting to drive coders away part... That's all fine, except if a new developer wants to jump in on GS3, it's a bit of a jumbled mess with having to know GS2, then scanning and hoping that the proper syntax with examples are listed in /scripthelp. Most of the time it's just command(int, string, string) without any guidance as to what the integer and strings are supposed to be. If that's changed it will help a lot, otherwise you're going to have a lot of wiki editing to do.

My 2 cents, but I think I will stick to GS2 unless GS3 is properly documented. Though, I will say I do think heading in this direction is a good thing. The timing is just a bit off as well as the odd/clunky syntax styles. Just rip off of another language's syntax or use an already existing language fully capable of attracting new developers *cough*Lua*cough*.
Reply With Quote
  #27  
Old 04-13-2013, 03:56 AM
Elk Elk is offline
Sr Marketing Strategist
Elk's Avatar
Join Date: Nov 2005
Location: Deerland
Posts: 3,829
Elk has a brilliant futureElk has a brilliant futureElk has a brilliant futureElk has a brilliant futureElk has a brilliant futureElk has a brilliant futureElk has a brilliant future
Send a message via ICQ to Elk Send a message via AIM to Elk Send a message via MSN to Elk Send a message via Yahoo to Elk
So technically you can connect to PC Graal via Browser with a proper Login?
__________________
iEra IGN: *Elk (Darkshire)
iCla. IGN: *Elk (Darkshire)
iZone IGN: *Elk (Darkshire)




Reply With Quote
  #28  
Old 04-13-2013, 04:10 AM
Gos_pira Gos_pira is offline
Registered Pirate Ghost
Gos_pira's Avatar
Join Date: Sep 2009
Location: Pirate Ghost Ship
Posts: 175
Gos_pira is a splendid one to beholdGos_pira is a splendid one to beholdGos_pira is a splendid one to beholdGos_pira is a splendid one to beholdGos_pira is a splendid one to behold
Quote:
Originally Posted by Elk View Post
So technically you can connect to PC Graal via Browser with a proper Login?
I think he means that porting scripts between script engines would be easier with these changes. Unless I just misunderstood what you meant.
Reply With Quote
  #29  
Old 04-13-2013, 05:05 AM
Gamerkid7 Gamerkid7 is offline
Registered User
Join Date: May 2006
Posts: 10
Gamerkid7 is an unknown quantity at this point
I agree with fowlplay4 and Gos_pira. I much prefer a Java-like syntax. The type declarations of the proposed GS3 just looks clunky and is needlessly different than common languages.

One feature that I would love to see is proper closures. Anonymous functions are great but don't maintain any context. This would make utility libraries extremely versatile. For example, a remove_if() method that takes a list and predicate function:

PHP Code:
function void removeIDs(int [B]rem_id[/B]) {
    
remove_if(this.idlist, function bool (int obj_id) {
       if (
obj_id == [B]rem_id[/B])
           return 
true;
       return 
false;
    });
    
UpdateDiplay();  

Then the code for remove_if only has to be maintained in one place and it would be a lot easier to figure out what a piece of code is doing from the functions being called.

Last edited by Gamerkid7; 04-13-2013 at 07:50 PM.. Reason: void->bool
Reply With Quote
  #30  
Old 04-13-2013, 02:41 PM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
I think this looks great. I don't mind the syntax since it's basically ActionScript.
I like the types idea and I like the dictionaries since that's the only thing I ever used the dynamic variable names for anyway.
Are you going to get rid of with() completely, or just with gui objects? How can we define particle effects without typing a lot?

My feature request is some way to share code between serverside and clientside without copy-pasting, which I don't think you can do right now. Maybe the join() changes will make that possible?
__________________
Testbed user: I figured since I can never find any scripters it was time to take desperate measures...and...TEACH MYSELF 0.0
Reply With Quote
  #31  
Old 04-13-2013, 05:03 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
I still don't see why there's no 'with' statement in GS3. It helps clean up code and is very useful in GUI Building and other object work.

I.e. How I've used it in GS2:

PHP Code:
temp.window addWindow("Example");
with (temp.window) {
  
this.title "Example Window";
  
with (addButton(this"Button")) {

  }
  
with (addButton(this"Button2")) {

  }
}

function 
addWindow(obj_id) {
  
temp.window = new GuiWindowCtrl(obj_id);
  return 
temp.window;
}

function 
addButton(parentobj_id) {
  
temp.button = new GuiButtonCtrl(obj_id);
  
parent.addcontrol(temp.button);
  return 
temp.button;

Quote:
Originally Posted by devilsknite1 View Post
but I would really like to see thorough documentation on this if other languages like Lua will not be used.
Even if he implemented Lua that isn't going to change the fact he still needs to document how the language works with and manipulates the Graal engine. A lot of GS2's current function usage isn't going to change that much in GS3 by the looks of it.
__________________
Quote:
Reply With Quote
  #32  
Old 04-13-2013, 06:01 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
I'm a bit of a PL nerd now rather than invested into a gscript codebase so I'm all for type system change for change's sake here.

I'm curious about first-class functions/closures, and what kind of polymorphism you're going to support. Also will there be generic user-defined types or is that only for dictionaries? Are you going for an llvm backend eventually?

Edit: Function-local type inference?

Edit: Also what happens when a gs2 script triggers a gs3 scripts and sends along arguments with the wrong types?
Reply With Quote
  #33  
Old 04-13-2013, 06:01 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Also **** y'all, varname:type is the best syntax
Reply With Quote
  #34  
Old 04-13-2013, 07:34 PM
Pandar Pandar is offline
Babylon Co-Manager
Pandar's Avatar
Join Date: Jan 2007
Location: New York
Posts: 68
Pandar has a spectacular aura aboutPandar has a spectacular aura about
...too easy.
__________________
R.I.P. Graal (1998 - 2004)
Reply With Quote
  #35  
Old 04-13-2013, 09:41 PM
Hezzy002 Hezzy002 is offline
Registered User
Join Date: Jul 2011
Posts: 247
Hezzy002 is a jewel in the roughHezzy002 is a jewel in the rough
I think you should just use LuaJIT because it's fast, commonly used (More free developers for you!!). Whatever you make will be worse in every way.
Reply With Quote
  #36  
Old 04-14-2013, 03:45 AM
Tim_Rocks Tim_Rocks is offline
a true gentlemen
Tim_Rocks's Avatar
Join Date: Aug 2008
Location: USA
Posts: 1,863
Tim_Rocks is a splendid one to beholdTim_Rocks is a splendid one to beholdTim_Rocks is a splendid one to beholdTim_Rocks is a splendid one to beholdTim_Rocks is a splendid one to behold
__________________
Reply With Quote
  #37  
Old 04-14-2013, 06:12 AM
Draenin Draenin is offline
Magnificent Bastard
Draenin's Avatar
Join Date: Dec 2004
Location: Bermuda Triangle
Posts: 6,790
Draenin has much to be proud ofDraenin has much to be proud ofDraenin has much to be proud ofDraenin has much to be proud ofDraenin has much to be proud ofDraenin has much to be proud of
Send a message via AIM to Draenin Send a message via MSN to Draenin Send a message via Yahoo to Draenin
Quote:
Originally Posted by Stefan View Post
Hello Graalians,

We have just started the work on a new scripting project and want your ideas and feedback about it. The idea is to create new Graal Script version (GS3) which will make scripts faster and more fit for bigger projects.


Quote:
Originally Posted by Stefan View Post
This first means some more work for scripters


Quote:
Originally Posted by Stefan View Post
Scripts can run faster


Quote:
Originally Posted by Stefan View Post
More reliable because it will complain when a variable has not been declared or is used incorrectly.


Quote:
Originally Posted by Stefan View Post
We can possibly convert the scripts to other languages (C++, Javascript etc.)


Quote:
Originally Posted by Stefan View Post
so it can possibly run in a browser in the future


Quote:
Originally Posted by Stefan View Post
We are already working on a converter which helps to convert scripts from GS2 to GS3. So a lot of work will be lifted from the programmer, and you can also use this tool for testing how the new scripting will look like.


Quote:
Originally Posted by Stefan View Post
existing scripts will still run, we don't force the new syntax and semantic, but it can be interesting for server-side logic and also new client-side code


Quote:
Originally Posted by Stefan View Post
just add a //#GS3 line to your script to use the new syntax and semantic


Quote:
Originally Posted by Stefan View Post
everything is still possible
Reply With Quote
  #38  
Old 04-14-2013, 07:30 AM
Fulg0reSama Fulg0reSama is offline
Extrinsical Anomaly
Fulg0reSama's Avatar
Join Date: Sep 2009
Location: Ohio
Posts: 3,049
Fulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant future
Quote:
Originally Posted by Draenin View Post
-Images-
This was my reaction in a nutshell minus the browser statement reaction image.
__________________

Careful, thoughts and opinions here scare people.
Reply With Quote
  #39  
Old 04-14-2013, 07:57 AM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
I dunno how offline development would even work anymore with half your systems running on the server. It'd be great to be able to deploy completely isolated dev environments loclly so you could use stuff like decentralized source control without bending over backwards, and it's not like in tyool 2013 the npcserver is such a trade secret that it can't be integrated into the client. Lots of multiplayer games with a singleplayer mode basically ship the game mechanics if not the networking bits of their server in the client. shrug.
Reply With Quote
  #40  
Old 04-14-2013, 02:08 PM
Crono Crono is offline
:pluffy:
Join Date: Feb 2002
Location: Sweden
Posts: 20,000
Crono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond repute
Quote:
Originally Posted by Loriel View Post
I dunno how offline development would even work anymore
it won't ;[
__________________
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 12:36 AM.


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