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 ➜ Multiple Problems, as well as multiple headaches...

Multiple Problems, as well as multiple headaches...

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


Posted by Toy   (206 posts)  Bio
Date Wed 16 Apr 2003 02:12 PM (UTC)
Message
Ok. I've been working on my code for awhile now. I've added snippets here and there and I've run into some problems with the code. Seeing as I'd rather fix them then scrap and start over (again), I'm gonna list some of these problems, and hopefully someone will be able to *AT LEAST* be able to point me in the right direction.

-Problem 1: Something is screwy with my area files. Even up to the point when the AreaEditor can't read them. I don't think I've added anything that effects areas to the mud cept for a Editor snippet I downloaded.

-Problem 2: Might be tied in with problem 1. I added a snippet that changed an object's value5 to it's level, so whe it reset it'd reset to a specefic level. Now, whenever I save an object, like objvnum 125's value3 to match Grimm's Weapon snippet, after a reboot, the values don't save.

Problem 3: I'm running into errors with commands. I added a Cshow snippet that allows you to either show or not show commands. Don't know if it's caused any troubles, but some commands, even after I save them correctly and then work, lose their code when the mud restarts.

Problem 4: The races/classes/commands are screwy. For the races and commands, when I save them in the mud, normally the files are lined up nicely, but after a save, their fields are all over the place. And with the classes, when I save a skill, in the classes files each class is given every skill, weither they normally would know it or not.

Anything I can do to figure this mess out, or am I screwed?

-Alexander

It's always good to know how far you are willing to go to be the best...

Karl Mancine
aka
Toy the Dark Puppet
Top

Posted by Boborak   USA  (228 posts)  Bio
Date Reply #1 on Wed 16 Apr 2003 06:13 PM (UTC)
Message
Let's see what we can do here ;-)

Problem1&2: They're likely tied in together. Any changes to the way objects save would definitely affect your area files. However, what exactly is "screwy" about the areas? Post some errors you may be getting or something.

Problem3: I'm not familiar with the Cshow snippet, so I'm not certain what it may have changed. In stock Smaug however your symptoms have an easy fix. In tables.c you should find 4 total refrences (on 2 lines) to each command. You're either A) missing one or B) misspelled it.

For example if you search for do_aassign, you find:

if ( !str_cmp( name, "do_aassign" )) return do_aassign;

That line, in comparison to commands that may not be saving should be good, otherwise you wouldn't be able to cset the command in the first place. It'll be located in a case statement of other functions that start with the same first letter. Next you find:

if ( skill == do_aassign ) return "do_aassign";

This is the line that's likely misspelled or missing. It'll be in a long list of ALL of the command functions.

Problem4: err.. by "all over the place" you mean in the actual files? i.e.

Name Boborak
Level 105

If that's the case, that's how the individual save functions are writing it. It's common in "messy" code and shouldn't really be a problem. Simply spacing. the skills thing is a bit odd though.

All in all, you do have a nice set of 'issues' here. Some of them appear rather serious. Generally, I'd reccommend to just keep tinkering with it, and maybe re-read the snippets and make sure you didn't skip a part or something. You'll learn from the experience at the very least. Anyway, post follow ups and we'll see if we can't clean up your code without you having to start over ;-)
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #2 on Wed 16 Apr 2003 10:36 PM (UTC)
Message
You need to be cautious with these snippets - even adding one extra number when writing the area file could well make it unreadable, including by the Area Editor, which expects stock area file formats.

The snippet should also change the way the area is read back in, if it changes the way it writes it, but be warned that you are throwing away your ability to use the area editor if you use such things.

As for file layouts, I agree with Boborak - computer-generated code will always write things "its way" regardless of how nicely you format the file by hand.

- Nick Gammon

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

Posted by Toy   (206 posts)  Bio
Date Reply #3 on Thu 17 Apr 2003 02:14 AM (UTC)
Message
Ok, I re-downloaded the Area Editor. Not really sure what changed, but this new upgrade seems to be reading the area files alright.

As for what I mean about the code being screwy, when I save races/commands, it simply moves the field over. Like:

Name '~
Code do_say
Position 106
Level 0
CShow 1
Log 0
End

Nothing major there, but I'm horribly anal. :)

As for the c-show snippet I downloaded from http://www.mindcloud.com/smaug/. I don't know if it's causing issues or not.

My biggest issues come from the items and skills issues. When i'm in the mud, if I type sset save skill table, it creates a 'phantom' class, with no name and everything set to 0. it also gives everyclass each skill, weither or not they should have it. And for the objects, I used a snippet which I'm trying to refind that that changed value5 of an object to it's level, so it'll repop. problem is, as I said, I'm having a hard time trying to refind the snippet.

I'm going to search for a bit for the snippet. I'll repost when I find it.

-Alexander

It's always good to know how far you are willing to go to be the best...

Karl Mancine
aka
Toy the Dark Puppet
Top

