Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Trouble saving

Trouble saving

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by BrittaniaVanHalleorg   (7 posts)  Bio
Date Sun 23 Nov 2003 04:15 PM (UTC)
Message
Okay, this may have been covered a loooong time ago, but I've looked at the list of topics and its just way too daunting for me.

I recently started up the smaug on my computer, all the redits etc are working, but anything changed in wizlist, deities, classes, etc isnt saving at all, are there commands that i'm not aware of that i'm supposed to be using to save those?

Idea of what i'm doing...wizlist 'adding names' its not saving.
deities...adding...its not saving
classes...getting rid of classes and putting 2 entirely different ones...its not saving

stuff like that...anything i'm missing? newbie coder issue lol
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #1 on Sun 23 Nov 2003 04:40 PM (UTC)
Message
Well, I couldn't tell you about deities or classes, as all my experience is with SWR, and it does not have deites, and classes are not OLC in stock, but with wizlist, I beleive that it is only meant to reference the files in the /gods directory, read all those, and create the wizlist file with those, I don't think that they can be manually entered. However, many of the other commands, sset, cedit, cset, etc, all need you to enter, "<command> save". Check the help files on the commands, and look at the code for each of them, if they have an option for you to enter save, then it is indeed not automatic, and has to be done manually. Hope that helps.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by BrittaniaVanHalleorg   (7 posts)  Bio
Date Reply #2 on Sun 23 Nov 2003 04:46 PM (UTC)
Message
So I guess that means my wizlist file is all wrong too. Lol can you all say KABOOM? I figured out the option save thing earlier, cause anything with save option saved...the rest refuses to do anything at all. and i cant figure out the commands to ADD commands...not going well this morning i'm afraid.
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #3 on Tue 25 Nov 2003 07:22 AM (UTC)
Message
If your wizlist file is not working, delete ALL the files in your god directory, use the "makewizlist" command, and then save. Loadup all your imms, and force them to save and quit. This SHOULD make the proper god files, and then you can makewizlist again to get an accurate file.

To add a command, you need to use the cedit command, specifically, "cedit <command name> create <command code>", so perhaps, "cedit wpeace create do_world_peace". Most newbie coders are also unaware that every time you add a command, you need to add 3 entries: one into mud.h, 2 into tables.c . Easiest way, IMO, is to pick a pre-exististing command that starts with the same letter, and do a search for it. Copy the line in mud.h, just a declaration, and then you have to make two entries into tables.c . The first one DOES matter where you put it, make sure that you put it into the right letter, cause it gonna look at the first letter of a command, so if you put "wpeace" under R, it aint gonna work. The second entry doesn't matter where you put it, as long as it with the other ones similiar to it. Take a look, should be pretty obvious.

Also, if your trying to add a skill, you ALSO need to make another entry in mud.h for the gsn, and two in db.c: one declaring the gsn, and a second using ASSIGN_GSN. Hope that helps some.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by BrittaniaVanHalleorg   (7 posts)  Bio
Date Reply #4 on Tue 25 Nov 2003 10:51 AM (UTC)
Message
Okay, that sounds a little like what I was noticing after staring at the files for 8 hours yesterday, clarified alot thanks. Am I to understand that there is actually no entry to put in for makewizlist? just to have all imms save between the first and second time i type it?

I'll let ya know if this all works and i dont crash my thing again lol
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #5 on Tue 25 Nov 2003 02:42 PM (UTC)
Message
Yeah, the idea is that make_wizlist runs through all the files in the /god directory, and opens each of them, generating the wizlist file from that. The god files contains 3 bits of information: The immortals name, the flags on that immortal(used by make_wizlist to determine if the immortal has the retired or guest flag on them) and the ranges of vnums for their area. If they do not have an area, this bit is omitted. When an immortal saves, it will update their god file, or create one if its not there. One problem I've seen time and again with Newbie coders and admins setting up new muds is that when they assign a builder an area, they will not force the vnums open. By this, I means that they will not mcreate/ocreate/goto the first and last vnums, so when they foldarea, it compresses it down to nothing, and the vnums on the player file and the vnums of the area do not match, and the mud will not reboot/copyover. The final vnum can always be m/o/rdeleted, or the area parameters changed to fit the last real vnum used, if less than the max, but they his and lows have to be set. Please excuse the rambling, its early, and I'm really tired.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by BrittaniaVanHalleorg   (7 posts)  Bio
Date Reply #6 on Tue 25 Nov 2003 03:51 PM (UTC)
Message
lol quite alright, i just went over anything related to makewizlist in the codes and i'm thinking its totally bugged up..everything is where its supposed to be...if command is supposed to be do_makewizlist. i'm going to try out do_make_wizlist see if maybe that'll make my wizlist understand..if not..back to the drawing board :)
Top

