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
➜ Compiling the server
➜ Creating a New Command
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Kris
USA (198 posts) Bio
|
| Date
| Sun 13 May 2001 11:14 PM (UTC) |
| Message
| | I noticed that there's a 'homepage' command, which you can use to set your homepage, but there isn't an 'email' command, where you can set your email. Therefore, I decided to create one. I found all references to the homepage command (i.e. function calls\declarations, variable declarations, etc) and copied them, replacing the word 'homepage' with the word 'email'. I then created the 'do_email' function, which was literally a copy-and-paste of the 'do_homepage' function, except I once again changed 'homepage' to 'email'; i.e. 'ch->pcdata->homepage' to 'ch->pcdata->email' and so-on. I then did the same thing in the 'commands.dat' file. After that, I deleted all the object files, and recompiled the server. There were no compile errors, and no run-time errors that I could find. When I type 'commands', the email command is listed among them. However, whenever I type 'email', the mud returns 'Huh?'. I cannot figure out why this is. Is there something I missed? I did remember to update mud.h as well. What else should I do to get it to perform the email command? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Mon 14 May 2001 12:38 AM (UTC) |
| Message
| In tables.c there are two references to do_homepage - did you duplicate those for email as well?
These convert to and from the string to the function name.
case 'h':
...
if ( !str_cmp( name, "do_homepage" ))
return do_homepage;
if ( skill == do_homepage )
return "do_homepage";
Also, in the first one, it would need to be placed under case 'e', not case 'h'.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Kris
USA (198 posts) Bio
|
| Date
| Reply #2 on Mon 21 May 2001 10:01 PM (UTC) |
| Message
| | Ok, I got it to work just fine and all. It saves it to my player file and everything. It also shows up on my revamped 'whois' just as it should. However, if I quit-out, and re-enter, my email shows up as unlisted again. It still remains in the player file, but for some reason the server isn't reading it from the player file when the character is loaded up. I duplicated the 'homepage' command as precisely as I could, save the changes you mentioned. The homepage info loads up just fine, but I can't figure out why it's loading up but email is not. Do you have any idea how I can fix this? Thanks :) | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Tue 22 May 2001 05:23 AM (UTC) |
| Message
| In save.c, it reads in character data, in function fread_char.
A little way in, you will find:
case 'H':
followed by:
KEY( "Homepage", ch->pcdata->homepage, fread_string_nohash( fp ) );
You need to duplicate that functionality, changing "homepage" to "email", which you have probably done, but it needs to be under the 'E' section (E for Email) not the 'H' section (H for Homepage).
So, find the 'E' section, which include this line:
KEY( "Exp", ch->exp, fread_number( fp ) );
and put your email line there. :)
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | 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.
18,282 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top