Dialogs unique identifiers (no longer maintained)
#21

Quote:
Originally Posted by ZeeX
pawn Code:
stock CreatePlayerDialog(playerid, style, caption[], info[], button1[], button2[])
{
    new
      dialogid;
    dialogid = getproperty(0, "dialogs");
    ShowPlayerDialog(playerid, dialogid, style, caption, info, button1, button2);
    setproperty(0, "dialogs", dialogid+1);
    return dialogid;
}
This function allows you create dialogs without worrying about their IDs as they are increased automatically, it is like when you create a textdraw you remember its ID to use it further
pawn Code:
new dialog = CreatePlayerDialog(playerid, 0, "caption", "info", "button1", "button2")

Nice function and method dude.

Edit:

List updated also.
Reply
#22

Can you add redirect links to the scripts? After that it would be nice if it was sticked
Reply
#23

Quote:
Originally Posted by Dark_Kostas
Can you add redirect links to the scripts? After that it would be nice if it was sticked
Updated.
Reply
#24

The IDs on my script are customizable as my script doesn't rely on the DialogID, it relies on the inputs. In my next release I'll figure a way to prevent it from causing issues with other scripts.
Reply
#25

The best thing is to define that dialog IDs all in one script
Reply
#26

I have changed id to: 5009
Reply
#27

Quote:
Originally Posted by Joe Staff
The IDs on my script are customizable as my script doesn't rely on the DialogID, it relies on the inputs. In my next release I'll figure a way to prevent it from causing issues with other scripts.
Ok, cheers.

Quote:
Originally Posted by Kurence
The best thing is to define that dialog IDs all in one script
I don't think this would be good, everyone would have to redownload the include everytime it got updated and that could become annoying I reckon.

Quote:
Originally Posted by [LRP
Sayaron ]
I have changed id to: 5009
Thankyou, I've updated the list.
Reply
#28

This should been stickied as its very useful
Reply
#29

Quote:
Originally Posted by Seif_ [adream-rp.com
]
You should all just use ZeeX's function.
And whats that??
Reply
#30

Quote:
Originally Posted by Seif_ [adream-rp.com
]
You should all just use ZeeX's function.
Well I like the current method, using the method Zeex posted could have mixed results.

In a single script, no other scripts loaded for this example.

pawn Code:
//in connect
  gLogDialog = Create...
  printf( ...gDialog ); //this will print 0
After ten people have connected:

pawn Code:
printf( ...gDialog ); //this will print 9
It could end up messing with our heads when debugging it but using the macro method my dialog will always be ID 3434 so yes it's good but in other ways it can cause issues.
Reply
#31

I preffer the old. Dont wanna waste any time learning another method when the old works fine
Reply
#32

Quote:
Originally Posted by [LRP
Sayaron ]
I preffer the old. Dont wanna waste any time learning another method when the old works fine
What are you, Amish?

I think the new method will work just fine, it's not a huge change, just instead of putting in permanent numbers, it's a variable, not much sacrifice.

The largest number is 0x7FFFFFFF, and if you ever reach that many dialogs created then you've got some crazy sh*t going on.
Reply
#33

Still I preffer the old way :P
btw, your hobby page is cool
Reply
#34

Quote:
Originally Posted by Joe Staff
Quote:
Originally Posted by [LRP
Sayaron ]
I preffer the old. Dont wanna waste any time learning another method when the old works fine
What are you, Amish?

I think the new method will work just fine, it's not a huge change, just instead of putting in permanent numbers, it's a variable, not much sacrifice.

The largest number is 0x7FFFFFFF, and if you ever reach that many dialogs created then you've got some crazy sh*t going on.
Yes but the variables value will increase by one for each dialog which is shown in/from any script. Tracking my vehicle one would be a bugger as it has fifteen dialogs so just off one viewing it could end up changing the value from 0 to 14, the next person views it it's now at 29, 44, and so on, just going back to the main menu and selecting the one you were already viewing will increase it a further two.

Honestly I could see it becomming a nightmare to try and debug it where as:

pawn Код:
printf( "%d", DIALOG_ID ); //this is a define #define DIALOG_ID 9999
Will always return the same id (9999).

@Zeex:

I don't want you to think I'm bashing your method, like I said it's a very nice idea but I'm just thinking outloud about ways it could end up making it harder to use in some situations.
Reply
#35

I see what you mean, perhaps it's better to do something like

pawn Код:
#define DIALOG_TEST 0
#define DIALOG_LOGIN 1
new PlayerDialog[MAX_PLAYERS];
public OnPlayerCommandText(playerid,cmdtext[])
{
  if(!strcmp(cmdtext[1],"OpenTest",true))
  {
    PlayerDialog[playerid]=DIALOG_TEST;
    ShowPlayerDialog(playerid,0,DIALOG_TYPE_MSGBOX,"Test","This is a test","Ok","Cancel");
    return 1;
  }
  if(!strcmp(cmdtext[1],"Login",true))
  {
    PlayerDialog[playerid]=DIALOG_LOGIN;
    ShowPlayerDialog(playerid,0,DIALOG_TYPE_INPUT,"Login","Type in your login name","Ok","Cancel");
    return 1;
  }
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  switch(PlayerDialog[playerid])
  {
    case DIALOG_TEST:
    {
      //Code
    }
    case DIALOG_LOGIN:
    {
      //Code
    }
  }
}
Reply
#36

Quote:
Originally Posted by Seif_ [adream-rp.com
]
In that case, we'd have to use CallRemoteFunction and use a function to get the available dialogid
You talking about my method?
My method doesn't use Dialog ID. The only issue with this is if dialog boxes are brought up in the same way i.e. Clicking on a player's name, in which case the hoster needs to settle down on the dialog boxes.
Reply
#37

Yeah that's more like it Joe, seems a lot simpler as we could debug the players array then instead.

I'll still stick with the define method though as I'm happy with it.
Reply
#38

yea i like the method we are using now
Reply
#39

Quote:
Originally Posted by Seif_ [adream-rp.com
]
Quote:
Originally Posted by Joe Staff
Quote:
Originally Posted by Seif_ [adream-rp.com
]
In that case, we'd have to use CallRemoteFunction and use a function to get the available dialogid
You talking about my method?
My method doesn't use Dialog ID. The only issue with this is if dialog boxes are brought up in the same way i.e. Clicking on a player's name, in which case the hoster needs to settle down on the dialog boxes.
Hm, how's your method "fixing" the issue if you have a FS with dialogs and a GM with dialogs?
Hm, I do see a problem with running a Dialog box with my method, then mid-use of it, run another Dialog Box with a FS.
Whatever, people shouldn't be using other people's dialog boxes anyway, they should just make their own cause they're so easy.
Reply
#40

I think the orginal method is not very scriptable.
Just think, we need to tell everyone which dialogid are used in my scripts when releasing it,and it will be a headache to check whether mix up with other.

I think/hope kye will release an update which makes dialog more scriptable.Like textdraw, vehicle.
Код:
new 
  adminvec,
  admindialog;
public OnGameModeInit(){
  adminvec = CreateVehicle();
  admindialog = CreateDialog(.type=0,.caption="admin command",.info=""hi all",.button1="ok",.button2="cancel");
  return true;
}
public OnPlayerEnterVehicle(playerid,vehicleid){
  if(vehicleid==adminvec){
    //bla...
  }
  return true;
}
public OnPlayerSpawn(playerid){
  ShowPlayerDialog(playerid,admindialog);
  return true;
}
public OnPlayerResponseDialog(bla){
  if(dialogid == admindialog){
    //bla...
  }
  return true;
}
Also, we can script for that, like ZeeX did.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)