Im trying to make meditate. It compiles well. But when i begin to meditate, then i remain in POS_MEDITATE.
It should stop meditating and put me back in resting or atleast as standing, if i move.
Code:
void check_meditate(void)
{
  struct char_data *i, *next_char;
  int skill_level = 0;
  int min = 10;
  int max = 10;
  /* characters */
  for (i = character_list; i; i = next_char) {
    next_char = i->next;
    skill_level = GET_SKILL(i, SKILL_MEDITATE);
    max = min + 20 * skill_level / 100;
  
    if (GET_POS(i) == POS_MEDITATE) {
      send_to_char(i, "You meditate peacefully.\r\n");
      GET_MANA(i) += rand_number(min, max);
      act("$n meditates peacefully.", FALSE, i, 0, 0, TO_ROOM);
    }
    if (GET_POS(i) == POS_MEDITATE && GET_MANA(i) >= GET_MAX_MANA(i)) {
      send_to_char(i, "You stop meditating for you have reached your max.\r\n");
      GET_POS(i) = POS_SITTING;
      act("$n stops meditating.", FALSE, i, 0, 0, TO_ROOM);
    }
  }
}
ACMD(do_meditate)
{
  if (IS_NPC(ch) || !GET_SKILL(ch, SKILL_MEDITATE)) {
    send_to_char(ch, "You have no idea how to do that.\r\n");
    return;
  }
  #define POS_DEAD_MSG        "You're dead, how much meditating do you need?\r\n"
  #define POS_MORTALLYW_MSG   "You're nearly dead, you need more than meditation.\r\n"
  #define POS_SLEEPING_MSG    "You can't meditate while you sleep.\r\n"
  #define POS_RESTING_MSG     "You can't meditate while resting.\r\n"
  #define POS_STANDING_MSG    "You must be sitting to meditate.\r\n"
  #define POS_FIGHTING_MSG    "Don't you have other things to worry about?\r\n"
  #define POS_MEDITATE_MSG    "You are already meditating.\r\n"
  #define POS_FLYING_MSG      "Shouldn't you concentrate on flying?\r\n"
  switch(GET_POS(ch)) {
    case POS_DEAD:
      send_to_char(ch, POS_DEAD_MSG); return; break;
    case POS_MORTALLYW:
    case POS_INCAP:
    case POS_STUNNED:
      send_to_char(ch, POS_MORTALLYW_MSG); return; break;
    case POS_SLEEPING:
      send_to_char(ch, POS_SLEEPING_MSG); return; break;
    case POS_RESTING:
      send_to_char(ch, POS_RESTING_MSG); return; break;
    case POS_STANDING:
      send_to_char(ch, POS_STANDING_MSG); return; break;
    case POS_MEDITATE:
      send_to_char(ch, POS_MEDITATE_MSG); return; break;
    case POS_FLYING:
      send_to_char(ch, POS_FLYING_MSG); return; break;
    case POS_SITTING:
      if(GET_MANA(ch) < GET_MAX_MANA(ch)) {
        send_to_char(ch, "You begin meditating.\r\n");
        act("$n begins meditating..", FALSE, ch, 0, 0, TO_ROOM);
        GET_POS(ch) = POS_MEDITATE;
      } else {
        send_to_char(ch, "You have no need to meditate.\r\n");
      }
      return; 
      break;
    default:
      send_to_char(ch, "You must be sitting to begin meditating.");
  }
}