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
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
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
Nice Stefan.
__________________
Follow my work on social media post-Graal:Updated august 2025.
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
  #16  
Old 05-19-2007, 11:11 AM
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
Quote:
Originally Posted by Stefan View Post
You can also do this, but keep care to add a semicolon behind the function declaration:

PHP Code:
this.func = function() {
  echo(
"nameless function");
}; 
Function prototypes! One of the best additions yet by far.

Wondering if it would be possible to have this.foo = public function () also, or something similar. Defining functions using this method in a TStaticVar results in a function inaccessible error in RC. Currently it is a bit of a pain to have to define a public function and copy it, if the functions you are defining are different for each object.
__________________
Skyld

Last edited by Skyld; 05-19-2007 at 03:33 PM..
Reply With Quote
  #17  
Old 05-20-2007, 12:13 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 Twinny View Post
Aww...printf() in loops problem wasn't fixed .
Yes sorry, just checked again and found the problem, so it will be fixed with the next update.

Quote:
Originally Posted by Skyld View Post
Function prototypes! One of the best additions yet by far.
Wondering if it would be possible to have this.foo = public function () also, or something similar. Defining functions using this method in a TStaticVar results in a function inaccessible error in RC. Currently it is a bit of a pain to have to define a public function and copy it, if the functions you are defining are different for each object.
May be they should be public by default?
Reply With Quote
  #18  
Old 05-20-2007, 03:28 AM
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
I can't seem to get function objects to work as expected:

PHP Code:
public function sampleFunction() {
 return 
this.test this.test2;
}

public function 
someClass() {
obj2 = new TStaticVar();
obj2.test 0;
obj2.test2 0;
obj2.sampleFunction this.sampleFunction;
return 
obj2;
}

