Footguy

From: Patrick Dughi (dughi@imaxx.net)
Date: 08/26/99


        This is a quick fun snippet, the sort that keeps me eternally
occupied inbetween more serious ventures. Based on a player flag, it
causes them to, well, see the footguy.  If you don't know what the
footguy is, search for him on the net, or goto www.waste.org (i think).
Anyway, it goes something like this;

define 3 globals:

int footguyx;
int footguyy;
int footguytap;

here's the functions:

void new_footguy(void) {
        /* these numbers assume a 80x24 display */
  footguyx=rand()%70+3;
  footguyy=rand()%20;
  footguytap=1;
}

void ansi_goto(int x, int y,struct char_data *ch)
{
  char buf[48];
  sprintf(buf,"\x1b[%d;%dH",x,y);
  send_to_char(buf,ch);
}

void ansi_cls(struct char_data *ch)
{
  send_to_char("\x1b[2J",ch);
}

void footguy(struct char_data *ch)
{
  ansi_goto(footguyx+1,footguyy+2,ch);
  send_to_char("oo\r\n",ch);
  ansi_goto(footguyx+0,gootguyy+3,ch);
  send_to_char("<|>\r\n",ch);
  ansi_goto(footguyx+0,footguy+4,ch);
  send_to_char("_|_\r\n",ch);
}

void footguy_tap(struct char_data *ch)
{
  ansi_goto(footguyx+2,footguyy+4,ch);
  send_to_char(tap?"/\r\n":"_\r\n",ch);
}

void footguy_swear(struct char_data *ch)
{
  ansi_goto(footguyx+1,footguyy,ch);
  send_to_char("$%#@*&!\r\n",ch);
  ansi_goto(footguyx+3,footguyy+1,ch);
  send_to_char("/\r\n",ch);
}

void footguy_action(void) {
  struct char_data *ch;
  struct descriptor_data *d;

  for((d) = descriptor_list; (d); (d) = (d)->next) {
    ch=d->character;
    if(!ch || !IS_SET(PLR_FLAGS(ch),PLR_FOOTGUY))
      continue;

    ansi_cls(ch);
    footguy(footguyx,footguyy,ch);

    if(footguytap < 18) {
      footguy_tap(footguyx,footguyy,footguytap%2,ch);
    } else {
      footguy_swear(footguyx,footguyy,ch);
    }
  }

  footguytap++;
  if(footguytap >25) {
    new_footguy();
  }
}

        Of course, you'll want to make a flag, PLR_FOOTGUY, and then in
heartbeat() in comm.c, you'll want to add the line

  if(!(pulse %4)) {
    footguy_action();
  }

        You may also want to disable the display of the prompt for players
thus flagged, I just had this line in make_prompt;
  if(d->character && IS_SET(PLR_FLAGS(d->character),PLR_FOOTGUY)) {
    return;
  }

        There you go, something minor and amusing, and really not to
difficult.  I can't take the credit though, I just 'ported' footguy to
circlemud. The original author of footguy is rambo@waste.org.

                                                PjD


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST