Graal Forums  

Go Back   Graal Forums > Development Forums > Future Improvements
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-14-2009, 04:30 AM
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
default class

I've heard it suggested before to release the default stuff to servers so they can edit it... but I'm not sure if we'll ever see that.

So what I suggest is a class called default that is created with the server. All functions created in this class are ran BEFORE the default functions. This way, we can overwrite default functions ourselves, to maybe make custom systems more backwards compatible.

For example, if I make the function:

function say2(txt) {
player.chat = txt;
}

in the default class, all say2 functions will instead set the player's chat to the text rather than open a sign. I'm not sure how possible this is, or what kind of security risks there are, but just thought I'd see what others thought.
Reply With Quote
  #2  
Old 05-14-2009, 12:52 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
This sorta makes everything complicated, because then scripters have to learn to expect different functionality for what should be "built-in functions" across different servers. It is also probably way too easy to break a lot of existing code very quickly also by making a mistake in such a class. Built-in functions should be kept the way they are.
Reply With Quote
  #3  
Old 05-14-2009, 02:30 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by Skyld View Post
This sorta makes everything complicated, because then scripters have to learn to expect different functionality for what should be "built-in functions" across different servers.
Which is not a problem if they're documented well, as they should be.
Quote:
Originally Posted by Skyld View Post
It is also probably way too easy to break a lot of existing code very quickly also by making a mistake in such a class.
You don't get anywhere without taking risks.

I'm against it simply because of the way GScript is. In a fully object oriented situation, you'd have something like:
PHP Code:
// C# pseudocode
public class TValServerNPCTServerNPC {
  public 
override void ToWeapons() {
    throw new 
NotImplementedException("LOL NOPE");
  }

And then have all your scripted stuff subclass TValServerNPC.

Something similar would just be odd with how GS2 is now.
__________________

Last edited by Inverness; 05-14-2009 at 02:42 PM..
Reply With Quote
  #4  
Old 05-14-2009, 03:14 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 do not really see what you are gaining there. It is not like C where you want to override standard library functions used by other libraries, you could just always go and edit scripts to call mySay2() which will do whatever you want anyway.

There is probably going to be a performance cost here that does not seem worth the gain.
Reply With Quote
  #5  
Old 05-14-2009, 05:53 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
Such a global class is partially a problem because of how function pointers are working. Such a global class could become quite large, seeing the size of some Control-NPCs. In my opinion it's better if the object is joining the needed classes at the beginning or end of the script so that you can easily see where functions are borrowed from. This is of course some problem when using existing levels where you would have to patch each single npc to use the new function.
Reply With Quote
  #6  
Old 05-14-2009, 06:37 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 Stefan View Post
This is of course some problem when using existing levels where you would have to patch each single npc to use the new function.
Can just write a script which runs over these levels and corrects whatever has to be corrected.
Reply With Quote
  #7  
Old 05-15-2009, 01:45 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by Crow View Post
Can just write a script which runs over these levels and corrects whatever has to be corrected.
In that case you can write a script to replace all instance of say2() with your own function.
__________________
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 10:33 PM.


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