15 Mar, 2009, pentair wrote in the 1st comment:
Votes: 0
having some problems cmpiling a version of socketmud. getting this error:

socket.c:356: error: ‘_TXT_GREETING’ undeclared (first use in this function)

this is the bit of code it is referencing:

/* send the greeting */
text_to_buffer(sock_new, greeting);
text_to_buffer(sock_new, _TXT_GREETING);

/* everything went as it was supposed to */
return TRUE;
}
15 Mar, 2009, Lobotomy wrote in the 2nd comment:
Votes: 0
First of all, what version of socketmud are you talking about? Secondly, that _TXT_GREETING sounds like it would be a macro that has not yet been defined.
15 Mar, 2009, pentair wrote in the 3rd comment:
Votes: 0
downloaded from this site. thris_concept.zip. has world and classes
15 Mar, 2009, Lobotomy wrote in the 4th comment:
Votes: 0
pentair said:
downloaded from this site. thris_concept.zip. has world and classes

Which version is it, though? I'm assuming you got it from this page, right? You should know what version it is that you downloaded.
15 Mar, 2009, pentair wrote in the 5th comment:
Votes: 0
there is alot of the same errors but i figured if i fixed one, i could get the others.

_TXT_GREETING
_TXT_SOCK_OVER
_TXT_OVERFLOW
_TXT_LOGIN_DNS
_TXT_ILLNAME
_TXT_NEW_PASS
_TXT_OLD_PASS
_TXT_PASS_LEN
_TXT_ILL_PASS
_TXT_PASS_VERI
_TXT_PASS_MISS
_TXT_BODY_USE
_TXT_PFILE_BAD
_TXT_WRONG_PASS
15 Mar, 2009, pentair wrote in the 6th comment:
Votes: 0
hmm i found it on this page http://www.mudbytes.net/index.php?a=file...

its in the snippets page but it has all the main files
15 Mar, 2009, Lobotomy wrote in the 7th comment:
Votes: 0
Very strange that it would be in that directory instead of the main directory. Anyhow, it does indeed look like those are macros. However, I don't know as such what they are meant to contain. You can try doing a search of all of the source files for those macros to see if they are defined elsewhere (by "grep "_TXT_GREETING" *" for instance), but you may simply have to give them new values.

Looking at what is in the regular socketmud release, it looks like for txt_greeting you could do the following:
#define _TXT_GREETING           "What is your name? "
15 Mar, 2009, pentair wrote in the 8th comment:
Votes: 0
hmm. i greped it and it it the only instance. it is version 1.10 of socketmud. so maybe i need to make a .h file to define it
15 Mar, 2009, Lobotomy wrote in the 9th comment:
Votes: 0
That, or you may want to consider using a more up-to-date codebase. Such an old version is likely to be prone to any number of bugs and design flaws.
15 Mar, 2009, Fizban wrote in the 10th comment:
Votes: 0
Lobotomy said:
Very strange that it would be in that directory instead of the main directory. Anyhow, it does indeed look like those are macros. However, I don't know as such what they are meant to contain. You can try doing a search of all of the source files for those macros to see if they are defined elsewhere (by "grep "_TXT_GREETING" *" for instance), but you may simply have to give them new values.

Looking at what is in the regular socketmud release, it looks like for txt_greeting you could do the following:
#define _TXT_GREETING           "What is your name? "


Maybe it's me, but why bother defining it when it's comething that's only used once in the code like that when you could simply change the line to:

text_to_buffer(sock_new, "What is your name?");
15 Mar, 2009, pentair wrote in the 11th comment:
Votes: 0
going through the code more and it seems like every one of the errors are for messages. like the greeting line or password verification and password errors. so either i make a .h file for them all or i do what the last poster said.
15 Mar, 2009, Lobotomy wrote in the 12th comment:
Votes: 0
Fizban said:
Lobotomy said:
Very strange that it would be in that directory instead of the main directory. Anyhow, it does indeed look like those are macros. However, I don't know as such what they are meant to contain. You can try doing a search of all of the source files for those macros to see if they are defined elsewhere (by "grep "_TXT_GREETING" *" for instance), but you may simply have to give them new values.

Looking at what is in the regular socketmud release, it looks like for txt_greeting you could do the following:
#define _TXT_GREETING           "What is your name? "


Maybe it's me, but why bother defining it when it's comething that's only used once in the code like that when you could simply change the line to:

text_to_buffer(sock_new, "What is your name?");

Well, in some cases it can be less of a hassle tracking down string literals to edit if they're kept in a different location in macro form. It just depends, I would say.
15 Mar, 2009, ghasatta wrote in the 13th comment:
Votes: 0
Quote
why bother defining it when it's comething that's only used once in the code like that

Ease of maintenance for one thing. Tracking down hardcoded text messages can be a PITA. It would also make it easier in case you wanted to have that same message in multiple places in the code in the future (perhaps a display of all text messages in the game, for review, etc).
15 Mar, 2009, pentair wrote in the 14th comment:
Votes: 0
i am going through and changing the code, it is working so far. if it works i might put them in a .h file later.
15 Mar, 2009, pentair wrote in the 15th comment:
Votes: 0
works now thanks for the help. now i just need to go back through and fill in the right text instead of the quick placeholders
i put in.
15 Mar, 2009, Fizban wrote in the 16th comment:
Votes: 0
ghasatta said:
Quote
why bother defining it when it's comething that's only used once in the code like that

Ease of maintenance for one thing. Tracking down hardcoded text messages can be a PITA. It would also make it easier in case you wanted to have that same message in multiple places in the code in the future (perhaps a display of all text messages in the game, for review, etc).


For strings that are used repeatedly I definitely see the use, but a string like that will only ever be used once. I don't see how this is much of a pain to track either: grep "What is your name?" *.c
15 Mar, 2009, Zeno wrote in the 17th comment:
Votes: 0
Because it's all in one place. Say someone wants to translate a project, it would be much better if they were all like that instead of thrown about in various source files.
16 Mar, 2009, David Haley wrote in the 18th comment:
Votes: 0
It's best practice to adopt, well, best practices from the getgo even if their benefit will come up later. If you do it from the start, it's that much less you have to change later when you find that maybe you should have used a constant after all. (Or function decomposition, or good variable names, or data encapsulation, or ….)
0.0/18