30 Apr, 2007, Hades_Kane wrote in the 1st comment:
Votes: 0
A builder on my MUD has requested a command similar to ".ld" that would delete the last line entered into append mode (I'm thinking maybe using ".d" if I can figure it out)… problem is, despite the advancements I'm making in understanding the way the code works, most of the stuff in string.c I feel is bit more advanced than what I'm capable of accomplishing at this moment in time.

I've searched on Google and some of the Code Repositories, but I've been unable to find what I'm looking for.

Does anyone know of any codebases that support this, any snippets that may be available, or is anyone bored and feel like writing something up?

I've stared at this problem for a while and nothing is coming to me, and while I'll perhaps be able to one day handle it, I'd rather not make the fellow wait and have come seeking any help if anyone would be so kind.

I appreciate any helpful responses. Thanks :)
30 Apr, 2007, Zeno wrote in the 2nd comment:
Votes: 0
Does the code not have a command in append mode to goto a line, or to delete a line? I know Smaug does, and if your codebase does you could just look over those two sections of code and code something in to get the number of lines, go to the last line, and delete it.
02 May, 2007, Omega wrote in the 3rd comment:
Votes: 0
My mud supports it, email me and i'll send you my delete-last-line function.
ldevil@hotmail.com

incase its not listed here.

anyways, thats it. enjoy.
02 May, 2007, Davion wrote in the 4th comment:
Votes: 0
You should post it here, or in the pastebin for all to see!
03 May, 2007, Conner wrote in the 5th comment:
Votes: 0
Maybe he doesn't want you to see it after your meaness in his absence thread. :tongue: :wink:
(or, more likely, perhaps he's not ready to officially release it or it's not his to release. *shrug*)
03 May, 2007, Omega wrote in the 6th comment:
Votes: 0
the reason i do not release it publicaly is because its not on my things to release list.
04 May, 2007, Conner wrote in the 7th comment:
Votes: 0
As good a reason as any.
04 May, 2007, Skol wrote in the 8th comment:
Votes: 0
Check the string.c file in QuickMud.
It has .li (line insert), .ld (line delete), line numbering, as well as .lr line replace (string/string) etc.
04 May, 2007, kiasyn wrote in the 9th comment:
Votes: 0
essentionally all this would have to do is /d editor->online
04 May, 2007, Hades_Kane wrote in the 10th comment:
Votes: 0
Darien, I sent you an email. I appreciate the help.


Skol, we have all of that too. What I've been trying to figure out is one command to go to the last line in append mode and remove it. Of course, it's entirely possible just to do a ".s" to see all of the lines, and then ".ld #" to delete that last line, but when my builder requested it, I didn't think it would be a bad idea as a small time saver when you know you messed something up on the last line and would like to have it quickly removed and keep going.
05 May, 2007, Skol wrote in the 11th comment:
Votes: 0
Ah ok, I see what you mean!

Look at the do_description command in stock rom.
Desc - yanks the last line.

if (argument[0] == '-')
{
int len;
bool found = FALSE;

if (ch->description == NULL || ch->description[0] == '\0')
{
send_to_char ("No lines left to remove.\n\r", ch);
return;
}

strcpy (buf, ch->description);

for (len = strlen (buf); len > 0; len–)
{
if (buf[len] == '\r')
{
if (!found)
{ /* back it up */
if (len > 0)
len–;
found = TRUE;
}
else
{ /* found the second one */

buf[len + 1] = '\0';
free_string (ch->description);
ch->description = str_dup (buf);
send_to_char ("Your description is:\n\r", ch);
send_to_char (ch->description ? ch->description :
"(None).\n\r", ch);
return;
}
}
}
buf[0] = '\0';
free_string (ch->description);
ch->description = str_dup (buf);
send_to_char ("Description cleared.\n\r", ch);
return;
}


Should be decently simply to use that logic to apply to any block of strings. :)

Have a great weekend!
0.0/11