Posted by Boborak   USA  (228 posts)  Bio
Date Reply #4 on Thu 17 Apr 2003 04:16 AM (UTC)
Message
The Cshow snippet is cleanly written and doesn't really do a whole lot. So it shouldn't give you any problems considering you followed it right ;-)

..and if you're THAT worried about the looks of the files, find the function save_commands() in tables.c and fix the spacing the way you want. For example:


            fprintf( fpout, "Name        %s~\n", command->name          );
            fprintf( fpout, "Code        %s\n",  skill_name(command->do_fun) );
            fprintf( fpout, "Position    %d\n",  command->position      );
            fprintf( fpout, "Level       %d\n",  command->level         );
            fprintf( fpout, "Log         %d\n",  command->log           );


;-P
Top

Posted by Toy   (206 posts)  Bio
Date Reply #5 on Thu 17 Apr 2003 07:32 AM (UTC)
Message
Well, it's been a fun day. :)

I've fixed the 'little' descrepancies with the .dat files, and I've also fixed the object saving issue. One of those opps, that's not right type scenarios.

Now, my major issue left is this little thing:

The problem with saving skills. I haven't added any snippets or changed any code that would effect sset save skill table, so I have no idea why it's doing what's it's doing.

Has anyone run into or heard of saving skills making a 'phantom class' and giving every class each skill, including reserved?

-Alexander

It's always good to know how far you are willing to go to be the best...

Karl Mancine
aka
Toy the Dark Puppet
Top

Posted by Boborak   USA  (228 posts)  Bio
Date Reply #6 on Thu 17 Apr 2003 10:07 AM (UTC)
Message
Hmm. Are you using Cygwin? This may be a good time to learn how to use gdb. Also, in tables.c, review the function save_skill_table() and see if anything looks wrong. If you want post it here so we can take a look at it. Don't forget to add a [code] and a [\code] at the top and bottom so it's halfway readable ;-)
Top

Posted by Toy   (206 posts)  Bio
Date Reply #7 on Thu 17 Apr 2003 11:10 PM (UTC)
Message
ok, here's that section. Mind you, my coding setup is different and so are my levels, so here we go:


    	if ( get_trust(ch) > LEVEL_CODER && !str_cmp( arg1, "save" ) && !str_cmp( argument, "table" ) )
    	{
	if ( !str_cmp( arg2, "skill" ) )
	{
	send_to_char( "Saving skill table...\n\r", ch );
	save_skill_table();
	save_classes();	    
/* 	save_races(); */
	return;
	}


Is that what you are looking for?
-Alexander

It's always good to know how far you are willing to go to be the best...

Karl Mancine
aka
Toy the Dark Puppet
Top

Posted by Boborak   USA  (228 posts)  Bio
Date Reply #8 on Thu 17 Apr 2003 11:34 PM (UTC)
Message
Yes and no. That was the section of code I was reffering too, but it's not what I was looking for. It appears we need to look at the save_classes() function now. I haven't a clue where that may be located, my code doesn't have it. I'll find a distro that does and take a look at it.
Top

Posted by Boborak   USA  (228 posts)  Bio
Date Reply #9 on Fri 18 Apr 2003 12:03 AM (UTC)
Message
Ok. I downloaded a distro that had the class files and here's what I've noticed. Your 'phantom' class is getting created in load_classes() on boot. There's a bit of code at the end of the function that creates a blank class for each class that hasn't been loaded, up until MAX_CLASSES. Have you changed the value of MAX_CLASSES (in mud.h) or removed any classes from the class.lst file?

As for the skills problem. It appears any skill who's level is less then that of LEVEL_IMMORTAL will be written to a class file. There could be multiple reasons this is occuring. First take a look at an individual line in your class files. like this:


Skill 'cause critical' 9 95


The first number is the number that determines if the skill should be wrote to the file or not. If this number is higher then LEVEL_IMMORTAL it should never have been written according to the stock code. If all of these numbers are low but identical (i.e. all 0 or all the same number) you could have another problem with the write function or maybe even a read problem. It's hard to say exactly where things have gone wrong, but post a few lines of your skills in the class files so we can have a look see.
Top

Posted by Toy   (206 posts)  Bio
Date Reply #10 on Fri 18 Apr 2003 12:47 AM (UTC)
Message
I've run into strange issues when it comes to things like MAX_CLASSES and MAX_RACES. I've got 25 races right now, and 9 classes. If I set the numbers in mud.h to equal that, I get error messages when I turn the mud on saying it couldn't find the class or race, just the last class/race below the max. If I make the number higher, it's fine. I've got both set to 100 right now, having no issues other then the skill issues. I've removed all the MAX_CLASS -1 and MAX_RACE -1 calls, yet still, I lose the last class or race.

-Alexander

It's always good to know how far you are willing to go to be the best...

Karl Mancine
aka
Toy the Dark Puppet
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.


29,970 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.