Town Snippet and Pager ON

Posted by Alkarindil on Fri 15 Jun 2007 10:53 PM — 16 posts, 57,278 views.

Brazil #0
Hello!

I am trying to install the town's snippet from crimson blade, here is the link:

http://www.afkmud.com/index.php?a=files&s=viewfile&fid=118

...but I get 4 or 5 problems:

1 - the command do_mpmakecitizen doesn't work, I had to comment the line on tables.c.
2 - the same with the command do_mprevokecitizen.
3 - the function do_makehometown have an "if(!IS_IMMORTAL(ch)...". This condition doesn't work and my immortals always are considered mortals.
4 - the hometowns are in the file hometowns.dat inside system folder. When I create a hometown directly in the file, only the first one is listed in the MUD. When I create a new hometown inside the MUD, it erases all the towns, except the first one and read the two towns. Horever, if I restart the MUD, it will read only the first one again!

And, at least, the pager option.
Inside nanny function, I found these lines:
xSET_BIT( ch->act, PLR_AUTOGOLD );
xSET_BIT( ch->act, PLR_AUTOEXIT );
So I added this:
xSET_BIT( ch->act, PCFLAG_PAGERON );
It doesn't work. Anyone know why?
USA #1
Did you make sure you cedit in the commands (mpmakecitizen etc)?
Brazil #2
Thanks Zeno, but answer me if it isn't a stupid question: how do I "cedit" it? If it is to write in commands.dat, I've done that already. If not, where do I put those things?

Okay! There are only 3 problems left.
Amended on Sat 16 Jun 2007 01:47 AM by Alkarindil
USA #3
Type: cedit mpmakecitizen

Paste here what it says.
Brazil #4
<4000hp 104m 110mv> cedit mpmakecitizen
Command: mpmakecitizen
Level: 55
Position: 0
Log: 0
Code: (00401884)
Flags:

<4000hp 104m 110mv> mpmakecitizen
Huh?

<4000hp 104m 110mv>
USA #5
The reason is the code is set to nothing. You need to set it to the function name. Also, players/Imms cannot use mp commands.
Brazil #6
Oh no! The problem is in the code:

Example: the following tables.c's line:

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

returns:

...\tables.c(465) : error C2065: 'do_mpmakecitizen' : undeclared identifier
...\tables.c(465) : warning C4047: 'return' : 'void (__cdecl *)(struct char_data *,char *)' differs in levels of indirection from 'int '

the same to the other command..
But I've done the same with all the commands!

Horever, the biggest problem is the hometowns.dat file, it simple doesn't work with more than one town.
Amended on Sat 16 Jun 2007 02:42 AM by Alkarindil
USA #7
Did you remember to add the line for do_mpmakecitizen in mud.h? And there are 2 lines for it in tables.c.
Brazil #8
Well... I followed the instructions.

The file hometowns.h have these lines:

DECLARE_DO_FUN(do_mp_makecitizen);
DECLARE_DO_FUN(do_mp_revokecitizen);

It's something missing? What must I do?

// EDIT ------------------>

Ooooow Now I saw!
DECLARE_DO_FUN(do_mp_revokecitizen);
it have an underline after "mp".
Horever, I erased the underline. It is in the function's name too!
The same for both functions.
The file from internet is with this error, maybe this topic may be usefull in the future.

Thanks Zeno!

Now, let's see the other problems!
The MUD still doesn't read the full file hometowns.dat.
Any ideas?
Amended on Sat 16 Jun 2007 05:53 AM by Alkarindil
USA #9
Did you check the log files to see if there are any errors? Perhaps the format for the line in the file is wrong.
Brazil #10
Nothing zeno..
USA #11
Can you show me how the file looks before (all data there), and then after (only the one line)?
Brazil #12
Sure!
Imagine that we followed all the directions on the read-me file. Then we changed that underline we talked about and the immortal's condition to the makehometown's command.
Then, executing the smaug.exe, using an immortal inside the mud we use the createnation's command.
This nation will be Tolkien's "Shire". In the nation's folder is now a new file called Shire.nation, and "nations.lst" have a new line pointing to it.
Everything works fine until here.
So we use <makehometown bree>.
The file hometowns.dat becomes this:


#HOMETOWN
Name Bree~
Recall -1
Vnum 1
Citizens -1
Description None~
End
#END


Then we do <hometown> command in the mud. It returns this (ow, I used dots ".", but just because it doesn't work fine with spaces " " in the forum):



Hometown................Nation...............Citizens
_____________________________________________________
Bree.....................None....................-1
For more information use 'hometowns <name>'


Everything is ok.
So, we shutdown the MUD. Start it again and use <hometown> command again. It returns the same.
So we use <makehometown hobbiton>. The file becomes this:

#HOMETOWN
Name Bree~
Recall -1
Vnum 1
Citizens -1
Nation 0
Description None~
End
#HOMETOWN
Name Hobbiton~
Recall -1
Vnum 1
Citizens -1
Description None~
End
#END

Inside the MUD:


<1802hp 104m 110mv> homet
Hometown................Nation...............Citizens
_____________________________________________________
Bree.....................None....................-1
Hobbiton.................None....................-1
For more information use 'hometowns <name>'


Now, shutdown the MUD, restart it again.
Use the <hometown> command again!


<1802hp 104m 110mv> homet
Hometown................Nation...............Citizens
_____________________________________________________
Bree.....................None....................-1
For more information use 'hometowns <name>'


Where is Hobbiton?
Opening the hometowns.dat, there is hobbiton!
Horever, imagine that I try again, with a new hometown:
<makehometown buckland>
then the file will become this:

#HOMETOWN
Name Bree~
Recall -1
Vnum 1
Citizens -1
Nation 0
Description None~
End
#HOMETOWN
Name Buckland~
Recall -1
Vnum 1
Citizens -1
Description None~
End
#END

Everything will work the same way. If I restart the MUD, Buckland will be ignored.
Amended on Mon 18 Jun 2007 07:33 PM by Alkarindil
USA #13
From that format, it seems to me that there shouldn't be more than one #HOMETOWN in the file. The number of #END's doesn't match the number of #HOMETOWN's.

Note that all snippets are not perfect and may need some tweaking to get it working correctly.
Brazil #14
Do you suggest I use more #END lines and try to make the code understand it?
I believe it works just as commands.dat:

#COMMAND
Name '~
Code do_say
Position 106
Level 0
Log 0
End

#COMMAND
Name ,~
Code do_emote
Position 106
Level 0
Log 0
End

(...)

Note that there's only one #END line, there in the bottom of file, so it doesn't match the #COMMAND lines.
Well, it doesn't work correctly.. this is sad, I must change everything.

Thanks anyway Zeno.
USA #15
It is extremely hard to understand what is wrong by only looking at data files. Who knows what it could be? It could be the data file format, it could be the loading code, it could be the saving code, it could be something else... the only way to know for sure is to look at the code. I suggest that you start by reading the code to read in the hometown files, and make sure that it expects the same format that you have in your data files.