Graal Forums  

Go Back   Graal Forums > Development Forums > Future Improvements
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-26-2008, 08:33 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
onCall Event

I was thinking that an object.onCall() event would allow you to define what happens when you call object() like a function. Obviously this would be a blocking event. I haven't yet decided what I could use it for but I thought it might be nice.

Edit:

And some other things I mentioned before:

A throwevent(objectname, eventname, params...) that throws an event that can be caught with catchevent() like it does with Gui Controls.

onGetVariable() and onSetVariable() events that would allow you to define function behavior for certain variables. Obviously there would need to be some way to specify which variables are included in this.
__________________
Reply With Quote
  #2  
Old 08-26-2008, 08:36 PM
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 Inverness View Post
I haven't yet decided what I could use it for
Not practical enough!
Reply With Quote
  #3  
Old 08-26-2008, 08:39 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 Skyld View Post
Not practical enough!
Perhaps you should ask people what they use __call__() in Python for.
__________________
Reply With Quote
  #4  
Old 08-26-2008, 08:42 PM
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 Inverness View Post
Perhaps you should ask people what they use __call__() in Python for.
Quote:
Called when the instance is ``called'' as a function; if this method is defined, x(arg1, arg2, ...) is a shorthand for x.__call__(arg1, arg2, ...).
Strikes me that we can probably already achieve something similar with careful use of function prototyping.
Reply With Quote
  #5  
Old 08-26-2008, 08:46 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 Skyld View Post
Strikes me that we can probably already achieve something similar with careful use of function prototyping.
Sounds complicated and more difficult than doing x.functionname();

I also thought of something else I wanted to add but reading your post made me forget it.
__________________
Reply With Quote
  #6  
Old 08-26-2008, 08:48 PM
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 Inverness View Post
I also thought of something else I wanted to add but reading your post made me forget it.
Tehe. I do quite like your idea of something along the lines of throwing catchable events, though (or patching trigger() to do it properly - last I checked it didn't).
Reply With Quote
  #7  
Old 08-26-2008, 11:23 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
The events for trigger() and normal GUI/player/catchevents are separate for security reasons. In the next Graal version it's however possible to trigger() events to yourself which act like normal GUI events. That is mainly for scripting new types of GUI controls, e.g. you can trigger("onSelect").
Reply With Quote
  #8  
Old 08-26-2008, 11:28 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
The events for trigger() and normal GUI/player/catchevents are separate for security reasons. In the next Graal version it's however possible to trigger() events to yourself which act like normal GUI events. That is mainly for scripting new types of GUI controls, e.g. you can trigger("onSelect").
If triggering an event on yourself makes it so an outside object can catch the event then that is exactly what I want.

And I hope this works serverside too?
__________________
Reply With Quote
  #9  
Old 08-27-2008, 02:42 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
Server-side it's already working for a few months.
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 09:52 PM.


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