[Include] RDLG - Reliable/Fast Dialog Processor
#1

Description
  • This is a little include that uses OnPlayerDialogResponse( ) to process players Dialogs.
    Each dialog has his own function like the Command Processors( ZCMD, DCMD, YCMD ), such method is much faster than the normal way.
Usage
  • All you need to do is to add a public function using special pre-defined macros, like this:
    pawn Код:
    DIALOG:1( playerid, response, listitem, inputtext[ ] )
    {
        // Your code here, like in the Normal Dialogs with 'if else if else if else'

        return ( 1 ); // My style, it's not obligatory to use returns like that
    }
    or( another macro ):

    pawn Код:
    DLG:1( playerid, response, listitem, inputtext[ ] )
    {
        // Your code here, like in the Normal Dialogs with 'if else if else if else'

        return ( 1 );
    }
Here is all like the normal dialogs, but much faster.
That's all! Very easy, isn't it?

How to make two different dialogs doing the same thing( like in ZCMD )
  • For example, you have the dialog '123' :
    pawn Код:
    DIALOG:123( playerid, response, listitem, inputtext[ ] )
    {
        // Your stuff here...
        return ( 1 );
    }
    And you want to create another one that does the same thing:
    pawn Код:
    DIALOG:456( playerid, response, listitem, inputtext[ ] )
    {
        return dlg_123( playerid, response, listitem, inputtext );
    }
Notes
  • If you want to check whether inputtext string is empty( like in ZCMD with parameters ) you should not do it like:
    pawn Код:
    if( !strlen( inputtext ) )
    {
        // ...
    }
    or:
    pawn Код:
    if( !inputtext[ 0 ] )
    {
        // ...
    }
    Just use isnull( ), because its length will never be NULL:
    pawn Код:
    if( isnull( inputtext ) )
    {
        // ...
    }
    Actually, if you use sscanf[1] you don't need to do this as it has built-in isnull checking.
Speed Test
  • I did the test between mine and FDLG( because I think is the faster ) and here's the Result:
    Код:
    Time taken to show 32766 RDLG dialogs: 3 ms, average call time: 3/32766 ms.
    Time taken to execute 100,000,000 RDLG OnDialogResponse calls: 8805 ms.
    
    Time taken to show 32766 FDLG dialogs: 4 ms, average call time: 4/32766 ms.
    Time taken to execute 100,000,000 FDLG OnDialogResponse calls: 8818 ms.
    Both are almost the same at timing!
Requirements Downloads Special thanks to
  • ****** - For some Tips.
  • stuntman - For some Tips.
  • Gamer_Z - His Speed Test Filterscript.
Reply


Messages In This Thread
RDLG - Reliable/Fast Dialog Processor - by aRoach - 18.02.2012, 12:00
Re: RDLG - Reliable/Fast Dialog Processor - by coole210 - 18.02.2012, 12:10
Re: RDLG - Reliable/Fast Dialog Processor - by aRoach - 18.02.2012, 12:11
Re: RDLG - Reliable/Fast Dialog Processor - by Unknown1234 - 18.02.2012, 12:32
Re: RDLG - Reliable/Fast Dialog Processor - by aRoach - 18.02.2012, 12:37
Re: RDLG - Reliable/Fast Dialog Processor - by aRoach - 18.02.2012, 13:01
Re: RDLG - Reliable/Fast Dialog Processor - by aRoach - 18.02.2012, 13:11
Re: RDLG - Reliable/Fast Dialog Processor - by Edvin - 18.02.2012, 13:12
Re: RDLG - Reliable/Fast Dialog Processor - by PowerMix - 18.02.2012, 13:12
Re: RDLG - Reliable/Fast Dialog Processor - by aRoach - 18.02.2012, 13:40
Re: RDLG - Reliable/Fast Dialog Processor - by aRoach - 18.02.2012, 15:40
Re: RDLG - Reliable/Fast Dialog Processor - by IstuntmanI - 18.02.2012, 16:58
Re: RDLG - Reliable/Fast Dialog Processor - by iZN - 18.02.2012, 18:08
Re: RDLG - Reliable/Fast Dialog Processor - by aRoach - 18.02.2012, 18:17
Re: RDLG - Reliable/Fast Dialog Processor - by Guitar - 18.02.2012, 19:03
Re: RDLG - Reliable/Fast Dialog Processor - by Bect - 19.02.2012, 19:03
Re: RDLG - Reliable/Fast Dialog Processor - by IstuntmanI - 19.02.2012, 19:10
Re: RDLG - Reliable/Fast Dialog Processor - by aRoach - 20.02.2012, 11:20
Re: RDLG - Reliable/Fast Dialog Processor - by aRoach - 20.02.2012, 12:01
Re: RDLG - Reliable/Fast Dialog Processor - by Max_Coldheart - 20.02.2012, 12:16
Re: RDLG - Reliable/Fast Dialog Processor - by aRoach - 20.02.2012, 12:23
Re: RDLG - Reliable/Fast Dialog Processor - by aRoach - 20.02.2012, 12:31
Re: RDLG - Reliable/Fast Dialog Processor - by Bect - 05.03.2012, 14:39
Re: RDLG - Reliable/Fast Dialog Processor - by Bect - 05.03.2012, 14:49
Re: RDLG - Reliable/Fast Dialog Processor - by Bect - 06.03.2012, 11:19
Re: RDLG - Reliable/Fast Dialog Processor - by Gamer_Z - 06.03.2012, 11:25
Re: RDLG - Reliable/Fast Dialog Processor - by Bect - 06.03.2012, 13:33
Re: RDLG - Reliable/Fast Dialog Processor - by Gamer_Z - 06.03.2012, 14:17

Forum Jump:


Users browsing this thread: 6 Guest(s)