I've got buttons that are tied to characters that are being called by their ID numbers. Is there a way I can single them out other than by their name?
A hypothetical example:
if (gvcommand=="Operation One"){
character[selection].Walk(582, 176, eNoBlock, eWalkableAreas);
btnCrew1.NormalGraphic=106;
}
I want "btnCrew1" to instead refer to the button that has the ID number of "selection". Is there a command to do this?
gui[].Controls[] is basically what you're looking for.
if (selection < gSpecificGUI.ControlCount)
{
Button *selectionButton = gSpecificGUI.Controls[selection].AsButton;
if (selectionButton != null) selectionButton.NormalGraphic = 106;
}
Alternately:
GUI *selectionGUI = gui[SOME_GUI_ID_OR_USER_SELECTION];
if (selection < selectionGUI.ControlCount)
{
Button *selectionButton = selectionGUI.Controls[selection].AsButton;
if (selectionButton != null) selectionButton.NormalGraphic = 106;
}
Perfect. Many thanks!