07.03.2016, 00:14
as a modular programmer, I use hook erverywhere, but something still confused me. speed.
before use a hook, my callback just like this:
if player response a dialog, the callback match one condition and return.
now, we use hook and however it will run every hook-callback.
if I hooked 100 times of this callback, it will just loop 100 times.
so, I cant think a method to resolve this problem.
how you guys code with hook?
before use a hook, my callback just like this:
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch(dialogid) { case DIALOG_ID_A : return RE_DIALOG_A(playerid, response, listitem, inputtext); case DIALOG_ID_B : return RE_DIALOG_B(playerid, response, listitem, inputtext); case DIALOG_ID_C : return RE_DIALOG_C(playerid, response, listitem, inputtext); case DIALOG_ID_D : return RE_DIALOG_D(playerid, response, listitem, inputtext); case DIALOG_ID_E : return RE_DIALOG_E(playerid, response, listitem, inputtext); case DIALOG_ID_F : return RE_DIALOG_F(playerid, response, listitem, inputtext); } return 1; }
now, we use hook and however it will run every hook-callback.
if I hooked 100 times of this callback, it will just loop 100 times.
so, I cant think a method to resolve this problem.
how you guys code with hook?