Unique DIALOG id
#1

Hi, is there any way to make function that checks if the dialog id allready exists? If it do that, so it increases id value until it reaches free DIALOG id.
Reply
#2

I also want that
Reply
#3

Why bothering to create some functions for that when you can do it rather simply.


On top you put:
pawn Код:
#define DefaultDialogID 0
Then when you want to show player a dialog:
pawn Код:
ShowPlayerDialog(playerid, DefaultDialogID/* +1 , +2, +3*/, //............ );
And on dialog response:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DefaultDialogID/* +1 , +2, +3*/)
Reply
#4

xRyder's solution of creating a macro to store dialog IDs in is probably the most logical, and it's the method that I use for tracing dialog IDs.

There are other ways, but they're more complicated and redundant.
Reply
#5

I'm interested to know why you would need to go to this much trouble.

Surely if you script your dialogs carefully, the combination of dialog id and playerid should be enough to avoid any input / out put errors.

I would gladly admit that I am wrong if you can give me a simple example.

[edit] for my dialogs I simply use
pawn Код:
#define DIALOG_SOMETHING
#define DIALOG_NEXT_THING
and then use a switch statement under OnDialogResponse case DIALOG_SOMETHING: etc
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)