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 01-31-2009, 12:45 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
Assigning functions to GUI objects

It would be nice if you could do things like this, without generating a "function not found" error.

PHP Code:
//#CLIENTSIDE
function onCreated()
{
  new 
GuiWindowCtrl("Debug") {
    
this.testFunc = function () {
      echo(
"Sup?");
    };
    
    
this.testFunc();
  }

NPC Code:
GraalScript: Function Debug.testFunc not found in script of Weapon Public/xXziroXx/Debug

__________________
Follow my work on social media post-Graal:Updated august 2025.

Last edited by xXziroXx; 01-31-2009 at 04:24 PM.. Reason: <3 Darlene for uncensoring stfu, testFunc is now possible! :D
Reply With Quote
  #2  
Old 01-31-2009, 08:51 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
I don't understand, why shouldn't it give an error?
__________________
Reply With Quote
  #3  
Old 01-31-2009, 08:53 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
Quote:
Originally Posted by cbk1994 View Post
I don't understand, why shouldn't it give an error?
What are you not understanding about it?

http://forums.graalonline.com/forums...ad.php?t=74042
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #4  
Old 01-31-2009, 09:49 PM
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
I'm not sure, but function prototypes may not automatically be declared public and it looks like the way it's calling it is "Debug.function()" when you use "this." making it required to be public...

Although that's all speculation.
Reply With Quote
  #5  
Old 01-31-2009, 10:02 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
Quote:
Originally Posted by WhiteDragon View Post
I'm not sure, but function prototypes may not automatically be declared public and it looks like the way it's calling it is "Debug.function()" when you use "this." making it required to be public...

Although that's all speculation.
Then it would say not accessible rather then not found, like it always does otherwise.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #6  
Old 01-31-2009, 10:57 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 xXziroXx View Post
Then it would say not accessible rather then not found, like it always does otherwise.
Have you tried declaring an event and triggering it to test that theory?
__________________
Reply With Quote
  #7  
Old 01-31-2009, 11:12 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 xXziroXx View Post
What are you not understanding about it?

http://forums.graalonline.com/forums...ad.php?t=74042
Sorry, my fault. I didn't see that you were declaring a function in it.
__________________
Reply With Quote
  #8  
Old 02-01-2009, 12:48 AM
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
Interesting.

This does NOT work:
PHP Code:
//#CLIENTSIDE
function onCreated()
{
  new 
GuiWindowCtrl("Debug") {
    
this.testFunc = function () {
      echo(
"Sup?");
    };
    
    
this.testFunc();
  }

This works...
PHP Code:
//#CLIENTSIDE
function onCreated()
{
  new 
GuiWindowCtrl("Debug") {
    
this.testFunc = public function () {
      echo(
"Sup?");
    };
    
    
this.testFunc();
  }

... but still gives the error GraalScript: Function Debug.testFunc not found in script of Weapon Ziro/Debug

This works...
PHP Code:
//#CLIENTSIDE
function onCreated()
{
  
this.testFunc = public function () {
    echo(
"Sup?");
  };
  
  
this.testFunc();

... but still gives the error GraalScript: Function testFunc not found in script of Weapon Ziro/Debug

This works...
PHP Code:
//#CLIENTSIDE
function onCreated()
{
  
this.testFunc = function () {
    echo(
"Sup?");
  };
  
  
this.testFunc();

... without giving an error.

__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #9  
Old 11-13-2009, 06:50 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
Final bump for today! ^_^
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #10  
Old 11-13-2009, 09:46 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Well, I know that function pointers (funcPointer = this.funcName; ) must be used with public functions.
Perhaps the Gui Control declaration is, in practice, equivalent to this:
PHP Code:
MyControl = new GuiControl();
with (MyControl)
{
  
10;
  
10;

In which case, not being able to access a private member would make sense.
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 10:52 PM.


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