Ogedei
February 7th, 2018, 16:45
I have a set of 6 buttons, representing attributes. I need to be able to select 2 of them at any given time.
Currently my set up has 3 values that are stored, Attribute1, Attribute 2 and Pointer.
Pointer starts at 1, clicking the button moves it to 2. Clicking it again moves it back to 1.
If the pointer is 1 then the attribute that is clicked on is stored in position 1
If the pointer is 2 then the attribute that is clicked on is stored in position 2
So if I have selected the second attribute and have decided I want to reselect them and click on a new attribute the pointer is set to 1 and the new attribute is placed in position 1.
The issue is clicking on the button moves the button from state 0 to state 1(which is what I want). But clicking on a different selection does not move the original button back to state 0.
My current plan is to add DB handlers to the buttons pointing at the two attributes. if the attributes change each button would query the two attributes. If the button name was no longer stored in either attribute it would set the button state to 0.
My question is, is that the best way to handle it? Is there a way for a button to change the state of another button from within LUA. ie if know the buttons name can I call it directly and set it's state to 0 somehow?
Currently my set up has 3 values that are stored, Attribute1, Attribute 2 and Pointer.
Pointer starts at 1, clicking the button moves it to 2. Clicking it again moves it back to 1.
If the pointer is 1 then the attribute that is clicked on is stored in position 1
If the pointer is 2 then the attribute that is clicked on is stored in position 2
So if I have selected the second attribute and have decided I want to reselect them and click on a new attribute the pointer is set to 1 and the new attribute is placed in position 1.
The issue is clicking on the button moves the button from state 0 to state 1(which is what I want). But clicking on a different selection does not move the original button back to state 0.
My current plan is to add DB handlers to the buttons pointing at the two attributes. if the attributes change each button would query the two attributes. If the button name was no longer stored in either attribute it would set the button state to 0.
My question is, is that the best way to handle it? Is there a way for a button to change the state of another button from within LUA. ie if know the buttons name can I call it directly and set it's state to 0 somehow?