Kraeten Posted November 25, 2023 Share Posted November 25, 2023 (edited) Hello everyone. I have a small question regarding menu scripts. I'm utilizing a menu to enable and disable various things in ones and twos, but it would be quicker if I could consolidate some things. Is there a way to activate an ai button three times to essentially do the following listed below? Basically I'd like a menu button to alternate between enabling and disabling two different items, with the third button press disabling everything at once to essentially reset the button to its initial state. Thank you in advance for reading and any guidance you might have. ElseIf aiButton == 2 If (Marker02.IsDisabled()) Marker02.enable() Marker03.disable() Else Marker02.disable() Marker02.enable() Else Marker02.disable() Marker03.disable() EndIf Edited November 25, 2023 by Kraeten Link to comment Share on other sites More sharing options...
IsharaMeradin Posted November 25, 2023 Share Posted November 25, 2023 If you use appropriate conditions along with 'ElseIf' instead of 'Else', you should be able to get it to do what you want. ElseIf aiButton == 2 If (Marker02.IsDisabled()) Marker02.enable() Marker03.disable() ElseIf (Marker03.IsDisabled()) Marker02.disable() Marker03.enable() Else Marker02.disable() Marker03.disable() EndIf Link to comment Share on other sites More sharing options...
Kraeten Posted November 25, 2023 Author Share Posted November 25, 2023 That definitely makes the toggle between the two options work, but for some reason the third disabling command isn't working. The script compiled perfectly though with no errors. Might just have to mess with it a little bit more. Thank you so much for sharing your expertise! Link to comment Share on other sites More sharing options...
IsharaMeradin Posted November 25, 2023 Share Posted November 25, 2023 Might need to approach it differently. Especially if Marker02 and Marker03 will never both be enabled at the same time. ;declare outside of the event with properties and other local variables Int aiButtonOption = 0 ;inside the event ElseIf aiButton == 2 If aiButtonOption == 0 aiButtonOption = 1 Marker02.enable() Marker03.disable() ElseIf aiButtonOption == 1 aiButtonOption = 2 Marker02.disable() Marker03.enable() ElseIf aiButtonOption == 2 aiButtonOption = 0 Marker02.disable() Marker03.disable() EndIf Link to comment Share on other sites More sharing options...
Recommended Posts