/* alter the IS_SET to use which ever flags you see fit*/ #define HAS_SOUND(ch) (IS_SET((ch)->act, PLR_MSP)) /* add these defines or*/ #define SND_CHAR 1 #define SND_ROOM 2 #define SND_AREA 3 #define SND_WORLD 4 /* add this typedef, which ever is best for you */ typdef enum { SND_NONE, SND_CHAR, SND_ROOM, SND_AREA, SND_WORLD }sound_type; /* i would recommend making either a series of defines or * or a table of paths to sound strings for quick and easy * management. Look at the specification for MSP on the * Zuggsoft page to see the correct usage. * note: your players must have the sounds installed in the * exact place you send the string to */ void play_sound( CHAR_DATA *ch, char *sound, int type) { char buf[MAX_STRING_LENGTH]; CHAR_DATA *vch; DESCRIPTOR_DATA *d; if( (sound == NULL) || (ch == NULL)) return; sprintf( buf, "!!SOUND(%s)\n\r", sound); switch( type) { default: case SND_CHAR: if( HAS_SOUND(ch)) send_to_char(buf, ch); break; case SND_ROOM: for( vch = ch->in_room->people; vch; vch = vch->next_in_room) { if( IS_NPC(vch)) continue; if( HAS_SOUND(vch)) stc(buf, vch); } break; case SND_AREA: for( d = descriptor_list; d; d = d->next) { if( d->connected != CON_PLAYING) continue; if (d->character == NULL) continue; vch = d->character; if( vch->in_room->area != ch->in_room->area) continue; if( HAS_SOUND(vch)) send_to_char(buf, vch); } break; case SND_WORLD: for( d = descriptor_list; d; d = d->next) { if( d->connected != CON_PLAYING) continue; if( d->character == NULL) continue; vch = d->character if( HAS_SOUND(vch)) send_to_char(buf, vch); } break; } return; }