PDA

View Full Version : Hooking scripts prior to default systems.


12171217
09-30-2010, 04:12 AM
Dear Stefan,

Allow certain weapon scripts to be executed before default systems are ran. Can be done like:

hookEvent(HOOK_PREMOVEMENT, "lolTest");

then lolTest() would be executed before the player movement logic is done each frame.

With love,
Downsider

MrOmega
09-30-2010, 05:11 AM
I support this, please Stefan

Deas_Voice
09-30-2010, 11:31 AM
state a example of usage please, i don't get what "hooking" into default systems would be good for (rather then making your own)

fowlplay4
09-30-2010, 04:18 PM
then stuff like this could be easily done.


//#CLIENTSIDE
function onCreated() {
// Hook Level-link Function
hookEvent(HOOK_CHANGELEVEL, "onChangeLevel");
}

function onChangeLevel(lvl, x, y) {
stupidFadeEffect();
waitfor(this, "Faded", 1.5);
warpPlayer(lvl, x, y);
}

cbk1994
10-01-2010, 12:48 AM
I'd rather seen it done like in JavaScript


//#CLIENTSIDE
function onCreated() {
universe.onLevelChange = function (levelName, x, y) {
stupidFadeEffect();
// etc
return true; // false would cancel the default action
};
}

12171217
10-01-2010, 12:52 AM
I'd rather seen it done like in JavaScript


//#CLIENTSIDE
function onCreated() {
universe.onLevelChange = function (levelName, x, y) {
stupidFadeEffect();
// etc
return true; // false would cancel the default action
};
}


This is pretty much it, canceling the default action is also important.