Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Adding New Attributes

Adding New Attributes

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Harlaquin   (16 posts)  Bio
Date Fri 15 Oct 2004 06:10 AM (UTC)
Message
Having trouble locating all the nessary places i need to add the new attribute to. I know some places are obvious but if there's something that could point me in a better more concreate direction that'd be sweet.

-Mirrodan/Harlaquin
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #1 on Mon 18 Oct 2004 07:33 AM (UTC)
Message
What do you mean by attribute?

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Mirrodan   USA  (28 posts)  Bio
Date Reply #2 on Mon 18 Oct 2004 02:11 PM (UTC)
Message
by new attribute i'm reffering to str/con/dex etc.

-Mirrodan

also anyone have any input on how to get do look to show the vnum properly in a list ? I've got to show the object vnum but if there's multiple objects in your inventory it places all the vnums off to the top the lists the objects.


Admin and Head Coder
For Techno-Magicka
techno-magicka.dreasphere.org 4000
AIM: tchnmgck
MSN: newell_everett@hotmail.com
YAHOO: everettnewell
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #3 on Mon 18 Oct 2004 03:58 PM (UTC)
Message
Basically, just add the variable to mud.h in the char_data struct, and then in fwrite_char and fread_char in save.c, you may need to add get_curr_<newstat> function in handler.c, just in case.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #4 on Tue 19 Oct 2004 08:24 AM (UTC)
Message
What Zeno said is correct. The get_curr_* functions are for ensuring that the values are 'sane' e.g. within allowed limits.

As for your second question you'll have to be a bit more precise about what you've done, what it does and what you need it to do. :)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Mirrodan   USA  (28 posts)  Bio
Date Reply #5 on Tue 19 Oct 2004 08:56 AM (UTC)
Message
Thanks sorry i'm a noob with grand ideas when it comes to coding..
I just want it to show an imm the objects vnum when they look i.e. type inventory or look into a room.




Admin and Head Coder
For Techno-Magicka
techno-magicka.dreasphere.org 4000
AIM: tchnmgck
MSN: newell_everett@hotmail.com
YAHOO: everettnewell
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #6 on Tue 19 Oct 2004 09:49 AM (UTC)
Message
OK. So you said you did something and it doesn't work - what did you do and how does it not work?

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Mirrodan   USA  (28 posts)  Bio
Date Reply #7 on Tue 19 Oct 2004 10:07 AM (UTC)
Message
I added this to char *format_obj_to_char( OBJ_DATA *obj, CHAR_DATA *ch, bool fShort )

under the local functions in act_info.c

if( !IS_NPC(ch) && IS_IMMORTAL(ch) ) // helpmeiamlost
{
ch_printf( ch, "&Y(Ovnum %d)", obj->pIndexData->vnum );
}

I figured it'd show me the vnum of the object and it does but, if the object is in your inventory and you've got 2 different objects i.e. ones that wont combine. the vnums are displayed at the top of the inventory to the left and the objects are pused down towards the right.

-mirro

Admin and Head Coder
For Techno-Magicka
techno-magicka.dreasphere.org 4000
AIM: tchnmgck
MSN: newell_everett@hotmail.com
YAHOO: everettnewell
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #8 on Tue 19 Oct 2004 09:18 PM (UTC)
Message
Could you show me what it does? And the whole function for format_obj_to_char, so that I know what we're working with.

Also could you please format it using the [code] forum tag? Proper indents make it so much easier to follow. :)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Mirrodan   USA  (28 posts)  Bio
Date Reply #9 on Tue 19 Oct 2004 09:42 PM (UTC)
Message
This is how it looks within someone's inventory ......

You are carrying:
(Ovnum 103)(Ovnum 10333) The key to %s's house.
The Adventurer's Guide(3)

and when some one just looks

(Ovnum 100)(Ovnum 10333)The Immortal Update and Note Board
A book with "DON'T PANIC, LOOK AT ME!" written on the cover lies here.(2)

the code in act_info i moded is below....