Posted by BrittaniaVanHalleorg   (7 posts)  Bio
Date Reply #7 on Tue 25 Nov 2003 04:05 PM (UTC)
Message
okay, i had a look around before i decided to hack around my stuff and make an impossible crashing mess. This is what i'm getting on logs.

Tue Nov 25 11:59:12 2003 :: Log Ambrosia: makewizlist

Then nothing else. Any idea why 'making wizlist' wouldn't be showing up at all?
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #8 on Tue 25 Nov 2003 06:26 PM (UTC)
Message
Don't think its supposed to log anything besides that. Did you clear out the god files? You might wanna paste a copy of yor wizlist here so we can see whats actually going on with it.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by BrittaniaVanHalleorg   (7 posts)  Bio
Date Reply #9 on Wed 26 Nov 2003 04:09 AM (UTC)
Message
when i type wizlist i get:

Masters of the The Council!

Thats it. In the file it shows the exact same thing except with one of those default square characters to show that it didn't know the letter. or its supposed to look like that..any idea?
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #10 on Wed 26 Nov 2003 07:47 AM (UTC)
Message
Double check in your /god directory if there are any files in it. If there is, maybe you can post your wizlist functions, make_wizlist( ) and towizfile( ).

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by BrittaniaVanHalleorg   (7 posts)  Bio
Date Reply #11 on Wed 26 Nov 2003 11:42 AM (UTC)
Message
void towizfile( const char *line )
{
int filler, xx;
char outline[MAX_STRING_LENGTH];
FILE *wfp;

outline[0] = '\0';

if ( line && line[0] != '\0' )
{
filler = ( 78-strlen( line ) );
if ( filler < 1 )
filler = 1;
filler /= 2;
for ( xx = 0; xx < filler; xx++ )
strcat( outline, " " );
strcat( outline, line );
}
strcat( outline, "\n\r" );
wfp = fopen( WIZLIST_FILE, "a" );
if ( wfp )
{
fputs( outline, wfp );
fclose( wfp );
}
}

void add_to_wizlist( char *name, int level )
{
WIZENT *wiz, *tmp;

#ifdef DEBUG
log_string( "Adding to wizlist..." );
#endif

CREATE( wiz, WIZENT, 1 );
wiz->name = str_dup( name );
wiz->level = level;

if ( !first_wiz )
{
wiz->last = NULL;
wiz->next = NULL;
first_wiz = wiz;
last_wiz = wiz;
return;
}

/* insert sort, of sorts */
for ( tmp = first_wiz; tmp; tmp = tmp->next )
if ( level > tmp->level )
{
if ( !tmp->last )
first_wiz = wiz;
else
tmp->last->next = wiz;
wiz->last = tmp->last;
wiz->next = tmp;
tmp->last = wiz;
return;
}

wiz->last = last_wiz;
wiz->next = NULL;
last_wiz->next = wiz;
last_wiz = wiz;
return;
}



