This is a little outdated, but it should still be pretty accurate.
Earthwolf
Although CircleMUD has many wear slots, it''s always fun to
add your own. I can think of some great wear-slots that I''d
rather not mention :-)
Earthwolf''s "Add a wear-slot" text v1.0
earthwolf@anti-social.com
Table Of Contents
-----------------
1. Introduction
2. Your step-by-step
3. How to contact me
INTRODUCTION
------------
You''ll all have to excuse any inability I show in writing
code snippet tutorials, this is my first :-). Being new to
coding I''m not yet great at fixing patches, modifying other''s
snippets, etc. It was because of the trouble I had of modifying
my Circle30bpl17 source by following other people''s instructions
that I set out to learn everything from scratch. I''m sure it''s
the best thing you can do for yourself: Learn how to add things
yourself, without other''s tutorials. Now that I think about it,
it doesn''t make sense while I''m writing this. Anyway, this is
a relatively simple process for beginners. Read on and enjoy!
NOTE: I''m not sure how well this will work for distributions
other than Circle30bpl17
STEP-BY-STEP How to add Wear-Slots
----------------------------------
Although CircleMUD has many wear slots, it''s always fun to
add your own. I can think of some great wear-slots that I''d
rather not mention :-). For this tutorial, we''ll be adding
one for the ankle. Not even for both, just one. After reading
this you should be able to add as many as you see fit.
files used (in alphtabetical order):
act.item.c, constants.c, objsave.c, structs.h
Modifications to act.item.c
--------------------------
Goto line 1165 and you should see the following code:
{"$n grabs $p.",
"You grab $p."}
};
That is the line for the description of what you and others
will see when you HOLD something. Since our ankle slot is
new we''ll just put it after the hold one.
So, add a comma to the bracket after the hold strings, and
then add what people and you will see when you wear your
anklet. The code will now look like this:
{"$n grabs $p.",
"You grab $p."},
{"$n fastens $p around $s ankle.",
"You fasten $p around your ankle."}
};
Make sure that you leave the "};" At the very end. If you did
not know, when the game is running variables with a ''$'' before
them will be replaced with some differant text. For example,
$n is replaced with the user''s name and $p is replaced with
what the item is called.
Ok, now head on down to line 1185 were you''ll see a big block
of code looking like this:
int wear_bivectors[] = {
ITEM_WEAR_TAKE, ITEM_WEAR_FINGER, ITEM_WEAR_FINGER, ITEM_WEAR_NECK
ITEM_WEAR_NECK, ITEM_WEAR_BODY, ITEM_WEAR_HEAD, ITE_WEAR_LEGS,
ITE_WEAR_FEET, ITEM_WEAR_HANDS, ITEM_WEAR_ARMS, ITE_WEAR_SHIELD,
ITEM_WEAR_ABOUT, ITEM_WEAR_WAIST, ITEM_WEAR_WRIST, ITEM_WEAR_WRIST,
ITEM_WEAR_WIELD, ITEM_WEAR_TAKE
};
Again, all we want to do is add more to this array. SLAP down a
comma after ITEM_WEAR_TAKE and add yourself an ITEM_WEAR_ANKLE.
Your code should magically now look like this:
int wear_bivectors[] = {
ITEM_WEAR_TAKE, ITEM_WEAR_FINGER, ITEM_WEAR_FINGER, ITEM_WEAR_NECK
ITEM_WEAR_NECK, ITEM_WEAR_BODY, ITEM_WEAR_HEAD, ITE_WEAR_LEGS,
ITE_WEAR_FEET, ITEM_WEAR_HANDS, ITEM_WEAR_ARMS, ITE_WEAR_SHIELD,
ITEM_WEAR_ABOUT, ITEM_WEAR_WAIST, ITEM_WEAR_WRIST, ITEM_WEAR_WRIST,
ITEM_WEAR_WIELD, ITEM_WEAR_TAKE, ITEM_WEAR_ANKLE
};
You see we just added our ankle information ITEM_WEAR_ANKLE to the
end of an already existing array. Ready to do it again? Well, jump
on down to line number 1211 where we''ll append the the big string
array. You should already see this:
"You''re already holding something\r\n"
};
You want to change this to:
"You''re already holding something\r\n",
"You''ve already got something around your ankle\r\n"
};
The MUD knows what''s up now if you try to wear an anklet twice.
Because of the code above all of the newbies shall be told.
Ok, now go down to line 1260 and we''ll just slide our ankle
into the end like we always do. (that didn''t sound right)
"\r!RESERVED!",
"\r!RESERVED!",
"\n"
};
So, to not have a crash we''ll just change the code above to
this code below:
"\r!RESERVED!",
"\r!RESERVED!",
"ankle",
"\n"
};
Well now that you have that done we must add some error checking
to the MUD to keep on making sure the MUD doesn''t try to wear
to anklets on the same slot:
if (CAN_WEAR(obj, ITEM_WEAR_WRIST)) where = WEAR_WRIST_R;
} else {
We''re just going to add some of our ankle code to this. You might
of already guessed, but all we need to do is make the code so
it looks like this:
if (CAN_WEAR(obj, ITEM_WEAR_WRIST)) where = WEAR_WRIST_R;
if (CAN_WEAR(obj, ITEM_WEAR_ANKLE)) where = WEAR_ANKLE;
} else {
We be done with act.item.c!
Modifications to constants.c
----------------------------
If you didn''t think that was very hard, then you''ll get through
the rest of this fine. We''ll just be adding some strings to
some existing arrays so that the MUD will notify us about what
we''re doing when we try to wear something on our ankle.
Ok, jump on down to line 264 where we''ll add some more stuff
after that ol'' hold slot friend of ours. On line 264 you''ll
see some code that looks like this:
" ",
" "
};
We just want to plug in another slot for the ankle. Simply
modify your code to look like what''s below, and don''t forget
the comma!
" ",
" ",
" "
};
By now you should be getting the picture, but if you don''t
then that''s ok. Our next step is very very similar to the
last one. Warp on down to line 289 and you''ll see some
code look''n just like ''dis:
"Wielded",
"Held",
"\n"
};
We want to jump inbetween the "Held" and the "\n" to make
ourselves an ankle sandwhich. We be jammin now! Use that
voodoo that you do and change your code to
"Wielded",
"Held",
"Worn around ankle",
"\n"
};
Don''t worry, we''re getting there. Go to line 340 and you''ll
see some very similar code:
"WIELD",
"HOLD",
"\n"
};
Ok, let''s just put our ankle slot after the HOLD slot like we''ve
been doing. Your code will now look like this:
"WIELD",
"HOLD",
"ANKLE"
"\n"
};
Oh my GOD, we did it! Well almost, you''re now done with
constants.c. There''s still some more to go. If you need to
get up, stretch out, play some Bob Marley, and do some
Tai Chi or something.
Modifying objsave.c, Friend or Foe?
-----------------------------------
Just by noticing the name of this file, I''m guessing that
this is what helps the computer save information about
objects :-). The only thing that we''re going to be worrying
about is helping the MUD know if you can actually wear
the obj on your ankle or not. Scroll down all the way
to line 162. There you''ll see a bunch of similar blocks of
code for each differant wear-slot. For easy installation
we''re gonna stick our code right after the WEAR_LEGS info
because it doesn''t really matter.
case WEAR_LEGS:
if (!CAN_WEAR(obj, ITEM_WEAR_LEGS))
location == LOC_INVENTORY;
break;
case WEAR_FEET:
So, with simple text editing program change the code above
to look like the code below:
case WEAR_LEGS:
if (!CAN_WEAR(obj, ITEM_WEAR_LEGS))
location = LOCINVENTORY;
break;
case WEAR_ANKLE:
if (!CAN_WEAR(obj, ITEM_WEAR_ANKLE))
location = LOC_INVENTORY;
break;
case WEAR_FEET:
Didn''t really take much to modify objsave.c did it? We only
have one more file to edit before you and your faithful
mortals can start wearing stuff on your ankle!
Modifying structs.h "It''s structurific!"
----------------------------------------
Remember all of those WEAR_ANKLE and ITEM_WEAR_ANKLE flags
we''ve been throwing around so haphazzardly? Well, we''re
actually going to define them now.
NOTE: It''s better to define things first :-)
I now you''re ready to implement, so cruise on down to
line 127 where all of the cool code hangs out. There
you''ll see some code like this:
#define WEAR_WIELD 16
#define WEAR_HOLD 17
#define NUM_WEARS 18
We''re not only going to through in our ankle slot, but also
increment the NUM_WEARS constant. So, modify your code to
the following, remembering to change NUM_WEARS:
#define WEAR_WIELD 16
#define WEAR_HOLD 17
#define WEAR_ANKLE 18
#define NUM_WEARS 19
We''re now ready for our last bit of code modification, and I
can''t beleave I''ve already written a 258 line text file!
Boy the time has been passing quickly hasn''t it? For your
last addition go on down to line 321 where you should see
the following code:
#define ITEM_WEAR_HOLD (1 << 14) /* Can be held */
Just change that to this and you''re done:
#define ITEM_WEAR_HOLD (1 << 14) /* Can be held */
#define ITEM_WEAR_ANKLE (1 << 15)
Ok, you''re completely done adding the wear slots now! When
you''re editing your objects from now on set your
War Bivector as ''p'' to make the equipment for your ankle.
(without the quotes)
HOW TO CONTACT ME
-----------------
As I''m sure you''ve noticed, adding wear slots was a really
easy thing to do. As for all you newbie coders like myself
though, it''s a great excersize for more familiarizing yourself
with the CircleMUD code. If you still have any questions, or
I made a mistake just e-mail me or go to my website. My
website will be updated with tutorials I write.
earthwolf@anti-social.com
http://www.geocities.com/earthwolf_0
MUDlists.com has added the tbaMUD codebase to all of their listing so if you have a tbaMUD listed as a CircleMUD you can now change it.
Download tbaMUD 3.57 here!
http://www.tbamud.com/filebrowser/patches/releases
Many bug fixes and more code clean-up!
Full changelog: tbaMUD 3.57
[Aug 11 2008] - Rumble
Updated World and files for 3.57 release.
[Aug 10 2008] - Fizban
Added sanity checks to zedit new. (Can no longer make zones that include negative vnums, also get the proper message when you have 3 of the 4 arguments.)
You can now put objects in and remove objects from closed containers as an imm with nohassle.
You can now walk through closed doors as an imm with nohassle on.
You can now open locked containers and doors without unlocking them as an immortal with nohassle.
You can now examine the contents of closed containers as an imm with nohassle.
Made zedit new added the .qst file to the index file.
Fixed various qedit related bugs. (thanks Mirad and Jamdog)
Removed deprecated "murder" code.
When pkill is on players can now order charmed mobs to attack other players.
Fixed 'toggle automap'.
Added a sacrifice command instead of their being autosac only. Also replaced Zizazat's name with more generic "The Gods" as it had obviously been ported from CWG previously.
Fixed Warning relating to Automap.
[Aug 03 2008] - Rumble
You can now see your own communications while sleeping for gos, auc, gra, etc. (thanks Drefs)
changed str_and_map to use target_room instead of IN_ROOM(ch). (thanks Vatiken)
[Aug 02 2008] - Welcor
Fixed a one-line bug in act.movement.c - caused crashes when moving into FLIGHT rooms.
[Jul 26 2008] - Rumble
Fixed autosplit to properly award gold to the person delivering the killing blow and then split it with the group. (thanks Maclir)
Added checks to qedit for questmaster not being set. (thanks Jamdog)
[Jul 08 2008] - Rumble
Removed duplicate questpoints listing in stat char. (thanks Mirad)
Fix to qedit for deleting all quests. (thanks Jamdog)
[Jul 06 2008] - Rumble
Changed sedit no trade with from undefined to nobits. (thanks Mirad)
[Jul 03 2008] - Rumble
Fixed lib/messages to properly display skill, spell, and damage messages. (thanks Tink)
[Jun 28 2008] - Rumble
Added player ability to cancel queued commands. i.e. player spammed kick while fighting but needs to flee so they type '--' to cancel so they can flee. (thanks Jamdog)
[Jun 28 2008] - Fizban
Merged Jamdog's moblist code into the pre-existing mlist command. (thanks Jamdog)
[Jun 14 2008] - Rumble
Made immortals immune to blinding.
Fixed bug in qedit where quest completion would try to load an object with vnum NOTHING. (thanks Jamdog)
Fixed log when builder tries to edit a zone without permission.
[Jun 12 2008] - Rumble
Fixed toggle quest to toggle correctly.
Fixed bug in dg find_replacement to call text_processed at the beginning, regardless of whether something matching the variable is found or not. (thanks Laoris)
Fixed log error that was using rnum instead of vnum. (thanks Jamdog)
[Jun 11 2008] - Rumble
Added notification via prompt for new MOTD and news entries. (thanks Jamdog)
Added all option to the restore command. (thanks Jamdog)
Added new trigger variable hasattached. (thanks Fizban)
[Jun 10 2008] - Rumble
Added spec proc type under stat. (thanks Jamdog)
Only allow immortals to talk while invis and be displayed as "someone." (thanks Frenze)
[May 27 2008] - Rumble
Fixed list_obj_to_char from only checking invisibility on first object of the same vnum. (thanks Laoris)
Added object stacking when looking at a character's inventory. (thanks Jamdog)
[May 22 2008] - Rumble
Added zone name to where command. (thanks Jamdog)
[May 21 2008] - Rumble
Rewrite of void script_vlog to prevent possible crash bug on some OS's. (thanks Jamdog)
[May 17 2008] - Rumble
Fixed a possible crash bug in qedit. (thanks Jamdog)
Bug fix: Page command was paging when the character was not found and sending a NOPERSON message when he was found.
[May 15 2008] - Rumble
Fixed a bug where deleting the last quest in qedit caused a crash. (thanks Jamdog)
Updated autorun to fix a random syslog numbering bug. (thanks Zizazat)
[May 10 2008] - Rumble
Fixed another typo, added a check for !NPC do_gen_comm, and changed do_return to only run autowiz if level changes. (thanks Fizban)
[May 08 2008] - Rumble
Cleaned up numerous warnings found by adding -Wextra -Wcast-qual -Wshadow -Wno-unused flags.
[May 05 2008] - Rumble
Changed command do_list_llog_entries to normal function, it was not being used as a command. (thanks Rhade)
Removed several useless if checks. (thanks Elanthis)
Fixed zmalloc to work on 64 bit machines.
[May 04 2008] - Rumble
Fixed numerous warnings for gcc -g -O2 -W -Wshadow -Wcast-qual flags.
Fixed zpurge mudlog to use zone vnum not rnum. (thanks Jamdog)
Fix to parse_mobile conversion to 128 bits. (thanks Jamdog)
Changed autorun.sh from 9091 to 4000. (thanks John Smith)
[Apr 27 2008] - Rumble
Removed some defunct gemote code. (thanks Fizban)
[Apr 26 2008] - Rumble
Added README.BSD. (thanks Blix)
Cleaned up act.comm.c, mobs can now use comm channels. (thanks Rhade)
My turn for a vacation, I'll be gone for one week. Checking in occasionally. As usual email myself and Welcor if there are any problems with the server or the game is down. Shamra is in charge with Fizban and Tink to back him up when he is not around. Have a good week everyone. tbaMUD 3.57 will be coming in August.
This question came up again so here is an incomplete list of differences between stock CircleMUD 3.1 and tbaMUD: http://www.tbamud.com/files/changelog.txt
Thanks to Tink from Astoria for pointing out that spell messages were not working properly. Corrected messages file attached below. It turns out I did a find and replace (sed) to get rid of several ^M's leftover from MSDOS formatting. It also stripped the required M prior to every block of messages.
I just wanted to take the time to welcome Astoria on to the tbaMUD band wagon. Jamdog is a major contributor to the tbaMUD codebase. Tink and Detta have been helping builders for years on TBA. I am looking forward to our continued joint ventures!
tbaMUD's:
The Builder Academy
CrackWhip
Paragon
AderonMud
Azereth
Dragonball Fate
Smallville Untold Stories
Dragonball Awakening
Sermon MUD
Twilight's Failings
Let me know what tbaMUD's I missed.
The Mudconnector recently added the tbaMUD codebase to its list of MUD codebases. Those of you using tbaMUD can now update your TMC listing to show the proper codebase.
Jamdog added an excellent patch here for those wanting to add more directions to tbaMUD.
http://cwg.lazuras.org/modules.php?name=Forums&file=viewtopic&t=2108
I have granted SVN write access to a select few trusted individuals and wish to post the ground rules here so there is no confusion about what is to be expected.
First we have standardized our commenting and format of files per Jeremy's post so please follow them:
http://www.tbamud.com/content/source-code-documentation-project
To checkout the SVN:
svn checkout http://tbamud.com/svn/circlemud/circlemud tbamud
When ready to make a change to the codebase always do an "svn update" prior to your modifications and to decrease the possibilities of conflicts run an "svn commit """ or "svn commit --file " as soon after as possible. Now any change you make in game be sure to test and then comment the details in the changelog via the in game command "changelog " then copy and paste the same text into a commit or a file to commit. All changes must be described in detail to prevent confusion. I will be checking all changes by looking at the different revisions. i.e. "svn diff -96:97" to see what was done.
If there are any questions don't hesitate to ask. The great part about SVN is we can easily track all changes and revert them if necessary.
If you have already contributed heavily to tbaMUD and desire SVN access please contact me on TBA.