11.07.2016, 22:22
I'll give you an example to get the idea.
Normally if you were to show the teleport locations of the category 2 you would loop through all the teleports, check if the category is equal to 2 and "join" the name of the location to the string to show the dialog.
Player chooses the listitem 3 from the list so using Teleport[listitem] would be wrong because the categories are mixed up.
On dialog response now, you have the listitem so you loop through the teleports again and if the category is 2, we increase the variable until its value is equal to the listitem so you get the index (3rd item of category 2) to use in Teleport array.
Normally if you were to show the teleport locations of the category 2 you would loop through all the teleports, check if the category is equal to 2 and "join" the name of the location to the string to show the dialog.
Player chooses the listitem 3 from the list so using Teleport[listitem] would be wrong because the categories are mixed up.
On dialog response now, you have the listitem so you loop through the teleports again and if the category is 2, we increase the variable until its value is equal to the listitem so you get the index (3rd item of category 2) to use in Teleport array.