http://www.circlemud.org/pub/CircleMUD/ ... ge-ziz.txtI have made a few minor changes to the spoken language snippet credited to
Frollo (
mudaholic@aol.com). Props to anyone else who helped with this code
but is not credited.
The main change in my snippet is that the garble function gets passed the
actual spoken language, which is used to determine the garble letters.
Why would you want that? So that different languages look differently
spoken. I also had a particular need for my MUD to have a binary language,
so the garble letters could only be 0 and 1. Code follows.
Please give me props in your credits file (and Frollo too!)
Note: This code has been updated so it works in the bpl21+ world! Also, it
has been updated to correct a nasty bug where mortals could crash your
game at will!
Additional big ups to:
Brian (
borlick@mines.edu)
Frollo (
mudaholic@aol.com)
Izham Syah Mahrome (
doomvoid@hotmail.com)
Zizazat Lazuras (
zizazat@hotmail.com)
--Ziz
---act.comm.c---
char *languages[] =
{
"common",
"elven",
"demon",
"binary",
"\n"
};
void list_languages(struct char_data *ch)
{
int a = 0, i;
if (SPEAKING(ch) <= MIN_LANGUAGES) {
SET_SKILL(ch, MIN_LANGUAGES, 100);
SPEAKING(ch) = MIN_LANGUAGES;
}
/* Slight hack to avoid core dumping cause no one speaks the
* language after implementation. */
sprintf(buf, "Languages:\r\n");
for (i = MIN_LANGUAGES; i < MAX_LANGUAGES; i++) {
if (GET_SKILL(ch, i) > 60) {
sprintf( buf, "%s%s", buf, a++ != 0 ? "&n, " : "[ " );
strcat( buf, SPEAKING(ch) == i ? "&r" : "&n" );
strcat( buf, languages[i-MIN_LANGUAGES]);
}
}
sprintf(buf, "%s &w]&n\r\n", buf);
send_to_char(ch, buf);
}
ACMD(do_languages)
{
int i, found = FALSE;
one_argument(argument, arg);
if (!*arg)
list_languages(ch);
else {
for (i = MIN_LANGUAGES; i < MAX_LANGUAGES; i++) {
if (search_block(arg, languages, FALSE) == i-MIN_LANGUAGES) && GET_SKILL(ch, i) > 60) {
SPEAKING(ch) = i;
send_to_char(ch, "You now speak %s.\r\n", languages[i-MIN_LANGUAGES]);
found = TRUE;
break;
}
}
if (!found) {
send_to_char(ch, "You do not know of any such language.\r\n");
return;
}
}
}
void garble_text(char *string, int percent, int lang)
{
char letters[12] = "";
/* Always up letters[12] to the largest size for letters you wish to
* use below. */
int i,s;
switch (lang) {
case SKILL_LANG_BINARY:
strcpy (letters, "01");
s=1;
break;
case SKILL_LANG_DEMON:
strcpy (letters, "hprstwxyz");
s=8;
break;
default:
strcpy (letters, "aeiousthpwxyz");
s=12;
break;
}
for (i = 0; i < strlen(string); ++i)
if (isalpha(string[i]) && (number(0, 100) > percent))
string[i] = letters[number(0, s)];
}
/* Replace original do_say with this */
ACMD(do_say)
{
char ibuf[MAX_INPUT_LENGTH];
char obuf[MAX_INPUT_LENGTH];
struct char_data *tch;
skip_spaces(&argument);
if(!*argument) {
send_to_char(ch, "Yes, but WHAT do you want to say?\r\n");
return;
}
strcpy(ibuf, argument); /* preserve original text */
if (!IS_NPC(ch))
garble_text(ibuf, GET_SKILL(ch, SPEAKING(ch)), SPEAKING(ch));
for (tch = world[ch->in_room].people; tch; tch = tch->next_in_room) {
if (tch != ch && AWAKE(tch) && tch->desc) {
strcpy(obuf, ibuf); /* preserve the first garble */
if (!IS_NPC(ch) && !IS_NPC(tch))
garble_text(obuf, GET_SKILL(tch, SPEAKING(ch)), SPEAKING(ch));
if (GET_SKILL(tch, SPEAKING(ch)) < 1)
sprintf(buf, "$n says, in an unfamiliar tongue, '%s'", obuf);
else
sprintf(buf, "$n says '%s'", obuf);
act(buf, TRUE, ch, 0, tch, TO_VICT);
}
}
sprintf(buf, "&cYou say, '%s&c'&n", argument);
act(buf, TRUE, ch, 0, 0, TO_CHAR);
}
---spells.h---
#define SKILL_LANG_COMMON 141
#define SKILL_LANG_ELVEN 142
#define SKILL_LANG_DEMON 143
#define SKILL_LANG_BINARY 144
/* Stock Circle 141 is the next open skill, season to taste. */
#define MIN_LANGUAGES 141
#define MAX_LANGUAGES 145
/* Min must be same value as 1st Language. Max should be one more than
* the last lang. */
---utils.h---
#define SPEAKING(ch) ((ch)->player_specials->saved.speaking)
---structs.h---
You'll need to add speaking to the player_specials->saved.
int spare8; is a good place replace with
int speaking;
If you are using ascii player files, it might also be a good idea to make
mods to db.c and pfdefaults.h so you can save and load the value of
speaking.
src\act.comm.c(682) : error C2039: 'saved' : is not a member of 'player_special_data'
\src\structs.h(1316) : see declaration of 'player_special_data'
\src\act.comm.c(682) : error C2065: 'MIN_LANGUAGES' : undeclared identifier
\src\act.comm.c(683) : error C2065: 'MIN_LANGUAGES' : undeclared identifier
\src\act.comm.c(683) : error C2065: 'MIN_LANGUAGES' : undeclared identifier
\src\act.comm.c(684) : error C2039: 'saved' : is not a member of 'player_special_data'
\src\structs.h(1316) : see declaration of 'player_special_data'
\src\act.comm.c(684) : error C2065: 'MIN_LANGUAGES' : undeclared identifier
\src\act.comm.c(690) : error C2065: 'MIN_LANGUAGES' : undeclared identifier
\src\act.comm.c(690) : error C2065: 'MAX_LANGUAGES' : undeclared identifier
\src\act.comm.c(693) : error C2039: 'saved' : is not a member of 'player_special_data'
\src\structs.h(1316) : see declaration of 'player_special_data'
\src\act.comm.c(693) : error C2198: 'strcat' : too few arguments for call
\src\act.comm.c(694) : error C2065: 'MIN_LANGUAGES' : undeclared identifier
\src\act.comm.c(698) : warning C4133: 'function' : incompatible types - from 'char_data *' to 'const char *'
\src\act.comm.c(698) : warning C4133: 'function' : incompatible types - from 'char [16384]' to 'CHAR_DATA *'
\src\act.comm.c(709) : error C2065: 'MIN_LANGUAGES' : undeclared identifier
\src\act.comm.c(709) : error C2065: 'MAX_LANGUAGES' : undeclared identifier
\src\act.comm.c(710) : error C2065: 'MIN_LANGUAGES' : undeclared identifier
\src\act.comm.c(710) : error C2143: syntax error : missing ';' before '&&'
\src\act.comm.c(712) : warning C4133: 'function' : incompatible types - from 'CHAR_DATA *' to 'const char *'
\src\act.comm.c(712) : warning C4133: 'function' : incompatible types - from 'char [20]' to 'CHAR_DATA *'
\src\act.comm.c(712) : error C2065: 'MIN_LANGUAGES' : undeclared identifier
\src\act.comm.c(712) : warning C4020: 'send_to_char' : too many actual parameters
\src\act.comm.c(718) : warning C4133: 'function' : incompatible types - from 'CHAR_DATA *' to 'const char *'
\src\act.comm.c(718) : warning C4133: 'function' : incompatible types - from 'char [40]' to 'CHAR_DATA *'
\src\act.comm.c(722) : error C2059: syntax error : '}'
\src\act.comm.c(754) : error C2084: function 'void do_say(CHAR_DATA *,char *,int,int)' already has a body
\src\act.comm.c(769) : error C2039: 'saved' : is not a member of 'player_special_data'
\src\structs.h(1316) : see declaration of 'player_special_data'
\src\act.comm.c(769) : error C2039: 'saved' : is not a member of 'player_special_data'
\src\structs.h(1316) : see declaration of 'player_special_data'
\src\act.comm.c(769) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Lyonesse - 22 error(s), 39 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
============================================================================
http://www.circlemud.org/pub/CircleMUD/ ... nguage.txt LANGUAGE CODE
Some notes: I use skill slots to hold language ability, this coincides
very nicely with my learn_by_use code (stripped out of this example).
If you try to use this, you'll need to make the appropriate entries in
spells.h (I use 190+ for langs), also, you'll need to change one of
the spares in the player structure to be "speaking".
Oh, you'll also need some way to toggle what language you're speaking,
you could use a simple do_speak command or something, I'm not finished
putting this all in yet, so I just made an entry in do_set to toggle
the person's current lang like: SPEAKING(vict) = value
Take note that it might also be a good idea to set the characters'
native language to 100% when they begin.
spells.h
#define LANG_COMMON 190
#define LANG_ELVEN 191
#define LANG_DWARVEN 192
#define LANG_TROLLISH 193
#define LANG_HALFLING 194
utils.h
#define SPEAKING(ch) ((ch)->player_specials->saved.speaking)
constants.c
const char *languages[] =
{
"common",
"elven",
"dwarven",
"trollish",
"halfling",
"\n"
};
act.comm.c
void garble_text(char *string, int percent)
{
char letters[] = "aeiousthpwxyz";
int i;
for (i = 0; i < strlen(string); ++i)
if (isalpha(string[i]) && number(0, 1) && number(0, 100) > percent)
string[i] = letters[number(0, 12)];
}
ACMD(do_lang_say)
{
extern char *languages[];
char ibuf[MAX_INPUT_LENGTH];
char obuf[MAX_INPUT_LENGTH];
int ofs = 190; /* offset - should be first language */
struct char_data *tch;
skip_spaces(&argument);
if(!*argument) {
send_to_char("Say what?\r\n", ch);
return;
}
strcpy(ibuf, argument); /* preserve original text */
garble_text(ibuf, GET_SKILL(ch, SPEAKING(ch)));
for (tch = world[ch->in_room].people; tch; tch = tch->next_in_room) {
if (tch != ch && AWAKE(tch) && tch->desc) {
strcpy(obuf, ibuf); /* preserve the first garble */
garble_text(obuf, GET_SKILL(tch, SPEAKING(ch)));
if (GET_SKILL(tch, SPEAKING(ch)) < 1)
sprintf(buf, "$n says, in an unfamiliar tongue,\r\n '%s'", obuf);
else
sprintf(buf, "$n says, in the %s tongue,\r\n '%s'", languages[(SPEAKING(ch) - ofs)], obuf);
act(buf, TRUE, ch, 0, tch, TO_VICT);
}
}
sprintf(buf, "You say, in the %s tongue,\r\n '%s'", languages[(SPEAKING(ch)- ofs)], argument);
act(buf, TRUE, ch, 0, 0, TO_CHAR);
}
One funky thing I see here, is that it appears that the garbled text
changes each time. For example, if I say the words "Hello there Sparky,
you're a dead man!" six times, anyone not speaking my language should see
the same string six times, not 6 different ones. I got around this by
assigning each language an index (Say like 5 10 15 20), and in the garble
text routine, I adjust the ascii value of the character by the index. If
I overrun the range of printable characters, I just wrap around. The
result is that the exact same string appears each time the speaker says
the same phrase. One major benefit of this is that it allows a player to
"learn" and recognize certain phrases in foreign tongues, just as in real
life. Therefore players of different races can have at least minimal
verbal interaction. Of course you can also do an:
> emote says: Hi There!
... But that's not my problem to solve.
------ Build started: Project: Lyonesse, Configuration: Debug Win32 ------
Compiling...
act.comm.c
\src\act.comm.c(697) : error C2039: 'saved' : is not a member of 'player_special_data'
\src\structs.h(1314) : see declaration of 'player_special_data'
act.comm.c(697) : error C2039: 'saved' : is not a member of 'player_special_data'
src\structs.h(1314) : see declaration of 'player_special_data'
\src\act.comm.c(697) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Creating browse information file...
Microsoft Browse Information Maintenance Utility Version 9.00.30729
Copyright (C) Microsoft Corporation. All rights reserved.
BSCMAKE: error BK1506 : cannot open file '.\Debug\act.comm.sbr': No such file or directory
Build log was saved at "file://c:\Users\Debug\BuildLog.htm"
Lyonesse - 4 error(s), 31 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
HO PROVATO A DISABILITARE questi pezzi di codice dove mi dava errore ma con nessuno risultato positivo:(
garble_text(ibuf, GET_SKILL(ch, SPEAKING(ch)));
garble_text(obuf, GET_SKILL(tch, SPEAKING(ch)));
dandomi in piu questi errori che corrispondono alle 4 pezzi di codice che incollo dopo gli errori
\src\act.comm.c(699) : error C2065: 'world' : undeclared identifier
\src\act.comm.c(706) : error C2039: 'saved' : is not a member of 'player_special_data'
\src\structs.h(1314) : see declaration of 'player_special_data'
\src\act.comm.c(706) : error C2039: 'saved' : is not a member of 'player_special_data'
c:\users\src\structs.h(1314) : see declaration of 'player_special_data'
src\act.comm.c(706) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Creating browse information file...
for (tch = world[ch->in_room].people; tch; tch = tch->next_in_room) {
if (GET_SKILL(tch, SPEAKING(ch)) < 1)
===========================================================================
http://www.circlemud.org/pub/CircleMUD/ ... guage2.txtFrom: Frollo <mudaholic@aol.com>
Subject: Another Language Snippet
This is just a language function, incorporates language and stuff into the
normal say, toggle-able and all that stuff.
You may have to change around the colors (&c, &r, etc) -- didn't
feel like taking them out
---act.comm.c---
char *languages[] =
{
"common",
"elven",
"gnomish",
"dwarven",
"\n"
};
void list_languages(struct char_data *ch)
{
int a = 0, i;
sprintf(buf, "Languages:\r\n");
for (i = MIN_LANGUAGES; i < MAX_SKILLS; i++) {
if (GET_SKILL(ch, i) > 60)
sprintf(buf, "%s%s%s%s", buf, a++ != 0 ? "&c, " : "&w[&c ",
SPEAKING(ch) == i ? CCRED(ch, C_NRM) : "", languages[a-1]);
}
sprintf(buf, "%s &w]&n\r\n", buf);
send_to_char(buf, ch);
}
ACMD(do_languages)
{
int i, found = FALSE;
one_argument(argument, arg);
if (!*arg)
list_languages(ch);
else {
for (i = MIN_LANGUAGES; i < MAX_SKILLS; i++) {
if (is_abbrev(arg, languages[i-MIN_LANGUAGES]) && GET_SKILL(ch, i) > 60) {
SPEAKING(ch) = i;
sprintf(buf, "You now speak %s.\r\n", languages[i-MIN_LANGUAGES]);
send_to_char(buf, ch);
found = TRUE;
break;
}
}
if (!found)
list_languages(ch);
}
}
void garble_text(char *string, int percent)
{
char letters[] = "aeiousthpwxyz";
int i;
for (i = 0; i < strlen(string); ++i)
if (isalpha(string[i]) && number(0, 1) && number(0, 100) > percent)
string[i] = letters[number(0, 12)];
}
ACMD(do_say)
{
char ibuf[MAX_INPUT_LENGTH];
char obuf[MAX_INPUT_LENGTH];
struct char_data *tch;
skip_spaces(&argument);
if(!*argument) {
send_to_char("Yes, but WHAT do you want to say?\r\n", ch);
return;
}
strcpy(ibuf, argument); /* preserve original text */
if (!IS_NPC(ch))
garble_text(ibuf, GET_SKILL(ch, SPEAKING(ch)));
for (tch = world[ch->in_room].people; tch; tch = tch->next_in_room) {
if (tch != ch && AWAKE(tch) && tch->desc) {
strcpy(obuf, ibuf); /* preserve the first garble */
if (!IS_NPC(ch) && !IS_NPC(tch))
garble_text(obuf, GET_SKILL(tch, SPEAKING(ch)));
send_to_char("&c",tch);
sprintf(buf, "$n says, '%s&c'&n", obuf);
CAP(buf);
act(buf, TRUE, ch, 0, tch, TO_VICT);
}
}
sprintf(buf, "&cYou say, '%s&c'&n", argument);
act(buf, TRUE, ch, 0, 0, TO_CHAR);
}
---spells.h---
#define LANG_COMMON 196
#define LANG_ELVEN 197
#define LANG_GNOME 198
#define LANG_DWARVEN 199
#define MIN_LANGUAGES 196
---utils.h---
#define SPEAKING(ch) ((ch)->player_specials->saved.speaking)
con questo terzo file di codice srgente per le lingue mi da i seguenti errori
\src\act.comm.c(683) : error C2065: 'MIN_LANGUAGES' : undeclared identifier
\src\act.comm.c(686) : error C2039: 'saved' : is not a member of 'player_special_data'
\src\structs.h(1314) : see declaration of 'player_special_data'
\src\act.comm.c(700) : error C2065: 'MIN_LANGUAGES' : undeclared identifier
\src\act.comm.c(701) : error C2065: 'MIN_LANGUAGES' : undeclared identifier
\src\act.comm.c(702) : error C2039: 'saved' : is not a member of 'player_special_data'
\src\structs.h(1314) : see declaration of 'player_special_data'
\src\act.comm.c(703) : error C2065: 'MIN_LANGUAGES' : undeclared identifier
\src\act.comm.c(719) : warning C4018: '<' : signed/unsigned mismatch
\src\act.comm.c(725) : error C2084: function 'void do_say(CHAR_DATA *,char *,int,int)' already has a body
\src\act.comm.c(41) : see previous definition of 'do_say'
\src\act.comm.c(740) : error C2039: 'saved' : is not a member of 'player_special_data'
\src\structs.h(1314) : see declaration of 'player_special_data'
\src\act.comm.c(740) : error C2039: 'saved' : is not a member of 'player_special_data'
\src\structs.h(1314) : see declaration of 'player_special_data'
\src\act.comm.c(740) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Creating browse information file...
posti i seguenti errori che mi so stati evidenziati
for (i = MIN_LANGUAGES; i < MAX_SKILLS; i++) {
SPEAKING(ch) == i ? CCRED(ch, C_NRM) : "", languages[a-1]);
for (i = MIN_LANGUAGES; i < MAX_SKILLS; i++) {
if (is_abbrev(arg, languages[i-MIN_LANGUAGES]) && GET_SKILL(ch, i) > 60) {
SPEAKING(ch) = i;
sprintf(buf, "You now speak %s.\r\n", languages[i-MIN_LANGUAGES]);
{
garble_text(ibuf, GET_SKILL(ch, SPEAKING(ch)));
=========================================================================
http://www.circlemud.org/pub/CircleMUD/ ... e_prof.txtThis spec is for MUDs that use multiple languages - to provide a special
"language professor" to teach languages. You will most likely need to
tailor the languages used here to match what you use.
This was created to work with the "language2.txt" snippet from: Frollo
<mudaholic@aol.com> but should work with most systems with some tweaking.
Note - This uses quest points as charge for learning, if you don't use
quest points, just change these references to gold costs instead, or take
them out entirely. This is, as usual for me, a do it by hand patch.
In spec_procs.c
*********************
Add the following:
void list_study_languages(struct char_data *ch, struct char_data *teacher)
{
int i, a;
sprintf(buf, "I can teach the following languages: ");
/* NUM_LANGUAGES would be easier */
for (i = 0; i < (MAX_SKILLS - MIN_LANGUAGES); i++){
sprintf(buf + strlen(buf), "%s ", languages[i]);
}
do_say(teacher, buf, 0, 0);
return;
}
SPECIAL(lang_prof)
{
int lang, qpcost;
struct char_data *teacher = (struct char_data *) me;
if (IS_NPC(ch))
return (FALSE);
if (!(CMD_IS("study")))
return (FALSE);
skip_spaces(&argument);
if (!argument){
list_study_languages(ch, teacher);
return (TRUE);
}
if (is_abbrev(argument, "common"))
lang = LANG_COMMON;
else if (is_abbrev(argument, "human"))
lang = LANG_HUMAN;
else if (is_abbrev(argument, "elven"))
lang = LANG_ELVEN;
else if (is_abbrev(argument, "gnomish"))
lang = LANG_GNOME;
else if (is_abbrev(argument, "dwarven"))
lang = LANG_DWARVEN;
else {
list_study_languages(ch, teacher);
return(TRUE);
}
if (GET_PRACTICES(ch) <= 0){
do_say(teacher, "You haven't earned the right to study anything new.", 0, teacher->in_room);
return(TRUE);
}
if (GET_SKILL(ch, lang) >= 95){
sprintf(buf, "You are already fluent in the %s tongue, %s.", languages[(lang - MIN_LANGUAGES)], GET_NAME(ch));
do_say(teacher, buf, 0, 0);
return (TRUE);
} else if (GET_SKILL(ch, lang) >= 50){
sprintf(buf, "You have learned as much as I can teach you of the %s tongue, %s.",languages[(lang - MIN_LANGUAGES)], GET_NAME(ch));
do_say(teacher, buf, 0, 0);
return (TRUE);
}
if (GET_INT(ch) < 11){
sprintf(buf, "%s, you are lucky you can speak your native tongue.", GET_NAME(ch));
do_say(teacher, buf, 0, 0);
return (TRUE);
}
/* This is what you should change if you wish to charge gold
* instead - check to see if they have enough.
*/
if (GET_QPS(ch) < 1){
sprintf(buf, "Sorry, %s, but you cannot afford to study here.", GET_NAME(ch));
do_say(teacher, buf, 0, 0);
return (TRUE);
}
/* Again here, change QPS to Gold if not using quest points */
/* Okay, all else being equal, it's time to study. */
qpcost = MIN(GET_QPS(ch), number(1, (25-GET_INT(ch))));
GET_SKILL(ch, lang) += qpcost;
GET_QPS(ch) -= qpcost;
GET_PRACTICES(ch) -= 1;
sprintf(buf, "You have increased your knowledge of the %s tongue.", languages[(lang-MIN_LANGUAGES)]);
act(buf, TRUE, ch, 0, 0, TO_CHAR);
act("$n studies diligently.", FALSE, ch, 0, 0, TO_ROOM);
return(TRUE);
}
qui invece mi da 13 errori
\src\spec_procs.c(518) : error C2085: 'list_study_languages' : not in formal parameter list
\src\spec_procs.c(518) : error C2143: syntax error : missing ';' before '{'
\src\spec_procs.c(524) : error C2065: 'languages' : undeclared identifier
\src\spec_procs.c(524) : error C2109: subscript requires array or pointer type
\src\spec_procs.c(526) : error C2065: 'teacher' : undeclared identifier
\src\spec_procs.c(552) : error C2065: 'LANG_HUMAN' : undeclared identifier
\src\spec_procs.c(570) : error C2065: 'languages' : undeclared identifier
\src\spec_procs.c(570) : error C2109: subscript requires array or pointer type
\src\spec_procs.c(574) : error C2065: 'languages' : undeclared identifier
\src\spec_procs.c(574) : error C2109: subscript requires array or pointer type
\src\spec_procs.c(598) : error C2106: '-=' : left operand must be l-value
\src\spec_procs.c(600) : error C2065: 'languages' : undeclared identifier
\src\spec_procs.c(600) : error C2109: subscript requires array or pointer type
Generating Code...
Creating browse information file...
Microsoft Browse Information Maintenance Utility Version 9.00.30729
Copyright (C) Microsoft Corporation. All rights reserved.
Build log was saved at "file://c:\Users\Debug\BuildLog.htm"
Lyonesse - 13 error(s), 80 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
copio ed incollo i vari pezzi di codice dove mi da errore
{
sprintf(buf + strlen(buf), "%s ", languages[i]);
do_say(teacher, buf, 0, 0);
lang = LANG_HUMAN;
sprintf(buf, "You are already fluent in the %s tongue, %s.", languages[(lang - MIN_LANGUAGES)], GET_NAME(ch));
sprintf(buf, "You have learned as much as I can teach you of the %s tongue, %s.",languages[(lang - MIN_LANGUAGES)], GET_NAME(ch));
GET_QPS(ch) -= qpcost;
sprintf(buf, "You have increased your knowledge of the %s tongue.", languages[(lang-MIN_LANGUAGES)]);
=============================================================================
in conclusione il pezzo di codice che mi da meno errore e il secondo in sequenza sarebbe a dire questo che mi da 3/4/5 errori in tutto
============================================================================
http://www.circlemud.org/pub/CircleMUD/ ... nguage.txt LANGUAGE CODE
Some notes: I use skill slots to hold language ability, this coincides
very nicely with my learn_by_use code (stripped out of this example).
If you try to use this, you'll need to make the appropriate entries in
spells.h (I use 190+ for langs), also, you'll need to change one of
the spares in the player structure to be "speaking".
Oh, you'll also need some way to toggle what language you're speaking,
you could use a simple do_speak command or something, I'm not finished
putting this all in yet, so I just made an entry in do_set to toggle
the person's current lang like: SPEAKING(vict) = value
Take note that it might also be a good idea to set the characters'
native language to 100% when they begin.
spells.h
#define LANG_COMMON 190
#define LANG_ELVEN 191
#define LANG_DWARVEN 192
#define LANG_TROLLISH 193
#define LANG_HALFLING 194
utils.h
#define SPEAKING(ch) ((ch)->player_specials->saved.speaking)
constants.c
const char *languages[] =
{
"common",
"elven",
"dwarven",
"trollish",
"halfling",
"\n"
};
act.comm.c
void garble_text(char *string, int percent)
{
char letters[] = "aeiousthpwxyz";
int i;
for (i = 0; i < strlen(string); ++i)
if (isalpha(string[i]) && number(0, 1) && number(0, 100) > percent)
string[i] = letters[number(0, 12)];
}
ACMD(do_lang_say)
{
extern char *languages[];
char ibuf[MAX_INPUT_LENGTH];
char obuf[MAX_INPUT_LENGTH];
int ofs = 190; /* offset - should be first language */
struct char_data *tch;
skip_spaces(&argument);
if(!*argument) {
send_to_char("Say what?\r\n", ch);
return;
}
strcpy(ibuf, argument); /* preserve original text */
garble_text(ibuf, GET_SKILL(ch, SPEAKING(ch)));
for (tch = world[ch->in_room].people; tch; tch = tch->next_in_room) {
if (tch != ch && AWAKE(tch) && tch->desc) {
strcpy(obuf, ibuf); /* preserve the first garble */
garble_text(obuf, GET_SKILL(tch, SPEAKING(ch)));
if (GET_SKILL(tch, SPEAKING(ch)) < 1)
sprintf(buf, "$n says, in an unfamiliar tongue,\r\n '%s'", obuf);
else
sprintf(buf, "$n says, in the %s tongue,\r\n '%s'", languages[(SPEAKING(ch) - ofs)], obuf);
act(buf, TRUE, ch, 0, tch, TO_VICT);
}
}
sprintf(buf, "You say, in the %s tongue,\r\n '%s'", languages[(SPEAKING(ch)- ofs)], argument);
act(buf, TRUE, ch, 0, 0, TO_CHAR);
}
One funky thing I see here, is that it appears that the garbled text
changes each time. For example, if I say the words "Hello there Sparky,
you're a dead man!" six times, anyone not speaking my language should see
the same string six times, not 6 different ones. I got around this by
assigning each language an index (Say like 5 10 15 20), and in the garble
text routine, I adjust the ascii value of the character by the index. If
I overrun the range of printable characters, I just wrap around. The
result is that the exact same string appears each time the speaker says
the same phrase. One major benefit of this is that it allows a player to
"learn" and recognize certain phrases in foreign tongues, just as in real
life. Therefore players of different races can have at least minimal
verbal interaction. Of course you can also do an:
> emote says: Hi There!
... But that's not my problem to solve.
------ Build started: Project: Lyonesse, Configuration: Debug Win32 ------
Compiling...
act.comm.c
\src\act.comm.c(697) : error C2039: 'saved' : is not a member of 'player_special_data'
\src\structs.h(1314) : see declaration of 'player_special_data'
act.comm.c(697) : error C2039: 'saved' : is not a member of 'player_special_data'
src\structs.h(1314) : see declaration of 'player_special_data'
\src\act.comm.c(697) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Creating browse information file...
Microsoft Browse Information Maintenance Utility Version 9.00.30729
Copyright (C) Microsoft Corporation. All rights reserved.
BSCMAKE: error BK1506 : cannot open file '.\Debug\act.comm.sbr': No such file or directory
Build log was saved at "file://c:\Users\Debug\BuildLog.htm"
Lyonesse - 4 error(s), 31 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
HO PROVATO A DISABILITARE questi pezzi di codice dove mi dava errore ma con nessuno risultato positivo:(
garble_text(ibuf, GET_SKILL(ch, SPEAKING(ch)));
garble_text(obuf, GET_SKILL(tch, SPEAKING(ch)));
dandomi in piu questi errori che corrispondono alle 4 pezzi di codice che incollo dopo gli errori
\src\act.comm.c(699) : error C2065: 'world' : undeclared identifier
\src\act.comm.c(706) : error C2039: 'saved' : is not a member of 'player_special_data'
\src\structs.h(1314) : see declaration of 'player_special_data'
\src\act.comm.c(706) : error C2039: 'saved' : is not a member of 'player_special_data'
c:\users\src\structs.h(1314) : see declaration of 'player_special_data'
src\act.comm.c(706) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Creating browse information file...
for (tch = world[ch->in_room].people; tch; tch = tch->next_in_room) {
if (GET_SKILL(tch, SPEAKING(ch)) < 1)
===============================================================
mettendo i vari pezzi di codice nei file di codice dove devono andare e cioe
spells.h
#define LANG_COMMON 190
#define LANG_ELVEN 191
#define LANG_DWARVEN 192
#define LANG_TROLLISH 193
#define LANG_HALFLING 194
lho messo qui
/* PLAYER SPELLS -- Numbered from 1 to MAX_SPELLS */
#define SPELL_ARMOR 1
#define SPELL_TELEPORT 2
#define SPELL_BLESS 3
#define SPELL_BLINDNESS 4
#define SPELL_BURNING_HANDS 5
#define SPELL_CALL_LIGHTNING 6
#define SPELL_CHARM 7
#define SPELL_CHILL_TOUCH 8
#define SPELL_CLONE 9
#define SPELL_COLOR_SPRAY 10
#define SPELL_CONTROL_WEATHER 11
#define SPELL_CREATE_FOOD 12
#define SPELL_CREATE_WATER 13
#define SPELL_CURE_BLIND 14
#define SPELL_CURE_CRITIC 15
#define SPELL_CURE_LIGHT 16
#define SPELL_CURSE 17
#define SPELL_DETECT_ALIGN 18
#define SPELL_DETECT_INVIS 19
#define SPELL_DETECT_MAGIC 20
#define SPELL_DETECT_POISON 21
#define SPELL_DISPEL_EVIL 22
#define SPELL_EARTHQUAKE 23
#define SPELL_ENCHANT_WEAPON 24
#define SPELL_ENERGY_DRAIN 25
#define SPELL_FIREBALL 26
#define SPELL_HARM 27
#define SPELL_HEAL 28
#define SPELL_INVISIBLE 29
#define SPELL_LIGHTNING_BOLT 30
#define SPELL_LOCATE_OBJECT 31
#define SPELL_MAGIC_MISSILE 32
#define SPELL_POISON 33
#define SPELL_PROT_FROM_EVIL 34
#define SPELL_REMOVE_CURSE 35
#define SPELL_SANCTUARY 36
#define SPELL_SHOCKING_GRASP 37
#define SPELL_SLEEP 38
#define SPELL_STRENGTH 39
#define SPELL_SUMMON 40
#define SPELL_VENTRILOQUATE 41
#define SPELL_WORD_OF_RECALL 42
#define SPELL_REMOVE_POISON 43
#define SPELL_SENSE_LIFE 44
#define SPELL_ANIMATE_DEAD 45
#define SPELL_DISPEL_GOOD 46
#define SPELL_GROUP_ARMOR 47
#define SPELL_GROUP_HEAL 48
#define SPELL_GROUP_RECALL 49
#define SPELL_INFRAVISION 50
#define SPELL_WATERWALK 51
#define SPELL_WALL_OF_FOG 52
#define SPELL_ROOM_SHIELD 53
#define SPELL_MINOR_TRACK 54
#define SPELL_MAJOR_TRACK 55
#define SPELL_SHIELD 56
#define SPELL_STONE_SKIN 57
#define SPELL_PARALYSIS 58
#define SPELL_REFRESH 59
#define SPELL_INCENDIARY_CLOUD 60
#define SPELL_FIRESHIELD 61
#define SPELL_FLASH 62
#define SPELL_ACID_ARROW 63
#define SPELL_REGENERATION 64
#define SPELL_SHOCKWAVE 65
#define SPELL_FEAR 66
#define LAST_SPELL 71 // REMEMBER TO UPDATE THIS!!!
#define LANG_COMMON 196
#define LANG_ELVEN 197
#define LANG_GNOME 198
#define LANG_DWARVEN 199
#define MIN_LANGUAGES 196
/* Insert new spells up to MAX_SPELLS 500 */
/* PLAYER SKILLS - Numbered from MAX_SPELLS+1 to MAX_SKILLS */
#define SKILL_AGGUATO 501
#define SKILL_SBILANCIARE 502
#define SKILL_HIDE 503
#define SKILL_CALCIARE 504
#define SKILL_SCASSINARE 505 //PICK_LOCK
#define SKILL_NAVIGATION 506
#define SKILL_RESCUE 507
#define SKILL_SNEAK 508
#define SKILL_BORSEGGIARE 509
#define SKILL_TRACK 510
#define SKILL_CAVALCARE 511
#define SKILL_TAME 512
#define SKILL_STUDY 513
#define SKILL_READ_MAGIC 514
#define SKILL_ENCHANT_ITEMS 515
#define SKILL_PRODUCTION 516
#define SKILL_DISARM_TRAPS 517
----------------------------------------------------------------------------------
quest altro pezzo di codice
#define SPEAKING(ch) ((ch)->player_specials->saved.speaking)
lho messo qui
/* room utils ************************************************************/
#define SECT(room) ((room)->sector_type)
#define IS_BUILDING(sub) ((sub)->zone == BUILDING_ZONE)
#define IN_BUILDING(sub) (IS_BUILDING((sub)->in_room))
#define IS_WILD(sub) ((sub)->zone == WILD_ZONE)
#define IN_WILD(sub) (IS_WILD((sub)->in_room ))
#define IS_SHIP(sub) ((sub)->zone == SHIP_ZONE)
#define IN_SHIP(sub) (IS_SHIP((sub)->in_room))
#define IS_DECK(sub) (SECT((sub)) >= SECT_SHIP_STERN && SECT((sub)) <= SECT_SHIP_BOW)
#define ON_DECK(sub) (IS_DECK((sub)->in_room))
#define IS_FERRY(sub) ((sub)->zone == FERRY_ZONE)
#define IN_FERRY(sub) (IS_FERRY((sub)->in_room))
#define S_NAME(sn) (terrain_type[(sn)] != NULL ? terrain_type[(sn)]->name : "WildRoomName")
#define S_DESC(sn) (terrain_type[(sn)] != NULL ? terrain_type[(sn)]->description : "WildRoomDesc")
#define GET_RY(sub) ((sub)->coord->y)
#define GET_RX(sub) ((sub)->coord->x)
#define GET_RZ(sub) ((sub)->coord->level)
#define GET_Y(sub) (GET_RY((sub)->in_room))
#define GET_X(sub) (GET_RX((sub)->in_room))
#define GET_Z(sub) (GET_RZ((sub)->in_room))
#define ROOM_RNAME(sub) (IS_WILD(sub) ? S_NAME( (sub)->sector_type ) : \
((sub)->name ? (sub)->name : "No Nome"))
#define ROOM_RDESC(sub) (IS_WILD(sub) ? S_DESC( (sub)->sector_type ) : \
((sub)->description ? (sub)->description : \
"No Descrizione"))
#define ROOM_NAME(sub) (ROOM_RNAME((sub)->in_room))
#define ROOM_DESC(sub) (ROOM_RDESC((sub)->in_room))
#define IS_DARK(room) room_is_dark((room))
#define IS_LIGHT(room) (!IS_DARK(room))
#define GET_ROOM_SPEC(room) ((room)->func)
/* char utils ************************************************************/
#define SPEAKING(ch) ((ch)->player_specials->saved.speaking)
#define IN_ROOM(ch) ((ch)->in_room)
#define GET_WAS_IN(ch) ((ch)->was_in_room)
#define GET_AGE(ch) (age(ch)->year)
#define GET_PFILEPOS(ch) ((ch)->pfilepos)
#define GET_EQ(ch, i) ((ch)->equipment[i])
#define GET_PC_NAME(ch) ((ch)->player.name)
#define GET_NAME(ch) (IS_NPC(ch) ? (ch)->player.short_descr : GET_PC_NAME(ch))
#define GET_TITLE(ch) ((ch)->player.title)
#define GET_LEVEL(ch) ((ch)->player.level)
#define GET_PASSWD(ch) ((ch)->player.passwd)
#define GET_CLASS(ch) ((ch)->player.chclass)
#define GET_RACE(ch) ((ch)->player.race)
#define GET_HOME(ch) ((ch)->player.hometown)
#define GET_HEIGHT(ch) ((ch)->player.height)
#define GET_WEIGHT(ch) ((ch)->player.weight)
#define GET_SEX(ch) ((ch)->player.sex)
#define GET_POS(ch) ((ch)->player.position)
#define GET_IDNUM(ch) ((ch)->player.idnum)
#define IS_CARRYING_W(ch) ((ch)->player.carry_weight)
#define IS_CARRYING_N(ch) ((ch)->player.carry_items)
#define FIGHTING(ch) ((ch)->player.fighting)
#define RIDING(ch) ((ch)->player.riding)
#define HUNTING(ch) ((ch)->player.hunting)
#define WAGONER(ch) ((ch)->player.drive_vehicle)
#define GET_SAVE(ch, i) ((ch)->player.apply_saving_throw[i])
#define GET_ALIGNMENT(ch) ((ch)->player.alignment)
#define GET_CLAN(ch) ((ch)->player.clan)
#define GET_CLAN_RANK(ch) ((ch)->player.clan_rank)
#define GET_SDESC(ch) ((ch)->player.short_descr)
#define GET_LDESC(ch) ((ch)->player.long_descr)
#define GET_DDESC(ch) ((ch)->player.description)
#define GET_STR(ch) ((ch)->aff_abils.str)
#define GET_DEX(ch) ((ch)->aff_abils.dex)
#define GET_INT(ch) ((ch)->aff_abils.intel)
#define GET_WIS(ch) ((ch)->aff_abils.wis)
#define GET_CON(ch) ((ch)->aff_abils.con)
#define GET_CHA(ch) ((ch)->aff_abils.cha)
#define GET_EXP(ch) ((ch)->points.exp)
#define GET_AC(ch) ((ch)->points.armor)
#define GET_HIT(ch) ((ch)->points.hit)
#define GET_MAX_HIT(ch) ((ch)->points.max_hit)
#define GET_MOVE(ch) ((ch)->points.move)
#define GET_MAX_MOVE(ch) ((ch)->points.max_move)
#define GET_MANA(ch) ((ch)->points.mana)
#define GET_MAX_MANA(ch) ((ch)->points.max_mana)
#define GET_BANK_GOLD(ch) ((ch)->points.bank_gold)
#define GET_HITROLL(ch) ((ch)->points.hitroll)
#define GET_DAMROLL(ch) ((ch)->points.damroll)
#define GET_REAL_HITROLL(ch) (str_app[GET_STR(ch)].tohit + GET_HITROLL(ch))
#define GET_REAL_DAMROLL(ch) (str_app[GET_STR(ch)].todam + GET_DAMROLL(ch))
#define GET_TOT_LEVEL(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->tot_level))
#define GET_COND(ch, i) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->conditions[(i)]))
#define GET_LOADROOM(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->load_room))
#define GET_LOADBUILDING(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->load_building))
#define GET_LOADCOORD(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->load_coord))
#define GET_LOAD_Y(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->load_coord->y))
#define GET_LOAD_X(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->load_coord->x))
#define GET_LOADSHIP(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->load_ship))
#define GET_PRACTICES(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->spells_to_learn))
#define GET_INVIS_LEV(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->invis_level))
#define GET_WIMP_LEV(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->wimp_level))
#define GET_FREEZE_LEV(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->freeze_level))
#define GET_BAD_PWS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->bad_pws))
#define GET_TALK(ch, i) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->talks[i]))
#define POOFIN(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->poofin))
#define POOFOUT(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->poofout))
#define GET_ALIASES(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->aliases))
#define GET_LAST_TELL(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->last_tell))
#define GET_MOB_KILLS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->mob_kills))
#define GET_MOB_DEATHS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->mob_deaths))
#define GET_PLR_KILLS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->plr_kills))
#define GET_PLR_DEATHS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->plr_deaths))
#define MEMORIZED(ch, sn) ((ch)->player_specials->spells_mem[sn])
#define GET_SKILL(ch, i) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->skills[i]))
#define SET_SKILL(ch, i, pct) do { CHECK_PLAYER_SPECIAL((ch), (ch)->player_specials->skills[i]) = pct; } while(0)
/* Killing same mobs XP penalties macros */
#define GET_KILLS_VNUM(ch, a) ((ch)->player_specials->kills_vnum[a-1])
#define GET_KILLS_AMOUNT(ch, a) ((ch)->player_specials->kills_amount[a-1])
#define GET_KILLS_CURPOS(ch) ((ch)->player_specials->kills_curpos)
#define GET_MOB_MAXFACTOR(ch) ((ch)->mob_specials.maxfactor)
#define GET_MOB_SPEC(mob) (IS_MOB(mob) ? mob_index[(mob)->nr].func : NULL)
#define GET_MOB_RNUM(mob) ((mob)->nr)
#define GET_MOB_VNUM(mob) (IS_MOB(mob) ? mob_index[GET_MOB_RNUM(mob)].vnum : NOBODY)
#define GET_DEFAULT_POS(mob) ((mob)->mob_specials.default_pos)
#define MEMORY(mob) ((mob)->mob_specials.memory)
#define GET_GOLD(mob) ((mob)->mob_specials.gold)
#define RIDDEN_BY(mob) ((mob)->mob_specials.ridden_by)
#define MOB_OWNER(mob) ((mob)->mob_specials.owner_id)
----------------------------------------------------------------------------------
quest altro pezzo di codice
constants.c
const char *languages[] =
{
"common",
"elven",
"dwarven",
"trollish",
"halfling",
"\n"
};
lo inserito qui
/* ITEM_WEAR_ (wear bitvector) */
const char *wear_bits[] =
{
"PRESO",
"DITO",
"COLLO",
"CORPO",
"TESTA",
"GAMBE",
"PIEDI",
"MANI",
"BRACCIA",
"SCUDO",
"INTORNO",
"VITA",
"POLSO",
"IMPUGNATO",
"INDOSSATO",
"SPALLE",
"\n"
};
const char *languages[] =
{
"common",
"elven",
"dwarven",
"trollish",
"halfling",
"\n"
};
/* ITEM_x (extra bits) */
const char *extra_bits[] =
{
"BRILLA",
"RONZA",
"NO_RENT",
"NO_DONABILE",
"NO_INVISIBILE",
"INVISIBILE",
"MAGICO",
"NO_POSABILE",
"BENEDETTO",
"FAST_MAGIC",
"IS_SPELLBOOK",
"HAS_SPELLS",
"HAS_TRAPS",
"NO_DANNEGGIABILE",
"DONABILE",
"UNUSED15",
"NO_VENDIBILE",
"UNIQUE",
"\n"
};
----------------------------------------------------------------------------------
q quest altro pezzo di codice
void garble_text(char *string, int percent)
{
char letters[] = "aeiousthpwxyz";
int i;
for (i = 0; i < strlen(string); ++i)
if (isalpha(string[i]) && number(0, 1) && number(0, 100) > percent)
string[i] = letters[number(0, 12)];
}
ACMD(do_lang_say)
{
extern char *languages[];
char ibuf[MAX_INPUT_LENGTH];
char obuf[MAX_INPUT_LENGTH];
int ofs = 190; /* offset - should be first language */
struct char_data *tch;
skip_spaces(&argument);
if(!*argument) {
send_to_char("Say what?\r\n", ch);
return;
}
strcpy(ibuf, argument); /* preserve original text */
garble_text(ibuf, GET_SKILL(ch, SPEAKING(ch)));
for (tch = world[ch->in_room].people; tch; tch = tch->next_in_room) {
if (tch != ch && AWAKE(tch) && tch->desc) {
strcpy(obuf, ibuf); /* preserve the first garble */
garble_text(obuf, GET_SKILL(tch, SPEAKING(ch)));
if (GET_SKILL(tch, SPEAKING(ch)) < 1)
sprintf(buf, "$n says, in an unfamiliar tongue,\r\n '%s'", obuf);
else
sprintf(buf, "$n says, in the %s tongue,\r\n '%s'", languages[(SPEA
KING(ch) - ofs)], obuf);
act(buf, TRUE, ch, 0, tch, TO_VICT);
}
}
sprintf(buf, "You say, in the %s tongue,\r\n '%s'", languages[(SPEAKING(c
h)- ofs)], argument);
act(buf, TRUE, ch, 0, 0, TO_CHAR);
}
lho messo qui
ACMD(do_ctell)
{
DESCRIPTOR_DATA *i;
if ( GET_CLAN(ch) == 0 )
{
send_to_char ("Tu non fai parte di un clan.\r\n", ch);
return;
}
skip_spaces(&argument);
one_argument( argument, arg );
if (!*arg)
{
send_to_char("Cosa vuoi dire al tuo clan?\r\n", ch);
return;
}
if (PRF_FLAGGED(ch,PRF_NOREPEAT))
sprintf(buf1, OK);
else
sprintf(buf1, "Tu dici al tuo clan, '%s'\r\n", argument);
send_to_char (buf1, ch);
for (i = descriptor_list; i; i = i->next)
{
if ( GET_CLAN(i->character) == GET_CLAN(ch) )
{
if ( strcmp( GET_NAME(i->character), GET_NAME(ch) ) )
{
if( GET_CLAN_RANK(ch) == RANK_LEADER )
sprintf(buf,"[CLAN]: Leader %s dice, '%s'.\r\n", GET_NAME(ch), arg);
else
sprintf(buf,"[CLAN]: %s dicono, '%s'.\r\n", PERS(ch, i->character), arg);
send_to_char(buf, i->character);
}
}
}
/* Room Trigger Events */
if ( ch->in_room->trigger )
check_room_trigger(ch, TRIG_ACT_SPEAK);
}
void garble_text(char *string, int percent)
{
char letters[] = "aeiousthpwxyz";
int i;
for (i = 0; i < strlen(string); ++i)
if (isalpha(string[i]) && number(0, 1) && number(0, 100) > percent)
string[i] = letters[number(0, 12)];
}
ACMD(do_lang_say)
{
extern char *languages[];
char ibuf[MAX_INPUT_LENGTH];
char obuf[MAX_INPUT_LENGTH];
int ofs = 190; /* offset - should be first language */
struct char_data *tch;
skip_spaces(&argument);
if(!*argument) {
send_to_char("Say what?\r\n", ch);
return;
}
strcpy(ibuf, argument); /* preserve original text */
garble_text(ibuf, GET_SKILL(ch, SPEAKING(ch)));
for (tch = world[ch->in_room].people; tch; tch = tch->next_in_room) {
if (tch != ch && AWAKE(tch) && tch->desc) {
strcpy(obuf, ibuf); /* preserve the first garble */
garble_text(obuf, GET_SKILL(tch, SPEAKING(ch)));
if (GET_SKILL(tch, SPEAKING(ch)) < 1)
sprintf(buf, "$n says, in an unfamiliar tongue,\r\n '%s'", obuf);
else
sprintf(buf, "$n says, in the %s tongue,\r\n '%s'", languages[(SPEA
KING(ch) - ofs)], obuf);
act(buf, TRUE, ch, 0, tch, TO_VICT);
}
}
sprintf(buf, "You say, in the %s tongue,\r\n '%s'", languages[(SPEAKING(c
h)- ofs)], argument);
act(buf, TRUE, ch, 0, 0, TO_CHAR);
}
quindi in sistesi ho questo problema sul inserimento delle lingue in lyonesse mud.
poi avevo provato ad inserire il peso e l'altezza alle diverse razze ma non ci sono riuscito,ma sono riuscito a mette le diverse eta di partenza di ogni razza.
che direaspetto qualche risposta di aiuto positivo nel fra tempo buon pomeriggio;):P