[Include] B-Dial - Fast Dialog Response Processor
#1

What does this include actually do?
It does actually call a function with a higher performance instead of using any checks inside OnDialogResponse.

How to use this include?
Simple we can use

pawn Код:
DIAL:0(playerid, bool:response, listitem, inputtext[])
or
pawn Код:
DIALOG:0(playerid, bool:response, listitem, inputtext[])
or (not recommend)
pawn Код:
forward dial_0(playerid, bool:response, listitem, inputtext[]);
public dial_0(playerid, bool:response, listitem, inputtext[])
//...

Код:
DIAL:0(playerid, bool:response, listitem, inputtext[])
Callback start:
Код:
DIAL:
Dialog Response ID:
Код:
0
Player ID
Код:
playerid
Response statement
Код:
bool:response
List item ID:
Код:
listitem
Inputtext string:
Код:
inputtext[]
Example:
pawn Код:
DIAL:5(playerid, bool:response, listitem, inputtext[])
{
    if(response) SendClientMessage(playerid, 0x00FF00FF, "You have accepted the rules.");
    else SendClientMessage(playerid, 0xFF0000FF, "You have declined the rules.");
    return 1;
}
Every function must return a value. (Returning 1 or higher will stop calling OnDialogResponse otherwise returning 0 will call OnDialogResponse.)

Of course you can use several dialog responses to run another dialog response ID callbacks
Example:

pawn Код:
DIAL:5(playerid, bool:response, listitem, inputtext[])
{
    if(response) SendClientMessage(playerid, 0x00FF00FF, "You have accepted the rules.");
    else SendClientMessage(playerid, 0xFF0000FF, "You have declined the rules.");
    return 1;
}
DIAL:1(playerid, bool:response, listitem, inputtext[]) return dial_5(playerid, response, listitem, inputtext);
DIAL:2(playerid, bool:response, listitem, inputtext[]) return dial_5(playerid, response, listitem, inputtext);
//etc..
Benchmark Scripts/Results:
Every single callback/check will be called. Loops 10000 times through:
Edit: Because I was dumb enough to call the dialog response ID correctly, I have to retest the speed + reupload the scripts
  • bdial.inc: 123ms - 125ms (not bad for such loop)
  • fdialog.inc: 123ms- 124ms (kinda fast as my include)
  • gDialog.inc: 175ms - 178ms (abit slower than bdial.inc and fdialog.inc, but still fast)
  • if else methode: 1736ms - 1759ms (SLOW!)
  • switch methode: 125ms - 127ms (This impressed me because the switch methode is also very fast. [But some milliseconds slower than bdial.inc and fdialog.inc. :P ])
All benchmark test scripts: http://solidfiles.com/d/565d/

Credits:
  • Myself..
  • Idea from ZCMD include which also calls a callback instead of using checks in its own callback
  • Hooking methode by ******
  • SA:MP Development Team
Where I can download this file?
Download bdial.inc from Solidfiles
Download bdial.inc from Pastebin

Regards: BigETI
Reply


Messages In This Thread
B-Dial - Fast Dialog Response Processor - by BigETI - 04.11.2011, 01:07
Re: B-Dial - Fast Dialog Response Processor - by Norn - 04.11.2011, 02:24
Re: B-Dial - Fast Dialog Response Processor - by System64 - 04.11.2011, 07:40
Re: B-Dial - Fast Dialog Response Processor - by EvgeN 1137 - 04.11.2011, 07:50
Re: B-Dial - Fast Dialog Response Processor - by vampirmd - 04.11.2011, 08:19
AW: B-Dial - Fast Dialog Response Processor - by BigETI - 04.11.2011, 08:57
Re: B-Dial - Fast Dialog Response Processor - by juraska - 04.11.2011, 09:35
Re: B-Dial - Fast Dialog Response Processor - by [LaTinb0y]...$ag3R - 04.11.2011, 09:35
Re: B-Dial - Fast Dialog Response Processor - by wups - 04.11.2011, 10:32
AW: Re: B-Dial - Fast Dialog Response Processor - by BigETI - 04.11.2011, 10:37
Re: AW: Re: B-Dial - Fast Dialog Response Processor - by wups - 04.11.2011, 10:41
B-Dial - Fast Dialog Response Processor - by BigETI - 04.11.2011, 10:56
Re: B-Dial - Fast Dialog Response Processor - by wups - 04.11.2011, 10:59
AW: B-Dial - Fast Dialog Response Processor - by BigETI - 04.11.2011, 11:12
Re: B-Dial - Fast Dialog Response Processor - by Gamer_Z - 04.11.2011, 11:35
Re: B-Dial - Fast Dialog Response Processor - by BaubaS - 04.11.2011, 11:42
Re: B-Dial - Fast Dialog Response Processor - by TheArcher - 04.11.2011, 12:53
Re: B-Dial - Fast Dialog Response Processor - by Jochemd - 04.11.2011, 14:26
AW: Re: B-Dial - Fast Dialog Response Processor - by BigETI - 04.11.2011, 14:59
Re: B-Dial - Fast Dialog Response Processor - by iGear Track - 04.11.2011, 15:02
AW: B-Dial - Fast Dialog Response Processor - by BigETI - 04.11.2011, 16:38
Re: B-Dial - Fast Dialog Response Processor - by wups - 04.11.2011, 17:37
Re: B-Dial - Fast Dialog Response Processor - by Gamer_Z - 05.11.2011, 13:01
B-Dial - Fast Dialog Response Processor - by BigETI - 05.11.2011, 16:24
Re: B-Dial - Fast Dialog Response Processor - by Lookin - 05.11.2011, 17:27
Re: B-Dial - Fast Dialog Response Processor - by Gamer_Z - 05.11.2011, 17:28
Re: B-Dial - Fast Dialog Response Processor - by Anthony © - 15.10.2012, 20:56
Re: B-Dial - Fast Dialog Response Processor - by jpeg - 15.10.2012, 21:38

Forum Jump:


Users browsing this thread: 1 Guest(s)