Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-03-2009, 11:39 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
Inheriting enums?

I am defining an enum in class 1, like this:

NPC Code:
enum FOO {
VAL_1,
VAL_2
}



then in another class I do:

NPC Code:
join("class 1");
this.chat = FOO.VAL_2;



and the chat text of NPCs of that class gets set to 0. Why is it not 1, ie. why is the enum not coming into scope by having the surrounding class joined?

Edit: Same with "const" constants, actually.
Reply With Quote
  #2  
Old 02-03-2009, 02:07 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
Because join and leave are dynamic functions, not done at compile time. It could be possible to expand the "import" function to allow importing of const and enums from other classes.
Reply With Quote
  #3  
Old 02-03-2009, 03:19 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
Quote:
Originally Posted by Stefan View Post
Because join and leave are dynamic functions, not done at compile time. It could be possible to expand the "import" function to allow importing of const and enums from other classes.
I would be happy with a non-dynamic, compile-time, include-style alternative to join, for my situation. (I am not sure whether you are suggesting to modify join, or add an 'import' compile-time-function, or.)
Reply With Quote
  #4  
Old 02-04-2009, 02:25 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 Loriel View Post
I would be happy with a non-dynamic, compile-time, include-style alternative to join, for my situation. (I am not sure whether you are suggesting to modify join, or add an 'import' compile-time-function, or.)
import is something he added awhile ago to the GServers.

You make the class "foo.bar" and you can do stuff like

PHP Code:
public function Bar() {
  return 
this;
}
public function 
getSomething() {
  return 
2;

And then elsewhere:

PHP Code:
import foo.bar;
function 
onPlayerEnters() {
  
temp.myBar = new Bar();
  echo(
temp.myBar.getSomething()); // echos 2

I'm guessing this is done at compile-time, so your enums would work as well if Stefan were to make the changes.
Reply With Quote
  #5  
Old 02-04-2009, 12:17 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 WhiteDragon View Post
import is something he added awhile ago to the GServers.
This. Is. Awesome.
Reply With Quote
  #6  
Old 02-04-2009, 02:01 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 WhiteDragon View Post
import is something he added awhile ago to the GServers.
So if you hadn't announced this, when was the rest of the scripting community going to find out about it?
__________________
Reply With Quote
  #7  
Old 02-04-2009, 03:08 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
So if you hadn't announced this, when was the rest of the scripting community going to find out about it?
Already mentioned it before: http://forums.graalonline.com/forums...7&postcount=24
It's not really doing a lot though.
Reply With Quote
  #8  
Old 02-04-2009, 06:58 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 Stefan View Post
Already mentioned it before: http://forums.graalonline.com/forums...7&postcount=24
It's not really doing a lot though.
I'm sure many would appreciate if you created a sticky thread full of the random NPC-Server updates that you do.
__________________
Reply With Quote
  #9  
Old 02-04-2009, 07:54 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
Quote:
Originally Posted by Inverness View Post
I'm sure many would appreciate if you created a sticky thread full of the random NPC-Server updates that you do.
I miss newfeatures.txt.
Reply With Quote
  #10  
Old 02-05-2009, 02:45 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
import is a bit buggy though, every time I attempt to do something with it I encounter errors after the program structure gets more complicated.
Reply With Quote
  #11  
Old 02-05-2009, 06:04 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 Loriel View Post
I miss newfeatures.txt.
There was never a newfeatures.txt for npcserver, and the updates for the client are already on the wiki
Might be interesting to add a wiki page for the npcserver/gserver updates, there is usually a lot. In the past few weeks these things were added (will work once the new npcserver is tested and uploaded everywhere):
- /stats displays memory usage
- calling leave() for other objects will directly let the object leave the class instead of waiting until the current script has finished execution
- TDrawingPanel on serverside for image manipulation, also adds a new command maskimage(x,y,imagename,"add" or "multiply")
- getimgwidth() and getimgheight() also work for jpegs etc., not just gifs and png/mng
- some new commands for the mudlib which are secret right now except for the kingdoms staff
Reply With Quote
  #12  
Old 02-05-2009, 07:02 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
There was never a newfeatures.txt for npcserver, and the updates for the client are already on the wiki
Might be interesting to add a wiki page for the npcserver/gserver updates, there is usually a lot. In the past few weeks these things were added (will work once the new npcserver is tested and uploaded everywhere):
- /stats displays memory usage
- calling leave() for other objects will directly let the object leave the class instead of waiting until the current script has finished execution
- TDrawingPanel on serverside for image manipulation, also adds a new command maskimage(x,y,imagename,"add" or "multiply")
- getimgwidth() and getimgheight() also work for jpegs etc., not just gifs and png/mng
- some new commands for the mudlib which are secret right now except for the kingdoms staff
Uhh, top secret. Awesome. I agree though, a wiki page for gserver/npcserver changes would be very nice.
__________________
Reply With Quote
  #13  
Old 02-05-2009, 07:03 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
Quote:
Originally Posted by Stefan View Post
There was never a newfeatures.txt for npcserver, and the updates for the client are already on the wiki
Let me rephrase that: I miss the old days when I could get more or less complete information about any feature by checking newfeatures.txt.
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 06:22 PM.


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