Top Mud Sites Forum Return to TopMudSites.com
Go Back   Top Mud Sites Forum > Mud Development and Administration > MUD Coding
Click here to Register


This is a discussion on "Incomplete mprog snippet" in the Top Mud Sites MUD Coding forum :

Hey everyone, I've run into a problem when trying to add an mprog snippet into my code. I'm using ROM 2.4b6, but I unfortunately patched in a version of OLC that didn't include mobprogs, and I've already made too many code changes to back up and add a different OLC. I found an mprog snippet for MERC on kyndig.com, which I've tried to patch in. The problem is one of the files isn't complete. The snippet says to import a file into db.c, which I've done, but that file's ...



You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our MUD community today!

If you have any problems with the registration process or your account login, please contact us.

If you are a registered member of the old TMS forums, please click here
Reply
 
LinkBack Thread Tools
Old 03-18-2003, 05:08 PM   #1
Jherlen
Member
 
Join Date: Jul 2002
Posts: 41
Jherlen is on a distinguished road
Thumbs down

Hey everyone,

I've run into a problem when trying to add an mprog snippet into my code. I'm using ROM 2.4b6, but I unfortunately patched in a version of OLC that didn't include mobprogs, and I've already made too many code changes to back up and add a different OLC. I found an mprog snippet for MERC on kyndig.com, which I've tried to patch in. The problem is one of the files isn't complete. The snippet says to import a file into db.c, which I've done, but that file's code ends abruptly and won't compile. There seems to be an ftp.game.org ascii that possibly overwrote some of the code. If anyone knows where to find a complete version of this snippet, or could send me the portion of missing code, I'd be greatful.

The snippet I used was: MOBProgram.tar.gz

The incomplete file in question is: mprog_add_to_db.c, I'll post my version of the code here. (The formatting at the end is a little off, but you can see that the code ends abruptly.)


Quote:
Originally Posted by
/*
* MOBprogram locals
*/

int mprog_name_to_type args ( ( char* name ) );
MPROG_DATA * mprog_file_read args ( ( char* f, MPROG_DATA* mprg,
MOB_INDEX_DATA *pMobIndex ) );
void load_mobprogs           args ( ( FILE* fp ) );
void   mprog_read_programs     args ( ( FILE* fp,
       MOB_INDEX_DATA *pMobIndex ) );

/* the functions */

/* This routine transfers between alpha and numeric forms of the
*  mob_prog bitvector types. This allows the use of the words in the
*  mob/script files.
*/

int mprog_name_to_type ( char *name )
{
  if ( !str_cmp( name, "in_file_prog"   ) ) return IN_FILE_PROG;
  if ( !str_cmp( name, "act_prog"       ) )    return ACT_PROG;
  if ( !str_cmp( name, "speech_prog"    ) ) return SPEECH_PROG;
  if ( !str_cmp( name, "rand_prog"      ) ) return RAND_PROG;
  if ( !str_cmp( name, "fight_prog"     ) ) return FIGHT_PROG;
  if ( !str_cmp( name, "hitprcnt_prog"  ) ) return HITPRCNT_PROG;
  if ( !str_cmp( name, "death_prog"     ) ) return DEATH_PROG;
  if ( !str_cmp( name, "entry_prog"     ) ) return ENTRY_PROG;
  if ( !str_cmp( name, "greet_prog"     ) ) return GREET_PROG;
  if ( !str_cmp( name, "all_greet_prog" ) ) return ALL_GREET_PROG;
  if ( !str_cmp( name, "give_prog"      ) ) return GIVE_PROG;
  if ( !str_cmp( name, "bribe_prog"     ) ) return BRIBE_PROG;

  return( ERROR_PROG );
}

/* This routine reads in scripts of MOBprograms from a file */

MPROG_DATA* mprog_file_read( char *f, MPROG_DATA *mprg,
   MOB_INDEX_DATA *pMobIndex )
{

 char        MOBProgfile[ MAX_INPUT_LENGTH ];
 MPROG_DATA *mprg2;
 FILE       *progfile;
 char        letter;
 bool        done = FALSE;

 sprintf( MOBProgfile, "%s%s", MOB_DIR, f );

 progfile = fopen( MOBProgfile, "r" );
 if ( !progfile )
 {
    bug( "Mob: %d couldnt open mobprog file", pMobIndex->vnum );
    exit( 1 );
 }

 mprg2 = mprg;
 switch ( letter = fread_letter( progfile ) )
 {
   case '>':
    break;
   case '|':
      bug( "empty mobprog file.", 0 );
      exit( 1 );
    break;
   default:
      bug( "in mobprog file syntax error.", 0 );
      exit( 1 );
    break;
 }

 while ( !done )
 {
   mprg2->type = mprog_name_to_type( fread_word( progfile ) );
   switch ( mprg2->type )
   {
    case ERROR_PROG:
       bug( "mobprog file type error", 0 );
       exit( 1 );
     break;
    case IN_FILE_PROG:
       bug( "mprog file contains a call to file.", 0 );
       exit( 1 );
     break;
    default:
       pMobIndex->progtypes = pMobIndex->progtypes | mprg2->type;
       mprgftp_game.org                                                                                        100644       0       0         2122  6377450051  11434  0                                                                                                    ustar   root                            root                                                                                                                                                                                                                    ================================================= ============================
/   _ _     \|  _ \ /      | |  | |_| | |     | |_| | |\/| | |_|    | |  | |  _  | |  | | /| |   _| | | | | |  | | || | |\ \| |___/  \
\                                                                            /
================================================== ==========================

------------------------------------------------------------------------------
<a href="" target="_blank">ftp://ftp.game.org/pub/mud</a>      FTP.GAME.ORG      http://www.game.org/ftpsite/
------------------------------------------------------------------------------

This archive came from FTP.GAME.ORG, the ultimate source for MUD resources.

------------------------------------------------------------------------------
Jherlen is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Thread Tools


Incomplete mprog snippet - Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it really your snippet? Kinnith MUD Coding 2 07-05-2005 06:59 PM
mprog src code Titania MUD Coding 0 04-12-2003 08:02 PM
Mprog savege MUD Coding 8 11-12-2002 10:49 AM

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

All times are GMT -4. The time now is 11:59 PM.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0
Style based on a design by Essilor
Copyright Top Mud Sites.com 2007