for (k = 0; k < 9; ++k) { if (keyboard.getEvery.key() == 2 + k) { this.theplayer.inventory.currentItem = k; } }