/* This code was written by Jaey of Crimson Souls MUD. Any credit given, while appreciated, is not necessary. Please contact me with any problems. Contact info: E-mail: spcarrico@hotmail.com Web: http://www.cs.transy.edu/scarrico Crimson Souls: ns2.ka.net 6969 */ ----------------------------------------------------------------- In act_info.c, in function do_look(): Change: if ( arg1[0] == '\0' || ( !IS_NPC(ch) && !IS_SET(ch->comm, COMM_BRIEF) ) ) { send_to_char( " ",ch); send_to_char( ch->in_room->description, ch ); } To: if ( arg1[0] == '\0' || ( !IS_NPC(ch) && !IS_SET(ch->comm, COMM_BRIEF) ) ) { if (ch->desc && !ch->desc->run_buf) { send_to_char( " ",ch); send_to_char( ch->in_room->description, ch ); } } ----------------------------------------------------------------- In act_move.c: Add: #include Add this function somewhere: void do_jog( CHAR_DATA *ch, char *argument ) { char buf[MAX_INPUT_LENGTH],arg[MAX_INPUT_LENGTH]; char *p; bool dFound = FALSE; if (!ch->desc || *argument == '\0') { send_to_char("You run in place!\n\r",ch); return; } buf[0] = '\0'; while (*argument != '\0') { argument = one_argument(argument,arg); strcat(buf,arg); } for( p = buf + strlen(buf)-1; p >= buf; p--) { if (!isdigit(*p)) { switch( *p ) { case 'n': case 's': case 'e': case 'w': case 'u': case 'd': dFound = TRUE; break; case 'o': break; default: send_to_char("Invalid direction!\n\r",ch); return; } } else if (!dFound) *p = '\0'; } if (!dFound) { send_to_char("No directions specified!\n\r",ch); return; } ch->desc->run_buf = str_dup( buf ); ch->desc->run_head = ch->desc->run_buf; send_to_char("You start running...\n\r",ch); return; } Change do_north, do_south, do_east, do_west, do_up, and do_down to look like the following template (replace the xxxxx's with the appropriate direction): void do_xxxxx( CHAR_DATA *ch, char *argument ) { ROOM_INDEX_DATA *was_room; was_room = ch->in_room; move_char( ch, DIR_XXXXX, FALSE ); if (was_room == ch->in_room) free_runbuf(ch->desc); return; } ----------------------------------------------------------------- In comm.c: In function close_socket() add the line with a + next to it: + free_runbuf(dclose); if ( d_next == dclose ) d_next = d_next->next; In function read_from_buffer() add the following lines with a + next to them: if ( d->incomm[0] != '\0' ) return; + if ( d->run_buf ) + { + while (isdigit(*d->run_head) && *d->run_head != '\0') + { + char *s,*e; + + s = d->run_head; + while( isdigit( *s ) ) + s++; + e = s; + while( *(--s) == '0' && s != d->run_head ); + if ( isdigit( *s ) && *s != '0' && *e != 'o') + { + d->incomm[0] = *e; + d->incomm[1] = '\0'; + s[0]--; + while (isdigit(*(++s))) + *s = '9'; + return; + } + if (*e == 'o') + d->run_head = e; + else + d->run_head = ++e; + } + if (*d->run_head != '\0') + { + if (*d->run_head != 'o') + { + d->incomm[0] = *d->run_head++; + d->incomm[1] = '\0'; + return; + } + else + { + char buf[MAX_INPUT_LENGTH]; + + d->run_head++; + + sprintf( buf, "open " ); + switch( *d->run_head ) + { + case 'n' : sprintf( buf+strlen(buf), "north" ); break; + case 's' : sprintf( buf+strlen(buf), "south" ); break; + case 'e' : sprintf( buf+strlen(buf), "east" ); break; + case 'w' : sprintf( buf+strlen(buf), "west" ); break; + case 'u' : sprintf( buf+strlen(buf), "up" ); break; + case 'd' : sprintf( buf+strlen(buf), "down" ); break; + default: return; + } + + strcpy( d->incomm, buf ); + d->run_head++; + return; + } + } + free_runbuf(d); + } /* * Look for at least one new line. */ for ( i = 0; d->inbuf[i] != '\n' && d->inbuf[i] != '\r'; i++ ) ----------------------------------------------------------------- Somewhere in db.c, add: void free_runbuf(DESCRIPTOR_DATA *d) { if (d && d->run_buf) { free_string(d->run_buf); d->run_buf = NULL; d->run_head = NULL; } return; } ----------------------------------------------------------------- In interp.c add the following line to the command table: { "jog", do_jog, POS_STANDING, 0, LOG_NORMAL, 1 }, ----------------------------------------------------------------- In interp.h add: DECLARE_DO_FUN( do_jog ); ----------------------------------------------------------------- In merc.h add the following to the descriptor_data structure: char * run_buf; char * run_head; In the function declaration section add: void free_runbuf args( ( DESCRIPTOR_DATA *d ) ); ----------------------------------------------------------------- Additional info: Make sure you do a full recompile of the mud source since the descriptor_data structure was modified. Syntax: jog The consists of a string of directions in the form <#d>. "#" is optional and represents the number of times to repeat the direction. "d" is the direction you wish to jog. You may also use in the direction list where "o" stands for open and "d" is the direction of the door you wish to open. Example: jog 12eos3ses4w This command is used for speedwalking from one place to another. Once you start jogging, no other commands will be processed until you stop. There are only a few conditions that will stop you from jogging. 1. You reach your destination. 2. You are unable to move to the next room. As far as the mud is concerned, all directions processed while jogging are received as if they were entered one at a time. This means that anything that can happen during normal walking can also happen while jogging. All rooms are shown in brief mode while jogging.