void make_wizlist( )
{
DIR *dp;
struct dirent *dentry;
FILE *gfp;
char *word;
int ilevel, iflags;
WIZENT *wiz, *wiznext;
char buf[MAX_STRING_LENGTH];

first_wiz = NULL;
last_wiz = NULL;

dp = opendir( GOD_DIR );

ilevel = 0;
dentry = readdir( dp );
while ( dentry )
{
if ( dentry->d_name[0] != '.' )
{
sprintf( buf, "%s%s", GOD_DIR, dentry->d_name );
gfp = fopen( buf, "r" );
if ( gfp )
{
word = feof( gfp ) ? "End" : fread_word( gfp );
ilevel = fread_number( gfp );
fread_to_eol( gfp );
word = feof( gfp ) ? "End" : fread_word( gfp );
if ( !str_cmp( word, "Pcflags" ) )
iflags = fread_number( gfp );
else
iflags = 0;
fclose( gfp );
if ( IS_SET( iflags, PCFLAG_RETIRED ) )
ilevel = MAX_LEVEL - 15;
if ( IS_SET( iflags, PCFLAG_GUEST ) )
ilevel = MAX_LEVEL - 16;
add_to_wizlist( dentry->d_name, ilevel );
}
}
dentry = readdir( dp );
}
closedir( dp );


Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #12 on Thu 27 Nov 2003 04:16 PM (UTC)

Amended on Thu 27 Nov 2003 06:59 PM (UTC) by Nick Gammon

Message
If thats all you have for make_wizlist, then yes indeed, you are missing quite a bit. Replace what you have for make_wizlist with this:
void make_wizlist( )
{
  DIR *dp;
  struct dirent *dentry;
  FILE *gfp;
  char *word;
  int ilevel, iflags;
  WIZENT *wiz, *wiznext;
  char buf[MAX_STRING_LENGTH];

  first_wiz = NULL;
  last_wiz  = NULL;

  dp = opendir( GOD_DIR );

  ilevel = 0;
  dentry = readdir( dp );
  while ( dentry )
  {
      if ( dentry->d_name[0] != '.' )
      {
	sprintf( buf, "%s%s", GOD_DIR, dentry->d_name );
	gfp = fopen( buf, "r" );
	if ( gfp )
	{
	  word = feof( gfp ) ? "End" : fread_word( gfp );
	  ilevel = fread_number( gfp );
          fread_to_eol( gfp );
	  word = feof( gfp ) ? "End" : fread_word( gfp );
          if ( !str_cmp( word, "Pcflags" ) )
	    iflags = fread_number( gfp );
          else
	    iflags = 0;
	  fclose( gfp );
          if ( IS_SET( iflags, PCFLAG_RETIRED ) )
            ilevel = MAX_LEVEL - 4;
          if ( IS_SET( iflags, PCFLAG_GUEST ) )
            ilevel = MAX_LEVEL - 4;
	  add_to_wizlist( dentry->d_name, ilevel );
	}
      }
      dentry = readdir( dp );
  }
  closedir( dp );

  buf[0] = '\0';
  unlink( WIZLIST_FILE );
  towizfile( " Masters of Star Wars Reality!" );
  ilevel = 65535;
  for ( wiz = first_wiz; wiz; wiz = wiz->next )
  {
   if ( wiz->level > LEVEL_AVATAR )
   {
    if ( wiz->level < ilevel )
    {
      if ( buf[0] )
      {
	towizfile( buf );
	buf[0] = '\0';
      }
      towizfile( "" );
      ilevel = wiz->level;
      switch(ilevel)
      {
	case MAX_LEVEL -  0: towizfile( " The President" );	break;
	case MAX_LEVEL -  1: towizfile( " The Executive Council" );		break;
	case MAX_LEVEL -  2: towizfile( " The Senate" );	break;
	case MAX_LEVEL -  4: towizfile( " The Retired" );		break;
	default:             towizfile( " Galactic Engineers" );	break;
      }
    }
    if ( strlen( buf ) + strlen( wiz->name ) > 76 )
    {
	towizfile( buf );
	buf[0] = '\0';
    }
    strcat( buf, " " );
    strcat( buf, wiz->name );
    if ( strlen( buf ) > 70 )
    {
      towizfile( buf );
      buf[0] = '\0';
    }
   }
  }

  if ( buf[0] )
    towizfile( buf );

  for ( wiz = first_wiz; wiz; wiz = wiznext )
  {
    wiznext = wiz->next;
    DISPOSE(wiz->name);
    DISPOSE(wiz);
  }
  first_wiz = NULL;
  last_wiz = NULL;

}
You can of cource change what it says and such, but your missing quite a bit of the function. Hope that helps.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #13 on Thu 27 Nov 2003 07:00 PM (UTC)

Amended on Thu 27 Nov 2003 07:01 PM (UTC) by Nick Gammon

Message
When pasting code like the above it helps to use the MUSHclient notepad function Convert -> Quote Forum Codes.

That changes things like [i] to \[i\] - otherwise stuff in square brackets may be interpreted as a forum command, and not be rendered properly.

I have amended your above post to do that.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #14 on Thu 27 Nov 2003 07:05 PM (UTC)
Message
Lol, thanks alot, didn't even think about it.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


28,504 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.