Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ SMAUG coding
➜ swr1fuss prompt problems
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1 2
Posted by
| Asean Novari
USA (82 posts) Bio
|
Date
| Fri 25 Feb 2005 12:29 AM (UTC) |
Message
| On the default_prompt when i enter a command the command gets
either entered on the next line or after all the text on that
line..
but as soon as i enter in my own customized prompt it gets
entered a new line and it makes some of the last characters
for my prompt warp to the next line with it..
is there a way to fix this..
also is there a way to add a empty line after the prompt and
still have it be a mud feature rather than a plugin..
|
| Top |
|
Posted by
| Greven
Canada (835 posts) Bio
|
Date
| Reply #1 on Fri 25 Feb 2005 12:35 AM (UTC) |
Message
| If you want someone to be able to add a line break where they want, you can use this, put it in display_prompt as one of the options, then use %_ to add a new line case '_':
mudstrlcpy(pbuf, "\n\r", MSL);
break;
|
Nobody ever expects the spanish inquisition!
darkwarriors.net:4848
http://darkwarriors.net | Top |
|
Posted by
| Asean Novari
USA (82 posts) Bio
|
Date
| Reply #2 on Fri 25 Feb 2005 01:10 AM (UTC) Amended on Fri 25 Feb 2005 01:11 AM (UTC) by Asean Novari
|
Message
| I see a display_prompt in comm.c but I dont get where to put in what you said.. and does indenting matter?
*edit*
shoots self in head as he locates place to insert code.. |
| Top |
|
Posted by
| Zeno
USA (2,871 posts) Bio
|
Date
| Reply #3 on Fri 25 Feb 2005 01:10 AM (UTC) |
Message
| You can add the case with all the other cases, like:
No indenting doesn't really matter. |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | Top |
|
Posted by
| Asean Novari
USA (82 posts) Bio
|
Date
| Reply #4 on Fri 25 Feb 2005 01:16 AM (UTC) Amended on Fri 25 Feb 2005 01:18 AM (UTC) by Asean Novari
|
Message
| $ make
make -s swreality
Compiling o/comm.o....
comm.c: In function `display_prompt':
comm.c:2890: warning: implicit declaration of function `mudstrlcpy'
comm.c:2890: error: `MSL' undeclared (first use in this function)
comm.c:2890: error: (Each undeclared identifier is reported only once
comm.c:2890: error: for each function it appears in.)
make[1]: *** [o/comm.o] Error 1
make: *** [all] Error 2
thats what i get when its entered into the function
switch ( *prompt )
{
case '_':
mudstrlcpy(pbuf, "\n\r", MSL);
break;
case '%':
*pbuf++ = '%';
*pbuf = '\0';
break;
added code |
| Top |
|
Posted by
| Zeno
USA (2,871 posts) Bio
|
Date
| Reply #5 on Fri 25 Feb 2005 01:20 AM (UTC) |
Message
| Grevan was using a different codebase, so change:
mudstrlcpy(pbuf, "\n\r", MSL);
to:
|
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | Top |
|
Posted by
| David Haley
USA (3,881 posts) Bio
|
Date
| Reply #6 on Fri 25 Feb 2005 01:20 AM (UTC) |
Message
|
Quote: No indenting doesn't really matter. *gasp!!* Never say that! We're doomed to have poorly indented code submitted for the rest of our lives now! :-) |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | Top |
|
Posted by
| Zeno
USA (2,871 posts) Bio
|
Date
| Reply #7 on Fri 25 Feb 2005 01:21 AM (UTC) |
Message
| I know, but I simply meant in terms of results. ;) |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | Top |
|
Posted by
| Greven
Canada (835 posts) Bio
|
Date
| Reply #8 on Fri 25 Feb 2005 01:25 AM (UTC) Amended on Fri 25 Feb 2005 01:27 AM (UTC) by Greven
|
Message
| Thats what the wonderful program called indent is for, to change peoples poorly indented code to a format that you like, heh.
And I have mine set up as such, you need to put the check below the check for the % character, with the other special values. This is what I use: case 'h':
pstat = ch->hit;
break;
case 'H':
pstat = ch->max_hit;
break;
case '_':
mudstrlcpy(pbuf, "\n\r", MSL);
break;
Since I'm using mudstrlcpy, you can just use strncpy instead, and it will produce the same result for your purposes. |
Nobody ever expects the spanish inquisition!
darkwarriors.net:4848
http://darkwarriors.net | Top |
|
Posted by
| Asean Novari
USA (82 posts) Bio
|
Date
| Reply #9 on Fri 25 Feb 2005 01:31 AM (UTC) Amended on Fri 25 Feb 2005 01:33 AM (UTC) by Asean Novari
|
Message
| Ok Thanks guys.. everythings working right now
*EDIT*
Heh.. now i see another prompt issue i would like help with..
On another mud i played you could look at your current prompt by just typing prompt.. how do i enter that in here as well?
please and thanks |
| Top |
|
Posted by
| Greven
Canada (835 posts) Bio
|
Date
| Reply #10 on Fri 25 Feb 2005 01:37 AM (UTC) |
Message
| You can use something like this: sprintf( buf, "%s\n\r", !str_cmp( ch->pcdata->prompt, "" ) ? "(default prompt)" : ch->pcdata->prompt );
set_char_color( AT_WHITE, ch );
write_to_descriptor( ch->desc->descriptor, "Your current prompt string:\n\r", 0 );
write_to_descriptor( ch->desc->descriptor, buf, 0 );
write_to_descriptor( ch->desc->descriptor, "Set prompt to what? (try help prompt)\n\r", 0 );
Should allow you to print out a characters prompt, including the color codes. |
Nobody ever expects the spanish inquisition!
darkwarriors.net:4848
http://darkwarriors.net | Top |
|
Posted by
| Asean Novari
USA (82 posts) Bio
|
Date
| Reply #11 on Fri 25 Feb 2005 01:54 AM (UTC) Amended on Fri 25 Feb 2005 01:57 AM (UTC) by Asean Novari
|
Message
| should i enter this in player.c where the "set prompt to what" text is currenty at?
void do_prompt( CHAR_DATA * ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
if( IS_NPC( ch ) )
{
send_to_char( "NPC's can't change their prompt..\n\r", ch );
return;
}
smash_tilde( argument );
one_argument( argument, arg );
if( !*arg )
{
send_to_char( "Set prompt to what? (try help prompt)\n\r", ch );
return;
}
if( ch->pcdata->prompt )
STRFREE( ch->pcdata->prompt );
if( strlen( argument ) > 128 )
argument[128] = '\0';
or does it go someplace else.. like comm.c |
| Top |
|
Posted by
| Greven
Canada (835 posts) Bio
|
Date
| Reply #12 on Fri 25 Feb 2005 02:14 AM (UTC) |
Message
| You would put it in do_prompt. After looking at it, I don't like filtering my code as that, so I actually changed it to such if (!*arg)
{
if ( ch->desc && ch->desc->descriptor )
{
sprintf( buf, "%s\n\r", !str_cmp( ch->pcdata->prompt, "" ) ? "(default prompt)" : ch->pcdata->prompt );
set_char_color( AT_WHITE, ch );
send_to_char("Your current prompt string:\n\r", ch );
ch_printf(ch, "%s\n\r", full_color(ch->pcdata->prompt));
}
send_to_char("Set prompt to what? (try help prompt)\n\r", ch);
return;
}
char *full_color(char *str)
{
static char ret[MAX_STRING_LENGTH];
char *retptr;
retptr = ret;
for (; *str != '\0'; str++)
{
if (*str == '&')
{
*retptr = *str;
retptr++;
*retptr = '&';
retptr++;
}
else
{
*retptr = *str;
retptr++;
}
}
*retptr = '\0';
return ret;
}
|
Nobody ever expects the spanish inquisition!
darkwarriors.net:4848
http://darkwarriors.net | Top |
|
Posted by
| Asean Novari
USA (82 posts) Bio
|
Date
| Reply #13 on Fri 25 Feb 2005 02:29 AM (UTC) |
Message
| this dosent work with swr1fuss .. i get this error
Administrator@Home ~/swr1fuss/src
$ make
make -s swreality
Compiling o/player.o....
player.c: In function `do_prompt':
player.c:1150: error: `buf' undeclared (first use in this function)
player.c:1150: error: (Each undeclared identifier is reported only once
player.c:1150: error: for each function it appears in.)
player.c:1153: warning: implicit declaration of function `full_color'
player.c:1160: warning: `full_color' was declared implicitly `extern' and later `static'
player.c:1153: warning: previous declaration of `full_color'
player.c:1160: warning: type mismatch with previous implicit declaration
player.c:1153: warning: previous implicit declaration of `full_color'
make[1]: *** [o/player.o] Error 1
make: *** [all] Error 2
|
| Top |
|
Posted by
| David Haley
USA (3,881 posts) Bio
|
Date
| Reply #14 on Fri 25 Feb 2005 02:32 AM (UTC) |
Message
| Out of curiosity do you understand the errors? Most of them are very basic and you should be able to figure them out on your own - trust me, it'll do you service in the long run.
Also isn't the ability to display the prompt by just typing 'prompt' in by default? |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
48,425 views.
This is page 1, subject is 2 pages long: 1 2
It is now over 60 days since the last post. This thread is closed.
Refresh page
top