Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
auth_update crash
Dec 23, 2017, 10:15 pm
By Remcon
check_tumble
Dec 18, 2017, 7:21 pm
By Remcon
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, Bing, Yahoo!, Yandex

Members: 0
Guests: 10
Stats
Files
Topics
Posts
Members
Newest Member
478
3,708
19,242
612
Jacki72H
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » General » Coding » $n variables in mob_prog
Forum Rules | Mark all | Recent Posts

$n variables in mob_prog
< Newer Topic :: Older Topic > $n variables in mob_prog

Pages:<< prev 1 next >>
Post is unread #1 Nov 2, 2003, 5:50 am   Last edited Nov 24, 2007, 3:34 pm by Samson
Go to the top of the page
Go to the bottom of the page

Matteo2303
Apprentice
GroupMembers
Posts57
JoinedAug 25, 2003

In smaug 1.4a fuss (but probably in all smaug code) there is a problem in: void mprog_translate( char ch, char *t, CHAR_DATA *mob, CHAR_DATA *actor, OBJ_DATA *obj, void *vo, CHAR_DATA *rndm )
The problem is this: If I write on a mob a fight_prog (for example) that do: "yell Grr! $n is a thief!", and the mob can't see $n, the variable $n not became "someone"... but put a blank space.
I change the original code like below:
    case 'n':
        if ( actor && !char_died(actor) )
{
      if ( can_see( mob,actor ) )
           one_argument( actor->name, t );
          else                               // <-add
          { strcpy( t, "someone" );   // <-add
           break;                            // <-add
          }                                   // <-add
          if ( !IS_NPC( actor ) )
             *t = UPPER( *t );
        }
else
     strcpy( t, "someone" );
break;


Is it ok my add or..?
Bye
matteo
       
Post is unread #2 Nov 2, 2003, 6:40 am   Last edited Nov 24, 2007, 3:35 pm by Samson
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

This does indeed appear to be a bug. Your solution was close - here's what you need:

     case 'n':
       if ( actor && !char_died(actor) )
	 {
	   if ( can_see( mob,actor, FALSE ) )
	     one_argument( actor->name, t );
         else
           strcpy( t, "someone" );
         if ( !IS_NPC( actor ) )
  	     *t = UPPER( *t );
       }
	 else
	   strcpy( t, "someone" );
       break;
       
Post is unread #3 Nov 2, 2003, 10:26 am
Go to the top of the page
Go to the bottom of the page

Xorith
The Null Value
GroupAFKMud Team
Posts254
JoinedFeb 23, 2003

I'd also like to note that in *all* code, $n equals the mob's name, which usually just has keywords for the mobile. Perhaps the short description whould be better used? ;)

-- X
       
Pages:<< prev 1 next >>