On Thu, 4 Jul 1996, Andrew P Carter wrote:
> As a side note, I was wondering if anyone had a simple way to prompt
> players on whether they wanted ansi or not before they login (before the
> opening screen even). That way you could put in an ansi opening screen,
> character creations menus, etc. Yeah, it seems pretty easy, but I hate
> messing around with any stuff around the socket code, and besides I'm lazy.
> So if anyone has done it and could lend me their interpreter.c to look
> at (or tell me how it's done) I'd be much obliged :P
It's easy. You don't even need to get around the socket code *AT ALL.*
Just go into structs.h and add a new CON state, I call mine CON_TERM_TYPE
but you can call it whatever you want, to. Be sure to add the string to
constants.c with the names of the other CON_xxx states.
Now, into comm.c search forward for the word GREETING. This should put
you into the new_descriptor() function. Then it's easy:
* Remove the "extern char *GREETINGS;" line.
* Go down to where it sets the person to CON_GET_NAME and replace it
with your terminal type state.
* Go down to where it sends out the greeting (SEND_TO_Q(GREETING...))
and replace it with SEND_TO_Q("Do you want ANSI[y/n]? ", d);
Now that, that is done, just add the code for the state into
interpreter.c, the nanny() function. Also, the first part of the
CON_GET_NAME function where it creates d->character if it's non-existant
should be moved out of the switch statement. This prevents crashes from
the new CON state that preceeds CON_GET_NAME. Next, add this inside the
switch statement:
case CON_whatever: /* replace "whatever" with the right CON #def */
switch (LOWER(*arg)) {
case 'y': case '\0': /* defaults to Yes if they just press ENTER */
SET_BIT(PRF_FLAGS(d->character), PRF_COLOR_1 | PRF_COLOR_2);
SEND_TO_Q("ANSI has been enabled!\r\n", d);
break;
case 'n':
SEND_TO_Q("No ANSI color will be sent.\r\n", d);
break;
default:
SEND_TO_Q("Do you want ANSI[y/n]? ", d);
return;
}
SEND_TO_Q(GREETINGS, d);
break;
Ooops, don't forget to add the line
extern char *GREETINGS;
At the beginning of the nanny() function...
Sorry if that was confusing, I'll consider making a patch to do this if
people really want to. Also, if you want to use two different screens for
non-ANSI and ANSI then move the SEND_TO_Q(GREETINGS, d) into the case 'y'
and case 'n' sections and change GREETINGS to whatever variable has the
name of your MUD. If you want to make sure I know what the hell I'm
talking about, telnet to dstar.california.com 4000.
-dak
This archive was generated by hypermail 2b30 : 12/07/00 PST