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 ➜ lower case parsing in exit desc -- need expert opinion

lower case parsing in exit desc -- need expert opinion

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


Pages: 1  2 

Posted by Klered   (24 posts)  Bio
Date Reply #15 on Mon 24 Jan 2005 09:11 PM (UTC)
Message
Yep - found it =)
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #16 on Tue 25 Jan 2005 06:53 AM (UTC)
Message
Looks pretty good! I'm a little worried though about this little bit:
ch_printf(ch, "You open the %s.\n\r", pexit->keyword[0] != '\0' ? pexit->keyword : "door");
sprintf( buf, "%s opens the %s.\n\r", ch->name, pexit->keyword[0] != '\0' ? pexit->keyword : "door");
(And of course the analogous bit in do_close.)

My worry is that if pexit->keyword is null, this might cause a crash. But it's possible that to get to this stage in the code, one has already verified that pexit->keyword is in fact not null, so maybe this isn't a problem.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

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

Posted by Klered   (24 posts)  Bio
Date Reply #17 on Tue 25 Jan 2005 10:00 PM (UTC)

Amended on Tue 25 Jan 2005 10:26 PM (UTC) by Klered

Message
Ksilyan - I can't tell you if it will ever be NULL - Im not that good a programmer. But what I can tell you is that I have rooms that do not have doors, and I create a door but leave the exit desc keyword blank - and I do not crash. I have tried several renditions. Further - I borrowed this - from do_rstat.

pexit->keyword[0] != '\0' ? pexit->keyword : "door"



Its interesting that the further I get into this - the more I discover - like the act(buf,_ ) statements reveal the (ch) even though you might be wizinvis - etc

so - I had to make a basic change -


       /*act(AT_PLAIN, "$n opens the $d.", ch, NULL, pexit->keyword, TO_ROOM);*/
       /*act(AT_PLAIN, "You open the $d.", ch, NULL, pexit->keyword, TO_CHAR);*/
        /* New Support for Capital Letters in Exit Descriptions */
        /* Provided by Klered of Perished Lands Mud. */
        /* Special thanks to Gammon Software Solutions Forum. */
       ch_printf(ch, "You open the %s.\n\r", pexit->keyword[0] != '\0' ? pexit->keyword : "door");
   
         if((IS_AFFECTED(ch, AFF_HIDE))  ||   
         (IS_AFFECTED(ch, AFF_SNEAK))    ||
         (IS_AFFECTED(ch, AFF_INVISIBLE))||
         (xIS_SET(ch->act, PLR_WIZINVIS)))
                {
      sprintf( buf, "Someone opens the %s.\n\r", pexit->keyword[0] != '\0' ? pexit->keyword : "door");
      act( AT_ACTION, buf, ch, NULL, NULL, TO_ROOM );
                }
                else
                {
       sprintf( buf, "%s opens the %s.\n\r", ch->name, pexit->keyword[0] != '\0' ? pexit->keyword : "door");
       act( AT_ACTION, buf, ch, NULL, NULL, TO_ROOM );
                }
       /*end new support*/




Now that works ok - but it doesn't check the people in the room yet to see if someone in the room is affected with True Sight - or Detect Invis, Sneak, etc.

The idea would be to keep it as normal as possible.

I promise I will post the finished product in snippet form soon =)

Mike
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #18 on Tue 25 Jan 2005 10:23 PM (UTC)
Message
Small problem with just making it say someone- what if they are invis but you can see invis? Or if its an imm and they are wizinvis, but a lower level than yourself, you won't see their name. There is a function called can_see that should really help with those checks.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by Klered   (24 posts)  Bio
Date Reply #19 on Tue 25 Jan 2005 10:27 PM (UTC)
Message
Greven why didn't I think of that - I can_see your point! =)
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.


71,982 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

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.