Hi, I need some help creating part of a JScript, it's a bot for a MUD i play called Nodeka. Well, the client i'm programming it for has a handler:
jmc.registerhandler("Input","function()");
Then a variable jmc.event which contains the input is passed to the function()
Well, i need a way to branch out that handler to other functions dynamically for when loading scripts. Like if i load another JScript, have the function that is the input function be stored to a variable, then the function() call on that function/variable to run the code that the script loaded.
registerhandler can only handle 1 function, which just isnt acceptable =) i need to make it expandable.
I was thinking something on the line of the new script
function inputfunction( event ) {
blah blah blah
}
handler.push( "inputfunction" );
then the actuall script will run through the handler array running all the functions in it.
Could use any assistance, here's an example of what i'm talking about.
core:
var handler = new Array();
function input() {
for (var x = 0; x < handler.length; x++) {
handler[ x ]( jmc.event );
}
}
jmc.registerhandler("Input","input()");
file to load:
function scriptinput( event ) {
blah blah blah...
}
handler.push( "scriptinput" );
Thanks.
Willy Duitt
02-06-2005, 04:57 PM
I've just pulled this up from back on page three... I would imagine that your question has remained unresponded too because there is too much blah blah blah and not enough specifics...
.....Willy