[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  Compiling the server
. . -> [Subject]  Creating a New Command

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Creating a New Command
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Nick Gammon   Australia  (18,769 posts)  [Biography] bio   Forum Administrator
Date Tue 22 May 2001 05:23 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Kris   USA  (198 posts)  [Biography] bio
Date Mon 21 May 2001 10:01 PM (UTC)  quote  ]
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 :)

--Kris
[Go to top] top

Posted by Nick Gammon   Australia  (18,769 posts)  [Biography] bio   Forum Administrator
Date Mon 14 May 2001 12:38 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Kris   USA  (198 posts)  [Biography] bio
Date Sun 13 May 2001 11:14 PM (UTC)  quote  ]
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?

--Kris
[Go to top] 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.


2,853 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]