I used to work on macro scripts for windows and this was doable:
VAR=0
Label>LOOP
VAR=VAR+1
ANOTHERVAR%VAR%=8 (all variables up to 30 will be set to 8)
if>VAR>=30 {Goto>BREAK}else{Goto>LOOP}
Label>BREAK
EXIT
The code above would effectively set "ANOTHERVAR1" up to "ANOTHERVAR30" to the value 8.
Now my question is, how can I achieve the same results on objective-c? I've got many variables to set. Right now on XCode i need to set 30 variables. I've always set them all one by one but it's taking up space and my source code is over 10k lines now.
This is what i've got :
if (Dedicatedkind==@"Cat"){
_oAttack7.alpha=0;
_oAttack7.enabled=NO;
}
This basically disables non-required buttons, in this case Dedicatedkind always equals Cat. I would need to disable buttons 7 to 30. But I've got over 80 different Dedicatedkind. I hope you understand my problem. I want to be able to disable any number of buttons with less lines of codes than it takes if I was to set them all manually.
Like this :
if (Dedicatedkind==@"Cat"){
_oAttack7.alpha=0;
_oAttack7.enabled=NO;
_oAttack8.alpha=0;
_oAttack8.enabled=NO;
_oAttack9.alpha=0;
_oAttack9.enabled=NO;
And so on, until I reach _oAttack30
}
If it matters at all, this is for the iphone and i'm working with storyboard.
Extra info:
Setting enabled:NO is simply a safety because if condition is met, those buttons turns alpha:0.3 which re-enables them. Unfortunately my code is too large to post every roots and conditions. Those buttons are attacks learned by the cat, there's 30 attacks maximum but the cat only learns 6 of them. Those 24 buttons must be completely invisible while the 6 attacks, even if not learned yet, must be at least partially visible. When learning those attacks, the appropriate buttons turns completely visible. That's for the cat. In this game, the cat is one of the three basic animals you get to have when starting a new game, therefore has limitations. Bigger, rarer animals may learn more than 6 attacks.
Fortunately, I've already done all of that except the 24 attacks/Buttons that must be disabled, which led me to this question!