||Usage: ||ifgosub ( reference {operator} value ) label || ||<#F2F2F2 style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em; ">Example: ||ifgosub ( m_city.cityManager.resource.stone.amount > 250000 ) CheckATT || Like it's counterpart [[Gosub]], IfGosub allows you to jump to a label subroutine elsewhere in the script, perform the actions there, and then return to where it left off in the current script. The difference is that this one allows you to check a conditional statement before deciding whether to jump to the subroutine or move on to the next line. Using [[References]], this script command allows you powerful access to manage your account, cities, heroes, and armies with precision. In the following example, the bot will first check if your stone in the city is over 250k, and if so jump to label CheckATT. In label CheckATT the bot will further check if you have over 250k wood in the city, and if so jump to label UpATT. In label UpATT, the bot will build 250 archer towers and return to the label that called it (CheckATT). Once back in CheckATT it has nothing else to check or perform, so it returns back to the original start of the script and moves to the next line. This next line is going to check if your city has over 150k iron, and if so jump to label !CheckTrain. Once in !CheckTrain it will check if your city has over 150k wood, and if so jump to label !TrainTroops. In label !TrainTroops the bot will queue 250 archers with hero Bubba, 4 times, then return to label !CheckTrain. With nothing more to do in !CheckTrain, it will return back to your original script and move to the next line, which will tell the bot to sleep randomly from 0 to 3000 seconds and then loop back to line 1. If at any point in the script or any subroutine, one of the checks had failed then the bot would not jump to that subroutine, and would instead move to the next line. For example, if at the very first line you did not have 250k+ stone, the bot would have not jumped to label CheckATT but would instead have moved to line 2 and checked for 150k+ iron. If that failed also, then the bot would have slept until it was time to check again for resources. . {{{ ifgosub ( m_city.cityManager.resource.stone.amount > 250000 ) CheckATT ifgosub ( m_city.cityManager.resource.iron.amount > 150000 ) CheckTrain sleep rnd:3000 loop 0 // label CheckTrain ifgosub ( m_city.cityManager.resource.wood.amount > 150000 ) TrainTroops return // label CheckATT ifgosub ( m_city.cityManager.resource.wood.amount > 250000 ) UpATT return // label TrainTroops train arch:250 Bubba repeat 4 return // label UpATT walldefense archertowers 250 return }}} As with [[Gosub]], do not forget the [[Return]] at the end of each subroutine. ---- ---- ScriptControlStructures ScriptDeprecated