Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-07-2008, 02:51 AM
PrinceOfKenshin PrinceOfKenshin is offline
That guy with a beard
PrinceOfKenshin's Avatar
Join Date: May 2004
Location: Ontario, Canada
Posts: 819
PrinceOfKenshin has a spectacular aura aboutPrinceOfKenshin has a spectacular aura about
Interfaces?

Are there interfaces in GS2? I say this because i have been working with java a lot lately and i was wondering if there is like interfaces or something similar? Would someone care to explain if there is.
__________________


Quote:
Game Master (Server): Greetings PrinceOfKenshin, there are new posts on the forums that demand your urgent attention! God speed, the fate of the world is in your hands. If you fail, middle earth will forever be in the darkness and your children will be enslaved by McKain.
Reply With Quote
  #2  
Old 05-07-2008, 02:58 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
Quote:
Originally Posted by PrinceOfKenshin View Post
Are there interfaces in GS2? I say this because i have been working with java a lot lately and i was wondering if there is like interfaces or something similar? Would someone care to explain if there is.
In Java, an interface is basically a "high" class which tells what you must do in the class, then leaves you to define it. This lets you make all sorts of objects under interface, say, Hurtable. For example, a turtle, a dog, and Stefan. You can then have an array of Hurtable which can contain turtle, dog, and Stefan and still call kill() to any of these without knowing what the class will do, only knowing it can do it (this way you don't have to have a separate array for each class).

I know you know this, for the benefit of those who don't.

In GS2, this would be rather pointless, as you can call whatever you want on anything you want. For example, I can call doSomething() to the Control NPC, even if it doesn't have this function. I'll get an error in RC, but I can still call it. This defeats the whole purpose of interfaces since you can call no matter what.

If you're trying to replicate this, perhaps have a class like this:

Code of script interface_bird
PHP Code:
function onCreated()
{
  
this.isBird true;

or so. You can then do something like this:
PHP Code:
join"bird_robin" );
join"interface_bird" ); 
You could have a script check if it was a bird by doing this:

PHP Code:
for ( temp.)
{
  if ( 
temp.a.isBird )
  {
    
temp.a.singPrettyMusic();
  }

So, this would let you replicate interfaces.

Like I said, this is pointless in GS2 as GS2 won't die like Java will; it will keep going and report an error. Java generally won't even compile this code to start with.

So no, there is no interface functionality in GS2 to my knowledge, and there is no reason to need it.

Hope this helps!
__________________
Reply With Quote
  #3  
Old 05-07-2008, 05:50 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
Graal doesn't need Interfaces.

C# > Java
__________________
Reply With Quote
  #4  
Old 05-07-2008, 05:52 AM
Programmer Programmer is offline
Coder
Programmer's Avatar
Join Date: Jan 2008
Location: -78.464422, 106.837328
Posts: 449
Programmer has a spectacular aura aboutProgrammer has a spectacular aura about
Send a message via AIM to Programmer Send a message via MSN to Programmer Send a message via Yahoo to Programmer
Quote:
Originally Posted by Inverness View Post
Graal doesn't need Interfaces.

C# > Java
C++ > C#
__________________
- Iᴀɴ Zɪᴍᴍᴇʀᴍᴀɴ
Reply With Quote
  #5  
Old 05-07-2008, 07:22 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
You don't need function prototypes in GS2 so of course you wouldn't have something like that.
__________________
Do it with a DON!
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 11:33 PM.


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