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 06-20-2011, 08: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
If you could change one thing about GScript, what would it be?

If you could go back in time before GS2 and change any one thing about it, what would it be? Compatibility with old code is not a problem—even a change as drastic as strict typing is acceptable for this exercise. Ideally they will be entirely language-related and not things such as documentation, version control, etc.

My one thing:
I would make objects use a strict class system, and make it easy for scripters to edit these object classes. There would be a list of scripts much like the NPCs list for object classes (not related to classes now). These classes would have constructors, and support inheritance. All object types (such as GuiScrollCtrl) would work in this fashion (although they would not appear in this class list) and could be extended by objects. I could make a class called GuiIPhoneScrollCtrl which extends GuiScrollCtrl and has iPhone-like scrolling.
__________________
Reply With Quote
  #2  
Old 06-20-2011, 03: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
Remove the need for temp prefixing.
__________________
Quote:
Reply With Quote
  #3  
Old 06-20-2011, 03:25 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 fowlplay4 View Post
Remove the need for temp prefixing.
I'm just curious: What would you prefer instead? No prefixes for temporary vars at all, instead using constructors for global vars?
Reply With Quote
  #4  
Old 06-20-2011, 03:41 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 Crow View Post
I'm just curious: What would you prefer instead? No prefixes for temporary vars at all, instead using constructors for global vars?
Yeah something like that, and maybe a global prefix.

This would be my target result:

PHP Code:
function onCreated() {
  
1;
  
2;
  
otherFunc();
  echo(
a SPC b); // with change it echos "1 2" currently it echos "2 1"
}

function 
otherFunc() {
  
2;
  
1;

__________________
Quote:
Reply With Quote
  #5  
Old 06-21-2011, 07:01 AM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Make it based on a dependent type theory.

More realistically: make it much, much closer to JavaScript. Essentially, ECMAScript with a DOM-like interface to Graal.
Reply With Quote
  #6  
Old 06-21-2011, 08:25 PM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
ability to restrict query execution/variable changes to certain classes/weapons/NPCs
Reply With Quote
  #7  
Old 06-22-2011, 05:50 AM
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
The lack of masking support
http://forums.graalonline.com/forums...hp?t=134263607
__________________

Don Hertzfeldt <3
Reply With Quote
  #8  
Old 06-22-2011, 01:10 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Quote:
Originally Posted by Mark Sir Link View Post
ability to restrict query execution/variable changes to certain classes/weapons/NPCs
Been requested so many times...can only hope!
Reply With Quote
  #9  
Old 06-22-2011, 08:41 PM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
Quote:
Originally Posted by Twinny View Post
Been requested so many times...can only hope!
http://forums.graalonline.com/forums...hp?t=134260502
Reply With Quote
  #10  
Old 07-01-2011, 01:00 AM
MrDunne MrDunne is offline
Registered User
Join Date: Aug 2010
Posts: 38
MrDunne is on a distinguished road
Fix anonymous functions.
Reply With Quote
  #11  
Old 07-01-2011, 01:20 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by MrDunne View Post
Fix anonymous functions.
Elaborate.
__________________
Reply With Quote
  #12  
Old 07-01-2011, 02:05 AM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Quote:
Originally Posted by Chompy View Post
Elaborate.
There are a few problems.
  • In certain cases, when passing around an anonymous function, you lose the ability to call it. I think the problem is when you call the anonymous function from a different class than it was defined, but I'm not certain exactly when it happens. (If someone wants to debug this, please do.)

    My current hack around this is, given a function temp.f, doing (@temp.f)(), which casts the function pointer to a string like "function_913727", which is a global variable and can be called from anywhere as a result.
  • When a class using anonymous functions is updated, most things break until you update the NPC/Weapon that they are joined to.
Reply With Quote
  #13  
Old 07-01-2011, 09:22 AM
MrDunne MrDunne is offline
Registered User
Join Date: Aug 2010
Posts: 38
MrDunne is on a distinguished road
Quote:
Originally Posted by Chompy View Post
Elaborate.
Quote:
Originally Posted by WhiteDragon View Post
There are a few problems.
  • In certain cases, when passing around an anonymous function, you lose the ability to call it. I think the problem is when you call the anonymous function from a different class than it was defined, but I'm not certain exactly when it happens. (If someone wants to debug this, please do.)

    My current hack around this is, given a function temp.f, doing (@temp.f)(), which casts the function pointer to a string like "function_913727", which is a global variable and can be called from anywhere as a result.
  • When a class using anonymous functions is updated, most things break until you update the NPC/Weapon that they are joined to.
Mainly this. There's also this:

PHP Code:
function onCreated() {
  
temp.func myTest();
  (@ 
temp.func)();

  
myOtherTest(function () {
    echo(
"yeah baby");
  });
}

function 
myTest() {
  return function () {
    echo(
"yeah baby");
  };
}

function 
myOtherTest(func) {
  (@ 
func)();

Produces the following:

HTML Code:
Script compiler output for *scratch*:
error: unexpected token: function at line 3: myOtherTest(function () {
error: unexpected token: ( at line 3: myOtherTest(function () {
error: unexpected token: ) at line 3: myOtherTest(function () {
error: unexpected token: ) at line 5: });
error: unexpected token: function at line 13: return function () {
error: unexpected token: ( at line 13: return function () {
error: unexpected token: ) at line 13: return function () {
It doesn't seem right to me.
Reply With Quote
  #14  
Old 07-01-2011, 09:42 AM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Quote:
Originally Posted by MrDunne View Post
There's also this: ...
That's a result of the GS2 grammar not being flexible enough. Ideally, anonymous functions would be listed as expressions (so you could put them anywhere you could put, say, true), but they seem to only be allowed in variable assignments (i.e., temp.f = ...).

One nifty hack around this one is, for example, return (temp.f = function () { ... } );. But that's rather ugly and I certainly don't do it .

But yeah, that is indeed another thing that should be changed and should be fairly straightforward.
Reply With Quote
  #15  
Old 07-01-2011, 01:17 PM
MrDunne MrDunne is offline
Registered User
Join Date: Aug 2010
Posts: 38
MrDunne is on a distinguished road
Quote:
Originally Posted by cbk1994 View Post
I would make objects use a strict class system, and make it easy for scripters to edit these object classes. There would be a list of scripts much like the NPCs list for object classes (not related to classes now). These classes would have constructors, and support inheritance. All object types (such as GuiScrollCtrl) would work in this fashion (although they would not appear in this class list) and could be extended by objects. I could make a class called GuiIPhoneScrollCtrl which extends GuiScrollCtrl and has iPhone-like scrolling.
I kinda disagree here. I think pushing GS's object system more towards Javascript and prototypical OO would be far better. I think it'd be way easier going in that direction than going back and redoing it in a different style of OO.
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:02 PM.


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