SUGGESTION: Simulation of built-in functions.

Started by monkey0506, Wed 20/06/2007 20:09:41

Previous topic - Next topic

monkey0506

Although it's not necessarily a high-priority request, would it be possible to implement some method of simulating the built-in functions such as on_mouse_click, on_key_press, on_event, etc.?

I have a certain idea I've been playing with, but something that's been preventing me from realizing the idea is that I have no way of calling these functions...properly. Within a module I can have my own versions of these functions which I could call, but what I need is rather to tell AGS to react as though the function was being called normally, i.e., queuing up the function from every script.

What I'm thinking of isn't high enough priority for me to go into any detail (as with most of my requests :P), however it suffices me to say that for this particular idea simulating these functions is the only possible solution. If it's not possible, or just not a practical request, then so it shall be. 8)

Monsieur OUXX

Quote from: monkey_05_06 on Wed 20/06/2007 20:09:41
I have no way of calling these functions...properly. Within a module I can have my own versions of these functions which I could call, but what I need is rather to tell AGS to react as though the function was being called normally, i.e., queuing up the function from every script.

Maybe i'm missing something, but if your code is well structured, you should only have to move all the code from "on_mouse_click" into your own "onClick" function (located in your module/global code), and then call this function from anywhere. (don't forget to call it also from on_mouse_click  ;D)

And I can't imagine a situation where this function wouldn't be 'reachable' from another piece of code.

Does this help?
 

GarageGothic

I think monkey wants to use it in a module for public distribution, not just his own game. Perhaps the end user doesn't feel like restructuring all his code just to use a single module.

Monsieur OUXX

#3
Quote from: GarageGothic on Thu 21/06/2007 13:22:57
Perhaps the end user doesn't feel like restructuring all his code just to use a single module.

Now that you mention it, this is the primary reason why i decided to code AGSH : i wanted to handle events in a "middle" module, easily inserted in global events (the module's "standard" functions would be called from the global script) , and then all the custom code would be added in another module, especially created for the end user, who would call my module's functions.

I mean that my module would behave as a "middleware" between global script and custom script; so you're right, the question of "code restructuration by the end-user" is a difficult one when handling events; maybe monkey could adopt quite the same approach?
 

SMF spam blocked by CleanTalk