function 
onCreated() {
  
newClass someClass();
  
newClass.test 1;
  
newClass.test2 2;
  echo(
newClass.sampleFunction()); //should echo 3?

Even cutting it down:
PHP Code:
 obj2 = new TStaticVar();
  
obj2.test 3;
  
obj2.test2 4;
  
obj2.sampleFunction this.sampleFunction;

  echo(
obj2.sampleFunction()); 
These give errors in RC: GraalScript: Function unknown_object.sampleFunction not accessible at line 12 in script of class_test


Do function objects only work on this. variables?
__________________

Coming soon (Hopefully:P)
Reply With Quote
  #19  
Old 05-20-2007, 03:39 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 JkWhoSaysNi View Post
stuff
Well, to be honest I didn't know you could even return objects?

But so far all I've witnessed object functions to be usable with is this. prefix. I tried it with temp and it didn't work for the most part, I'll make sure to test that out again, but I think it should work in general tho.

E: Definitely only useable with this. prefix. The question is if this is so limited, can we get some more effective or in-depth uses of pointer functions. At this time I don't really see the use.
__________________


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
  #20  
Old 05-20-2007, 05:37 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
if ( func( "blah" ) )

vs.

this.funct = func();
if ( this.funct( "blah" ) )

Any other uses?
That doesn't make any sense to me.
__________________
Reply With Quote
  #21  
Old 05-20-2007, 05:41 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by cbkbud View Post
if ( func( "blah" ) )

vs.

this.funct = func();
if ( this.funct( "blah" ) )

Any other uses?
That doesn't make any sense to me.
>_>
PHP Code:
function onCreated()
{
  if (
func("blah")) {
    
stuff();
  }
}
function 
func(foo) {
  return 
true;

VS
PHP Code:
function onCreated()
{
  
this.funct = function() {
    return 
true;
  };
  if (
this.funct("blah")) {
    
stuff();
  }

is more like it
__________________
Reply With Quote
  #22  
Old 05-20-2007, 05:43 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
Point is, this limits the amount of functions you catch and call.
__________________


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
  #23  
Old 05-20-2007, 05:47 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by killerogue View Post
Point is, this limits the amount of functions you catch and call.
true
__________________
Reply With Quote
  #24  
Old 05-20-2007, 06:00 AM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
I honestly think this is useless and is just causing confusion. I get it, but at the same time it still confuses me
Reply With Quote
  #25  
Old 05-20-2007, 06:15 AM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
I find that the most practical thing about this function thing if for sorting... Basically, passing the function the depicts which value is greater.
Reply With Quote
  #26  
Old 05-20-2007, 09:57 AM
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
Quote:
Originally Posted by cbkbud View Post
if ( func( "blah" ) )

vs.

this.funct = func();
if ( this.funct( "blah" ) )

Any other uses?
That doesn't make any sense to me.
Quote:
Originally Posted by Rapidwolve View Post
I honestly think this is useless and is just causing confusion. I get it, but at the same time it still confuses me
If you do not understand the use of them, I suggest that you learn JavaScript and use them there.

They are very useful for controlling functions at execution time, and they are a lot more organised in event-driven system.
__________________
Skyld
Reply With Quote
  #27  
Old 05-20-2007, 02:00 PM
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 Chompy View Post
>_>
PHP Code:
function onCreated()
{
  if (
func("blah")) {
    
stuff();
  }
}
function 
func(foo) {
  return 
true;

VS
PHP Code:
function onCreated()
{
  
this.funct = function() {
    return 
true;
  };
  if (
this.funct("blah")) {
    
stuff();
  }

is more like it
Is there a point to this?
__________________
Reply With Quote
  #28  
Old 05-20-2007, 02:32 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by cbkbud View Post
Is there a point to this?
Yep

Quote:
Originally Posted by Skyld View Post
If you do not understand the use of them, I suggest that you learn JavaScript and use them there.

They are very useful for controlling functions at execution time, and they are a lot more organised in event-driven system.
Quote:
Originally Posted by killerogue View Post
Point is, this limits the amount of functions you catch and call.
__________________
Reply With Quote
  #29  
Old 05-21-2007, 11:34 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 killerogue View Post
Well, to be honest I didn't know you could even return objects?
A TGraalVar that is an "Object" exists as a reference to the object so no matter where the variable is it will always point to a specific object. And yes, you can return object references.

It is something I used in my mud system, you construct all mud objects in a single array and return the object reference with the function. Having a master list prevents the object from being destroyed because of lack of references. Though I don't know what Graal does when all references are removed, I expect it similar to Java.
__________________
Reply With Quote
  #30  
Old 05-22-2007, 01:06 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
Quote:
Originally Posted by Inverness View Post
Though I don't know what Graal does when all references are removed, I expect it similar to Java.
Currently destroying a child staticvar within a parent staticvar leaves a pointer in the parent to the child. Basically it points to 0's. Highly annoying for debugging . Hopefully it will be fixed soon.
Reply With Quote
  #31  
Old 05-22-2007, 01:46 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 already know points are left behind but I meant the object itself. If it wasn't destroyed on loss of references it could still function.
__________________
Reply With Quote
  #32  
Old 05-22-2007, 08: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
Hmm...i doubt gscript has a garbage collector. Make a random global TStaticVar(), remove the code that made it and check up on it every now and then .
Reply With Quote
  #33  
Old 05-22-2007, 11:45 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
Fun stuff!
Good job
__________________
Do it with a DON!
Reply With Quote
  #34  
Old 05-28-2007, 11:20 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 Twinny View Post
Hmm...i doubt gscript has a garbage collector. Make a random global TStaticVar(), remove the code that made it and check up on it every now and then .
There is, it's quite accurate, checking recursive links.

About the "not accessible" error: I have fixed it, will upload new npcservers soon.

About npc rights problems: The problem is that people write their account name wrong (wrong case), so the npcserver is not accepting it; to fix it write it correctly e.g. Shadow87 instead of shadow87, I will also upload new npcservers soon.

Last edited by Admins; 05-29-2007 at 10:23 AM..
Reply With Quote
  #35  
Old 02-26-2008, 12:53 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
Reviving thread here but are variable functions available on the client yet? I tried to make one but it didn't work
Reply With Quote
  #36  
Old 02-26-2008, 06:08 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by Twinny View Post
Reviving thread here but are variable functions available on the client yet? I tried to make one but it didn't work
They work (at least in simple cases):

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.test_func = function () {
    echo(
"I win!");
  };

  
this.test_func();

I've seen the functionality break down within with() blocks.
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/

Last edited by Tolnaftate2004; 02-26-2008 at 06:10 PM.. Reason: Because te****nc contains raunchy language!
Reply With Quote
  #37  
Old 02-27-2008, 01:07 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 Tolnaftate2004 View Post
I've seen the functionality break down within with() blocks.
If you return in a with() block crazy stuff happens.
__________________
Reply With Quote
  #38  
Old 02-27-2008, 04:10 AM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by Inverness View Post
If you return in a with() block crazy stuff happens.
This is true, but I meant that dynamic functions are treated more like inline functions.

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
temp.var = new TStaticVar();
  
with (temp.var) {
    
this.test_func = function () {
      echo(
"I win!");
    };
  }

  
temp.var.test_func(); // Doesn't work

__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote
  #39  
Old 02-27-2008, 10:07 AM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
strange, no idea but would ths work


PHP Code:
temp.var.test_func = function() 
{
  echo(
"I Win!");

__________________

Last edited by Tolnaftate2004; 02-27-2008 at 10:36 AM.. Reason: edit != quote (sorry)
Reply With Quote
  #40  
Old 02-27-2008, 10:37 AM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by xAndrewx View Post
strange, no idea but would ths work


PHP Code:
temp.var.test_func = function() 
{
  echo(
"I Win!");

Yes, granted they are called & defined in the same scope (as far as I can tell).
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
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:01 PM.


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