languages!

Posted by Mopop on Thu 02 Feb 2006 02:17 AM — 22 posts, 78,896 views.

#0
Hi I removed something where it said all races know common. I do not want all races to know common! Whenever they start the mud they speak common off the bat. I want them to speak the language I have set for them.
See it doesnt even give them thier language at all!

<22hp 100m 110mv> prac
(none)
----------------------------------Skills----------------------------------
(none)
----------------------------------Weapons----------------------------------
(none)
----------------------------------Tongues----------------------------------
You have 2 practice sessions left.

but they do have thier language

<20hp 100m 100mv> lang
mithra

Another strange problem is... well I'll show you.

<20hp 100m 100mv> lang
mithra

speak moomba
You now speak moomba.

<22hp 100m 110mv> lang
mithra

They dont even know the language! Yet they can select it >_<;;; I tried my best to assert the problem before asking for you guys knowledge =P As always I thank you
USA #1
The problem is that common isn't really set up as a language, if I remember correctly. The notion of common is so built into the game, I'm not sure if getting rid of it is a simple matter of removing some stuff.

Just what did you remove? Without knowing what you've done, it's hard to know what could be wrong. :)
#2

/*
    * everyone KNOWS common tongue 
    */
   if( IS_SET( language, LANG_COMMON ) )
      return 100;

  if( ( iLang = skill_lookup( "common" ) ) < 0 )
               bug( "%s", "Nanny: cannot find common language." );
            else
               ch->pcdata->learned[iLang] = 100;


I removed those 2 bits there, I also removed the clan language as well...Dont know if that might mess with anything or not! I dont think it did but yeah.
USA #3
Where do those come from?
#4
first one is act_comm.c

second is comm.c
USA #5
I meant, if you could provide a little more context, that would be useful. It's hard to know what the effect of removing lines of code is, if you don't know what they were originally meant to do.

And are you sure that's all you removed?
#6
Well I removed everything for LANG_CLAN but how would that mess with I guess is do_speak and nanny setting racial languages?
USA #7
It'd help if you listed precisely what you did -- you never know... :)
#8
Well I dont really remember all I removed dealing with LANG_CLAN...

If you could just pin point it maybe? pretty please? Like a diagnostic of where the problem may lie? I am learning so bear with me, I am still reading up lessons online. But I am trying to give it my all heh.
USA #9
Err... how am I supposed to just pin-point where the problem is? :P

Let me make an analogy. You've just bought a very complex car, and are starting to tinker with it to make custom modifications. You do something, and the car stops working. You come to me with the question:
"I did something to the engine, now it's not working anymore. Why not?"

Surely you don't expect me to be able to answer without knowing more about the problem? I'm not being deliberately obtuse in any of this. I honestly have no idea why your code isn't working, and that's why I've been trying to get you to tell me what you've done so that maybe something will shed light on the issue.

At the moment, the problem could be virtually anywhere in between the interpreter and the language functions, passing through nanny and character creation, and the skill system and skill tree. Telling you that is like telling you that the problem lies somewhere in your code.
#10
Well then...I showed you what I removed for common. As I said over again I removed everything with LANG_CLAN did I do it right? I have no clue...I heard about using something called CVS to keep track of what you edited. Is there a way to use it on Cygwin? But I will show you where I think the problem may lie.

This is the part of nanny that says its suppose to give it thier racial language and set it to 100

ch->height =
               number_range( ( int )( race_table[ch->race]->height * .9 ), ( int )( race_table[ch->race]->height * 1.1 ) );
            ch->weight =
               number_range( ( int )( race_table[ch->race]->weight * .9 ), ( int )( race_table[ch->race]->weight * 1.1 ) );

            if( ch->Class == CLASS_PALADIN )
               ch->alignment = 1000;

            /* Give them their racial languages */
            if( race_table[ch->race] )
            {
               for( iLang = 0; lang_array[iLang] != LANG_UNKNOWN; iLang++ )
               {
                  if( IS_SET( race_table[ch->race]->language, 1 << iLang ) )
                   {
                     if( ( uLang = skill_lookup( lang_names[iLang] ) ) < 0 )
                        bug( "%s: cannot find racial language [%s].", __FUNCTION__, lang_names[iLang] );
                     else
                        ch->pcdata->learned[uLang] = 100;
                  }
               }
            }


