if (havewater == 0) { global.flag[366] = 1; havewater = 1; } else { global.flag[366] = 0; havewater = 0; }