Author Topic: eventDisplayStatus x12  (Read 3105 times)

Offline detah

  • BFF
  • ***
  • Posts: 190
  • Ruler of 2D
    • View Profile
eventDisplayStatus x12
« on: September 15, 2006, 08:56:38 pm »
I am trying to extract the limb system and convert to a single hp system.

I tried extracting the limbs first and broke the mud numerous times. Therefore Ive changed strategies. Im now trying to convert to a single hp system with the limbs still there. Then after that succeeds, I will remove the limbs.

The first thing I did was Replace every "HealthPoints" with "HP" in all 24 relevant files where HealthPoints occurs.

There are 3 spots where this Replace is relevant.

AddHealthPoints() in

lib/player.c L779

AddHealthPoints() in

lib/body.c L1411

AddHP() in

lib/body.c L1681

Believe it or not, this was largely successful.

I still receive damage to my limbs, but there are no loading errors and I take damage normally.

The Problem:

Every tick, I see my 'status' 12 times.

Normally you will see this once because of the second to last line in:

lib/player.c L779

varargs static int AddHealthPoints(int x, string limb, object agent) {

    int hp, ret, undead;

    hp = GetHealthPoints();

    undead = GetUndead();

    ret = living::AddHealthPoints(x, limb, agent);     //this calls lib/body.c L1411

    if( hp <= (hp = GetHealthPoints()) || undead != GetUndead() ) return ret;


    return ret;


This code really has very little to do with anything important, except the eventDisplayStatus() part. So I have commented out this function. And put the eventDisplayStatus() line in the body.c AddHealthPoints() section.

Moreover, I have commented out the tiny little function AddHP() section in body.c. This was:

    int AddHP(int hp){


   return hp;


As you can see, this just calls the body.c AddHealthPoints code. So my goal is to direct all AddHP queries to AddHealthPoints (which is now renamed AddHP).  Since everything that was calling AddHealthPoints is now renamed to AddHP, it is in fact being directed to the right place.

So to summarize, the only AddHP which is not commented out is the original AddHealthPoints in body.c, but that has been renamed AddHP. So there is now only one things left, AddHP in body.c.

I put eventDisplayStatus() in the (newly renamed) AddHP section. I tried moving it around and putting it in various if configs. nothing stops the 12 occurances. Im still seeing my status displayed 12 times per tick.

Here is my most recent failed attempt:


    varargs int AddHP(int x, string limb, object agent) {
   int y = 0;

if(GetHP() < GetMaxHP()) {
return HP;

   if( limb ) {
       if( !Limbs[limb] ) return -1;
       y = GetMaxHP(limb);
       if(y < 1) return y;
       if((Limbs[limb]["health"] += x) < 1) Limbs[limb]["health"] = 0;
       else if(Limbs[limb]["health"] > y)
      Limbs[limb]["health"] = y;
       return Limbs[limb]["health"];

that first if statement there is mine. As well as the commented out line. All combinations still lead to 12 statuses being shown. I believe I am getting this error because something is calling body.c (or player.c as the case may be) 12 times. Any thoughts on how to make it display status just 1 time? or why body.c gets called 12 times per tick? Is this normal?

Offline saquivor

  • BFF
  • ***
  • Posts: 111
    • View Profile
eventDisplayStatus x12
« Reply #1 on: September 17, 2006, 12:36:50 am »
I thought I had found one possible reason related to the number of limbs but eval return sizeof(this_player()->GetLimbs()); gives 11 not 12. Still it may have something to do with the number of limbs?

Offline capo

  • Friend
  • **
  • Posts: 70
    • View Profile
eventDisplayStatus x12
« Reply #2 on: September 17, 2006, 05:27:20 am »

11 limbs = eventDisplayStatus for each


1 eventdisplay for combat