Re: Adding Character Attributes

From: Ron Hensley (
Date: 08/14/99

Changing someone elses existing code, which is the case with CircleMud, is
all about
using the 'grep' command and studying the code. Over time as you work with
the files you'll
know where everything is.

You know you want to do something to thaco, so first off you want to locate
all references to thaco
  grep -in thaco *.[ch]
Will search for the word thaco in all .c and .h files in the current
directory. Case doesn't matter and the line number of matches will be

class.c and fight.c are the only .c files that use it. Obviously you plan to
remove the calc_thaco calls and replace it with something like
  calc_thaco = GET_THACO(ch);

Thaco is something you plan to store on the character. So you think, what
else is stored on the character and how is it accessed. GET_EXP(ch) is one
you see everywhere and common Circle practice.
  grep GET_EXP *.h
Just look for its actual definition on .h files, not everywhere its actually
  utils.h:322:#define GET_EXP(ch)   ((ch)->points.exp)
So we want to add something in utils.h like
  #define GET_THACO(ch)  ((ch)->points.thaco)

After some digging with grep for points, youll find it in structs.h
  /* Char's points.  Used in char_file_u *DO*NOT*CHANGE* */
struct char_point_data {
So you add your thaco variable to the points structure, noting the warning
it will change the player file and you'll either have to start a new player
file, or re-write the player file loading/saving to account for the new
variable and convert your present player file to the new format.

Coding circle is all about searching for things. Just about anything you can
imagine is already in there, or at least the building blocks are. New spell,
look at everything related to an existing spell. New variable, look at
everything about some variable just like the one you want to add. etc.

Dont forget to locate wherever things like exp get initilized for new
players and add a bit to initialize your thaco.

Ron Hensley  (
Network Administrator - ICNet Internet Services

----- Original Message -----
From: Doyle Tracy <>
To: <>
Sent: Saturday, August 14, 1999 11:31 AM
Subject:  Adding Character Attributes

> Hi everyone,
> I'm new to coding circlemud and I was wondering if there were any docs,
> or if anyone could tell me all the files I need to change to add a new
> character attribute? I'm adding THAC0 to the character so it can just be
> looked up instead of making the thaco function call every round during a
> fight. Has anyone done this yet?
> Thanks,
> Doyle
> Doyle Tracy
> Home:
> Work:
> UIN: 1744184
> AIM: AxlDT
>      +------------------------------------------------------------+
>      | Ensure that you have read the CircleMUD Mailing List FAQ:  |
>      |  |
>      +------------------------------------------------------------+

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  |

This archive was generated by hypermail 2b30 : 12/15/00 PST