hey,

personally i catch all key presses on 1 function then determine what to do with it from the game state, then the key,

Code:
#define game_state_loading 0
#define game_state_playing 1
int int_game_state = 0;

function fnc_keypress(key_scancode){
   switch(int_game_state){
      case game_state_playing:

         switch(key_scancode){
            case 2: //key 1
//...

void main(){
   on_anykey = fnc_keypress;
}

so as you're using keycode 2 to 12 you could just put

Code:
//...
         case 2: case 3: case 4: //etc...
         case 11: case 12:
            if(key_ctrl){
               fnc_set_group(key_scancode - 1);
            }else{
               fnc_select_group(key_scancode - 1);
            }
            return;

so when you're assigning the group or getting the group number you can use (obviously above the previous code)
Code:
function fnc_select_group(int grp_number){
   while(you){ //etc
      if(your.group = grp_number){ your.selected = true; }

}


hope this helps, (i've just written this so beware of elusive / stray brackets :P )