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 02-25-2007, 02:14 AM
godofwarares godofwarares is offline
Webmaster
godofwarares's Avatar
Join Date: Dec 2006
Location: Florida
Posts: 552
godofwarares is on a distinguished road
Send a message via ICQ to godofwarares Send a message via AIM to godofwarares Send a message via MSN to godofwarares Send a message via Yahoo to godofwarares
Support for various operations

I've always wondered why these 5 words were highlighted in my code when they do nothing:

PHP Code:
import
extends
class
package
implements 
I know they can be used in Java, somewhat like this:

PHP Code:
package myPack;

import myPack.oneClass;
import myPack.anotherClass;

public class 
Whatever extends This implements That
{
     
oneClass.go();

Is there to be any support for these commands in the future?


Definitions for each commands

Package
The package command in Java imports a folder that contains classes, example: myPack.thisClass in the folder would be myPack/thisClass.

Import
Same as this.join, except it imports only the functions and not the variables (except for integers, such as CLOSE_ON_HIDE, on that line)

Extends
This is virtually the same as this.join.

Class
Self-Explanitory. This just defines the file as a class, and you can put many of these in a file to specify more than one class. E.g.:

PHP Code:
public class this
{
     
// Some code
}

public class 
this_whatever
{
     
// Some code


This can be useful if you don't want to spam your class list.

Implements
About the same as import, but all variables are imported into the current class.





Any ideas/comments?
* NO FLAMING OR WHATEVER! *
__________________
What signature? I see no signature?
Reply With Quote
  #2  
Old 02-25-2007, 02:54 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
Those functions are highlighted in the RC because I have copied & modified the syntax highlight definitions from Java, you can modify the definition, it's put somewhere in the user directory.
Graal uses a different, more dynamic way of classes which you can join and leave at any time. I am not sure if those two ways can easily be combined, although it could be interesting to add more functionality if it's helping for coding.

In the next Graal version the support for using classes on client-side is much better, so you can use onCreated() (plus caching of classes and when you call a function of an object which is waiting for classes to be downloaded then it is suspending the script until the classes have been downloaded)
Reply With Quote
  #3  
Old 02-25-2007, 05:55 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
I would like to see something like 'import' being made functional by allowing you to create function links in one object to another.
Example:

Weapon: +Strange/Name
public function a()
public function b()

Weapon: +Another/One
public function a()
public function c()

So you have function a() and b() in the weapon +Strange/Name which due to the characters in it, you can't call +Strange/Name.a() and such because of the special characters so you have to use makevar() or something.

Now in the weapon named +Another/One you could have something like:
function onCreated() {
import(makevar("+Strange/Name"));
}


What the import function would do would be to take an object as its parameter and make function links in the current object leading to the imported object. This way you can call functions from other objects without using large object identifiers before the function.

Also, you might notice how function a exists in both objects, I think there could be an option in the import function to overwrite existing functions with imported ones or not. Also importing would only work for public functions since its basically inserting one function linking to another.

Again, maybe another feature could be an import prefix, which would simply add the specified prefix to imported function names so existing functions can't be overwritten at all.
__________________
Reply With Quote
  #4  
Old 02-25-2007, 09:57 AM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Quote:
Originally Posted by Stefan View Post
Those functions are highlighted in the RC because I have copied & modified the syntax highlight definitions from Java, you can modify the definition, it's put somewhere in the user directory.
Graal uses a different, more dynamic way of classes which you can join and leave at any time. I am not sure if those two ways can easily be combined, although it could be interesting to add more functionality if it's helping for coding.

In the next Graal version the support for using classes on client-side is much better, so you can use onCreated() (plus caching of classes and when you call a function of an object which is waiting for classes to be downloaded then it is suspending the script until the classes have been downloaded)
Oh cool, I'm going to edit mine!
Reply With Quote
  #5  
Old 02-25-2007, 03:55 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
Quote:
Originally Posted by Inverness View Post
I would like to see something like 'import' being made functional by allowing you to create function links in one object to another.
Would be ("+Strange/Name").a()
Theoretically such an "import" function is possible since weapon and npc scripts can work as classes too, it might be a little bit confusing though and might be better to put the code into an own class and then join it from both objects
Reply With Quote
  #6  
Old 02-26-2007, 02:18 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
Eh, its not better in my case where the code requires serverside/clientside communication, best done by weapon.
__________________
Reply With Quote
  #7  
Old 02-26-2007, 02:52 AM
godofwarares godofwarares is offline
Webmaster
godofwarares's Avatar
Join Date: Dec 2006
Location: Florida
Posts: 552
godofwarares is on a distinguished road
Send a message via ICQ to godofwarares Send a message via AIM to godofwarares Send a message via MSN to godofwarares Send a message via Yahoo to godofwarares
I personally think it would be great to include, especially imports:

PHP Code:
import battlesystem;

(
serverside code)

//#CLIENTSIDE
(clientside code
I would like to see Import work on both sides, serverside and clientside.
__________________
What signature? I see no signature?
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 04:47 PM.


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