char *format_obj_to_char( OBJ_DATA *obj, CHAR_DATA *ch, bool fShort )
{
    static char buf[MAX_STRING_LENGTH];
    bool glowsee = FALSE;

    /* can see glowing invis items in the dark */
    if ( IS_OBJ_STAT(obj, ITEM_GLOW) && IS_OBJ_STAT(obj, ITEM_INVIS)
    &&  !IS_AFFECTED(ch, AFF_TRUESIGHT) && !IS_AFFECTED(ch, AFF_DETECT_INVIS) )
	glowsee = TRUE;

    buf[0] = '\0';
    if ( IS_OBJ_STAT(obj, ITEM_INVIS)     )   strcat( buf, "(Invis) "     );
    if (  (IS_AFFECTED(ch, AFF_DETECT_EVIL) || ch->class==CLASS_PALADIN)
	 && IS_OBJ_STAT(obj, ITEM_EVIL)   )   strcat( buf, "(Red Aura) "  );
   if( !IS_NPC(ch) && IS_IMMORTAL(ch) ) // helpmeiamlost
	 {
		 ch_printf( ch, "&Y(Ovnum %d)", obj->pIndexData->vnum );
     }
    if ( ch->class==CLASS_PALADIN
	 && ( IS_OBJ_STAT(obj, ITEM_ANTI_EVIL) && !IS_OBJ_STAT(obj, ITEM_ANTI_NEUTRAL) && !IS_OBJ_STAT(obj, ITEM_ANTI_GOOD))   )
          strcat( buf, "(Flaming Red) "  );
    if ( ch->class==CLASS_PALADIN
	 && ( !IS_OBJ_STAT(obj, ITEM_ANTI_EVIL) && IS_OBJ_STAT(obj, ITEM_ANTI_NEUTRAL) && !IS_OBJ_STAT(obj, ITEM_ANTI_GOOD))   )
          strcat( buf, "(Flaming Grey) "  );
    if ( ch->class==CLASS_PALADIN
	 && (!IS_OBJ_STAT(obj, ITEM_ANTI_EVIL) && !IS_OBJ_STAT(obj, ITEM_ANTI_NEUTRAL) && IS_OBJ_STAT(obj, ITEM_ANTI_GOOD))   )
          strcat( buf, "(Flaming White) "  );


    if ( ch->class==CLASS_PALADIN
	 && ( IS_OBJ_STAT(obj, ITEM_ANTI_EVIL) && IS_OBJ_STAT(obj, ITEM_ANTI_NEUTRAL) && !IS_OBJ_STAT(obj, ITEM_ANTI_GOOD))   )
          strcat( buf, "(Smouldering Red-Grey) "  );
    if ( ch->class==CLASS_PALADIN
	 && ( IS_OBJ_STAT(obj, ITEM_ANTI_EVIL) && !IS_OBJ_STAT(obj, ITEM_ANTI_NEUTRAL) && IS_OBJ_STAT(obj, ITEM_ANTI_GOOD))   )
          strcat( buf, "(Smouldering Red-White) "  );
    if ( ch->class==CLASS_PALADIN
	 && ( !IS_OBJ_STAT(obj, ITEM_ANTI_EVIL) && IS_OBJ_STAT(obj, ITEM_ANTI_NEUTRAL) && IS_OBJ_STAT(obj, ITEM_ANTI_GOOD))   )
          strcat( buf, "(Smouldering Grey-White) "  );

    if ( IS_AFFECTED(ch, AFF_DETECT_MAGIC)
	 && IS_OBJ_STAT(obj, ITEM_MAGIC)  )   strcat( buf, "(Magical) "   );
    if ( !glowsee && IS_OBJ_STAT(obj, ITEM_GLOW) )   strcat( buf, "(Glowing) "   );
    if ( IS_OBJ_STAT(obj, ITEM_HUM)       )   strcat( buf, "(Humming) "   );
    if ( IS_OBJ_STAT(obj, ITEM_HIDDEN)	  )   strcat( buf, "(Hidden) "	  );
    if ( IS_OBJ_STAT(obj, ITEM_BURIED)	  )   strcat( buf, "(Buried) "	  );
    if ( IS_IMMORTAL(ch)
	 && IS_OBJ_STAT(obj, ITEM_PROTOTYPE) ) strcat( buf, "(PROTO) "	  );
    if ( IS_AFFECTED(ch, AFF_DETECTTRAPS)
	 && is_trapped(obj)   )   strcat( buf, "(Trap) "  );

    if ( fShort )
    {
	if ( glowsee && !IS_IMMORTAL(ch) )
	    strcat( buf, "the faint glow of something" );
	else
	if ( obj->short_descr )
	    strcat( buf, obj->short_descr );
    }
    else
    {
	if ( glowsee )
	    strcat( buf, "You see the faint glow of something nearby." );
	if ( obj->description )
	    strcat( buf, obj->description );
    }

    return buf;
}


Thanks for all the help

Admin and Head Coder
For Techno-Magicka
techno-magicka.dreasphere.org 4000
AIM: tchnmgck
MSN: newell_everett@hotmail.com
YAHOO: everettnewell
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #10 on Tue 19 Oct 2004 10:03 PM (UTC)
Message
OK, here's the problem. Note that the other commands are appending to a buffer, but you directly print to the character.


if (  (IS_AFFECTED(ch, AFF_DETECT_EVIL) ||
      ch->class==CLASS_PALADIN)
      && IS_OBJ_STAT(obj, ITEM_EVIL)   )
    strcat( buf, "(Red Aura) "  );

if( !IS_NPC(ch) && IS_IMMORTAL(ch) ) // helpmeiamlost
{
    ch_printf( ch, "&Y(Ovnum %d)", obj->pIndexData->vnum );
}


See what the difference is? ch_printf sends text directly to the character. But what the other parts do is to append to a buffer, that is later sent all at once to the character.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Mirrodan   USA  (28 posts)  Bio
Date Reply #11 on Tue 19 Oct 2004 10:48 PM (UTC)
Message
Thanks again for all your help didn't realize it was that easy of a fix ...used sprintf instead.

-thank,
Mirrodan


Admin and Head Coder
For Techno-Magicka
techno-magicka.dreasphere.org 4000
AIM: tchnmgck
MSN: newell_everett@hotmail.com
YAHOO: everettnewell
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #12 on Wed 20 Oct 2004 02:46 AM (UTC)
Message
Be careful though, sprintf will overwrite the string if you don't keep it - you actually want to concatenate your vnum to the end of the string.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
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.


28,759 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.