Dialog list - Identify players selection?
#1

Hey guys.

I'm gonna make an inventory for the player, using a dialog list.

I havn't done it yet, and I'm going to bed in few minutes, but I'm not quite sure how to do this, so I figured I'd ask now and recieve some input here for tomorrow.

When the player types a command, such as /inventory, a list will appear with all his belongings. However, they will only appear if he has any of them - ie., it will not show on the list if you have 0.

So something like:

Code:
Bread - 3
Painkillers - 1
Bottle - 2
So, when the list is made and the player selects one - how do I detect which one he selected?

Here's an example - We have 5 items. A, B, C, D and E.

Player1 has A, B, C, D and E in his inventory:
Code:
A
B
C
D
E
Player2 has only C and E in his inventory.
Code:
C
E
Now, OnDialogResponse - how do I tell which one the player chose? Normally, you'd go for "listitem" - but since that's the number from the top, that doesn't help me. "listitem == 0" would be A for Player1, but C for Player2.

Do you see what I mean? How do I detect which item was selected?

Also, I assume the list would be made with a loop that edits a string, something like:
-Loop through all the players items
-Every time the player has an item, edit a string with "%s\n%s" where the first string is the previous string(the string itself) and the second string is whatever item, for example "Bottle - 1".
-Show the list with that string as the list options.

Correct me if the above method is wrong please.

Thanks for any help, if anyone even understand what I meant.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)