Author Topic: Color code issues  (Read 3825 times)

Offline Astrum

  • Acquaintance
  • *
  • Posts: 6
    • View Profile
Color code issues
« on: July 17, 2007, 10:07:36 pm »
I've been experiencing the following bug with an item using extensive use of colors in the SetShort:

You clone Rainbow sword (/realms/astrum/rs.c).

From inventory:
RANBOW sword

You drop Rainbow sword.

In room with no items:
RANBOW sword

In room with items that appear in look before the sword:
A weapons rack, Rainbow sword, and a blackjack table are here.

Wield and unwield give the correct Short and our combat gives an uncolored name (not sure if that is default DS as combat has been modified).

You prick Horse superficially in the torso with your rainbow sword.

Here is the code for the item:


#include <lib.h>
#include <damage_types.h>
#include <vendor_types.h>

inherit LIB_ITEM;

static void create() {
    item::create();
    SetKeyName("rainbow sword");
    SetId( ({ "sword", "rainbow sword"  }) );
    SetAdjectives( ({ "rainbow" }) );
    SetShort("%^BOLD%^%^RED%^R%^RESET%^%^ORANGE%^a"
      "%^RESET%^%^BOLD%^%^YELLOW%^i%^RESET%^n%^BOLD%^"
  "%^BLUE%^b%^RESET%^%^BOLD%^%^GREEN%^o%^RESET%^%^BOLD%^"
      "%^MAGENTA%^w%^RESET%^ sword");
    SetLong("A magical looking sword made of some unknown "
      "material that is rainbow colored.");
    SetMass(100);
    SetBaseCost(25);
    SetDamagePoints(500);
    SetVendorType(VT_WEAPON);
    SetClass(20);
    SetDamageType(BLADE);
    SetWeaponType("blade");
    SetHands(2);
}


Offline cecilkilmer

  • Acquaintance
  • *
  • Posts: 24
    • View Profile
    • Minerva
Re: Color code issues
« Reply #1 on: July 17, 2007, 10:44:27 pm »
Not sure about the multiple items in the room, but for combat, I think it uses the keyname for the weapon in combat and not the short name.  Granted, this is based on observations of another MUD that was based on Nightmare 3, I haven't looked at the combat code here to be sure, but if it's not showing color, that'd be my guess.

Offline cratylus

  • Your favorite and best
  • Administrator
  • ***
  • Posts: 1024
  • Cratylus@Dead Souls <ds> np
    • View Profile
    • About Cratylus
Re: Color code issues
« Reply #2 on: July 17, 2007, 10:53:23 pm »
Quote
I think it uses the keyname for the weapon in combat and not the short name.

That is exactly what is happening.

-Crat

Offline Astrum

  • Acquaintance
  • *
  • Posts: 6
    • View Profile
Re: Color code issues
« Reply #3 on: July 18, 2007, 01:29:29 am »
Right, but that is not a problem for me (yet anyways ;). My issue is the capitalization and the missing character in the SetShort when using ansi.

Offline cecilkilmer

  • Acquaintance
  • *
  • Posts: 24
    • View Profile
    • Minerva
Re: Color code issues
« Reply #4 on: July 18, 2007, 09:19:46 am »
First of all, it helps if you state what the problem is rather than expecting us to determine it based on what you showed for code and the room descs, etc.  I didn't bother looking through your color codes to see that it was not all capitalized, so I thought the problem was that in combat it was showing up without caps and that was the problem. :)

I'm at work right now, but I'll look at this when I get home (I'm seeing the same thing when I copy this code on my mudlib).

PS: If you're using ansi terminal settings, you don't need to bold yellow, yellow is a bold version of orange.

Offline cecilkilmer

  • Acquaintance
  • *
  • Posts: 24
    • View Profile
    • Minerva
Re: Color code issues
« Reply #5 on: July 18, 2007, 12:15:05 pm »
So I lied, I took a look over lunch. :)  Add the letter "A" to the beginning of the short description where it reads: A Rainbow sword

And your problems will be fixed.  Really, anything added to the beginning should fix it.  When in your inventory, it's trying to capitalize the first letter, and since the first letter is %, it has issues (same with pluralizing it, and drawing it on the ground, it's trying to capitalize the first letter).  Renaming it to "shining Rainbow sword" worked too for me.

Cecil

Offline Astrum

  • Acquaintance
  • *
  • Posts: 6
    • View Profile
Re: Color code issues
« Reply #6 on: July 18, 2007, 01:07:17 pm »
That is helpful thanks. I can't think of any reason to not use a or the in the SetShort, so that resolves the issue. As far as stating the problem clearly I thought the difference between Rainbow and RANBOW would be noticable.

Offline cecilkilmer

  • Acquaintance
  • *
  • Posts: 24
    • View Profile
    • Minerva
Re: Color code issues
« Reply #7 on: July 18, 2007, 01:33:04 pm »
That assumes I (or anyone else) takes the time to fully read it. :)