Graal Forums  

Go Back   Graal Forums > Graal V6 forums > Announcements
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 05-18-2007, 08:28 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
NPCServer updates

Today the npcservers have been updated. Here some of the updates:

- /style works again
- improved /scripthelp which also lists object types that match
- fixed int(random(lowerlimit, upperlimit)) which sometimes reached upperlimit (when the random number was too close to the upperlimit it was rounding to upperlimit)
- scripts can now access image files (png, gif, jpeg) and also files inside the levels folder if the npcserver has the rights for that
- if you call a function of another object which is non-public, then it will display that the function is not accessible, instead of saying that the function doesn't exist
- graal script now supports function objects: this will print "param: 123"

PHP Code:
function onCreated() {
  
this.func this.func1;
  
this.func(123);
}
function 
func1(param) {
  echo(
"param: " param);

You can also do this, but keep care to add a semicolon behind the function declaration:

PHP Code:
this.func = function() {
  echo(
"nameless function");
}; 
This is only working on serverside, it will work on clientside with the next Graal version.
There is a protection against unsetting functions, since often scripts use the same name for functions and variables. If the variable is not linking to a function but the script contains a function with that name, then it will use the function defined in the script instead. You can however link to another function.
Reply With Quote
  #2  
Old 05-18-2007, 08:31 PM
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
Quote:
Originally Posted by Stefan View Post
Stuff
Very cool!

Edit: But what is the point of doing function objects? o.O
__________________
What signature? I see no signature?
Reply With Quote
  #3  
Old 05-18-2007, 08:36 PM
Matt Matt is offline
iZone Administrator
Matt's Avatar
Join Date: Apr 2005
Location: United States
Posts: 2,690
Matt is a jewel in the roughMatt is a jewel in the rough
Very nice updates, Stefan.
__________________
Need Playerworld or Account support?
GraalOnline/Toonslab Support Center
Reply With Quote
  #4  
Old 05-18-2007, 08:47 PM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Function objects!

What do they do? Sounds like fun.

Edit: The first one I understand as being able to assign a function name to a variable. Being able to add params to the functionname by calling the variable as the function and receiving it using the assigned function name to the variable.

Ah, tested out the later, the beauty of it is you don't need to actually receive the function. Now that is sexy.

Edit 2: There's only a few problems I'm having, like not being able to return information and work with objects inside the "embedded functions".
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.

Last edited by killerogue; 05-18-2007 at 09:19 PM..
Reply With Quote
  #5  
Old 05-18-2007, 09:21 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Nice Stefan.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #6  
Old 05-18-2007, 09:25 PM
Deadly_Killer Deadly_Killer is offline
Registered User
Join Date: Feb 2002
Posts: 227
Deadly_Killer is on a distinguished road
Quote:
/scripthelp text: print help for a server side function
/scriptscan weapons/npcs/classes/levels/all text: scan scripts
Very cool!
__________________
- Zidane / Zidaya
Reply With Quote
  #7  
Old 05-18-2007, 09:50 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
Very nice! I wanted function pointers for something a while ago... but now I can't remember what it was :P
__________________

Coming soon (Hopefully:P)
Reply With Quote
  #8  
Old 05-18-2007, 10:58 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Cool...
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #9  
Old 05-18-2007, 11:08 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
now i remember! I wanted some OO functionality without using classes.
If I did this:

PHP Code:
public function increment() {
this.count++;
}

function 
onCreated() {
 
= new TStaticVar;
 
x.increment this.increment;
 
x.count 1;
 
x.increment();  //x.count = 2?

Will x.count get incremented when x.increment() is called or will count get incremented in the script which created x?
__________________

Coming soon (Hopefully:P)
Reply With Quote
  #10  
Old 05-19-2007, 01:46 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
Quote:
Originally Posted by JkWhoSaysNi View Post
Will x.count get incremented when x.increment() is called or will count get incremented in the script which created x?
x.count will be incremented
Reply With Quote
  #11  
Old 05-19-2007, 02:21 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
So what about returning information through this, doesn't seem to work?
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #12  
Old 05-19-2007, 03:11 AM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Quote:
Originally Posted by killerogue View Post
So what about returning information through this, doesn't seem to work?
Not sure but something like this would probobly work:
PHP Code:
function func()
  return 
"Hi";

function 
onCreated()
{
= new TStaticVar();
this.func;
echo(
t);

Reply With Quote
  #13  
Old 05-19-2007, 05:15 AM
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
Aww...printf() in loops problem wasn't fixed .
Reply With Quote
  #14  
Old 05-19-2007, 05:25 AM
MegaMasterX90875 MegaMasterX90875 is offline
Retired Graalian (2009)
MegaMasterX90875's Avatar
Join Date: Feb 2006
Location: North Carolina
Posts: 132
MegaMasterX90875 is on a distinguished road
Send a message via AIM to MegaMasterX90875
Quote:
Originally Posted by Stefan View Post
Today the npcservers have been updated. Here some of the updates:

- /style works again
- improved /scripthelp which also lists object types that match
- fixed int(random(lowerlimit, upperlimit)) which sometimes reached upperlimit (when the random number was too close to the upperlimit it was rounding to upperlimit)
- scripts can now access image files (png, gif, jpeg) and also files inside the levels folder if the npcserver has the rights for that
- if you call a function of another object which is non-public, then it will display that the function is not accessible, instead of saying that the function doesn't exist
- graal script now supports function objects: this will print "param: 123"

PHP Code:
function onCreated() {
  
this.func this.func1;
  
this.func(123);
}
function 
func1(param) {
  echo(
"param: " param);

You can also do this, but keep care to add a semicolon behind the function declaration:

PHP Code:
this.func = function() {
  echo(
"nameless function");
}; 
This is only working on serverside, it will work on clientside with the next Graal version.
There is a protection against unsetting functions, since often scripts use the same name for functions and variables. If the variable is not linking to a function but the script contains a function with that name, then it will use the function defined in the script instead. You can however link to another function.
Yet another moment where GS2 has unlimited possibilities opened. Thanks Stefan, WHEEEEEEEE
__________________
Mess with the best, Die like the rest.



Reply With Quote
  #15  
Old 05-19-2007, 05:27 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Quote:
Originally Posted by Rapidwolve View Post
Not sure but something like this would probobly work:
PHP Code:
function func()
  return 
"Hi";

function 
onCreated()
{
= new TStaticVar();
this.func;
echo(
t);

Yeah, RW that returned func. So, I'm not sure. This seems to contain a few bugs as it were because it's new. But as far as returning information I had been doing things like.

PHP Code:
function onCreated()
{
  
this.newObj = function() {
    echo(
"stuff");
  };
 
  
this.newObj();

And I have been trying to, for lack of a better word, reverse engineer that into something like.

PHP Code:
function onCreated()
{
  
this.newObj = function() {
    return (
2);
  };
 
  echo(
this.newObj());

And lol, whaddya know...it works that way, this has to be experiemented on a bit. As it returned the right thing just now. =o
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
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 11:16 PM.


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