And here is my do_speak


void do_speak( CHAR_DATA * ch, char *argument )
{
   int langs;
   char arg[MAX_INPUT_LENGTH];

   argument = one_argument( argument, arg );

   if( !str_cmp( arg, "all" ) && IS_IMMORTAL( ch ) )
   {
      set_char_color( AT_SAY, ch );
      send_to_char( "Now speaking all languages.\r\n", ch );
      return;
   }
   for( langs = 0; lang_array[langs] != LANG_UNKNOWN; langs++ )
      if( !str_prefix( arg, lang_names[langs] ) )
        {
             if( knows_language( ch, lang_array[langs], ch ) )
            ch->speaking = lang_array[langs];
            set_char_color( AT_SAY, ch );
            ch_printf( ch, "You now speak %s.\r\n", lang_names[langs] );
            return;
         }
   set_char_color( AT_SAY, ch );
   send_to_char( "You do not know that language.\r\n", ch );
}


If there is anything else you need to see let me know. I'm trying my best here lol.
USA #11
I don't know if this is The Problem, but it's probably wrong. From do_speak:
             if( knows_language( ch, lang_array[langs], ch ) )
            ch->speaking = lang_array[langs];
            set_char_color( AT_SAY, ch );
            ch_printf( ch, "You now speak %s.\r\n", lang_names[langs] );
            return;
You probably want a { after the if, and a } after the return.

Otherwise, you will tell the player they're speaking a language, even if they're really not. It looks like you moved around the braces, because the SMAUG source I'm looking at has them correctly.


When the speaking-all case, you did not want to remove ch->speaking = ~LANG_CLAN. That means: ch->speaking = everything but clan.

I know you're learning and all that but maybe you should try starting with something simpler. Since you're not carefully writing down EXACTLY what you changed, you will have a hard time undoing your changes in case you need to. It is possible to use CVS on Cygwin; there is plenty of documentation on how to do that lying around. It's probably overkill at your stage, though.

What you need is to either comment exactly what you do, or to keep original source files around and diff them against your versions.

But, to go back to what I was saying: it'll be a much more rewarding experience for you if you start with something simpler. Learn how the code works, learn what things mean before you start yanking things out and ripping functions apart. It'll be a lot more fun for you, and you'll learn better and a lot faster.
#12
Awesome it worked! I hate braces x_x

I must of over looked it when I was comparing the stock code.

Now with the creation of a new character? How would I have it so they get their racial language at the start??
USA #13
What happens at creation? Do you get a bug message, or...? In other words: how, precisely, do you know that it's not working?
#14
Well at creation there is no bug, but they are set to speak common. Yet they do not know common. Once they go to thier racial language, they cannot go back to speak common. So somewhere at creation is is setting chars to speak common.
USA #15
I think that setting a character to speaking=0 sets them to common. I believe that characters are set to speaking=0 on character creation, which is in the function init_char or something like that.

Basically, when you set their language to 100, you also want to set their speaking field to that same language.
#16
ugh I greped that and speaking, I looked over comm.c and act_comm.c I dont know where this would be located exactly. Do you know :(? I tried ;_;
USA #17
Where what is? The racial language is set to 100 in the very lines of code you showed me.
USA #18
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=1945

This topic may help even though its geared for SWR. If you wish to remove/add a language successfully it will point you to the right files to edit.

Keep in mind you need to create/delete the skill in order for it to work as well.
#19
Ok well I added this back in at comm.c

if( ( iLang = skill_lookup( "common" ) ) < 0 )
               bug( "%s", "Nanny: cannot find common language." );
            else
               ch->pcdata->learned[iLang] = 100;


When I made a new char common was highlighted. What I want to happen is thier racial language to be highlighted. And common not to even exsist unless they learn it. Its not showing up on prac also, unless you are an imm I even went into skill.dat and changed all the levels to 1.
USA #20
Oookkk... tell me then what needs to happen for the character to be speaking their racial language. What data field needs to be set? By now you should have that understanding, and if you don't, you need to do your homework and figure it out. You're doing things hard enough that it's not enough to just go in hacking and slashing and hoping for the best. :)
#21
I guess I need to do my homework cause I am not sure ;_;