Welcome to the Builder Academy

Question How do I clear the blank line after a socials command?

More
02 Apr 2018 11:41 #7867 by cry1004
500H 100M 82V (news) (motd) > Accuse Enter

500H 100M 82V (news) (motd) > Accuse who??
<<<< This Blank Line
500H 100M 82V (news) (motd) >

ex)
500H 100M 82V (news) (motd) > Accuse Enter
500H 100M 82V (news) (motd) > Accuse who??
500H 100M 82V (news) (motd) >

I don't want the Compace option to erase all blank lines.
only socials command next blank line.

I'm sorry. I don't know English very well.

Please Log in or Create an account to join the conversation.

More
02 Apr 2018 13:28 - 02 Apr 2018 13:33 #7868 by lacrc
New lines are created by adding "\r\n" to the end of strings sent to send_to_char() function (act() already includes newlines).

So I believe the specific "\r\n" that you need to remove is this one, in act.social.c:44 :
Code:
if (!argument || !*argument) { send_to_char(ch, "%s\r\n", action->char_no_arg); /* <---- remove the '/r/n' after %s */ act(action->others_no_arg, action->hide, ch, 0, 0, TO_ROOM); return; }
Can you check if that works for you?

On a side note, removing that will also remove newlines from emotes which do not need a target (ie. dance).
You could check for that using the fact that all socials that do not require a target also have "action->others_no_arg" set and not null. So the check would be something like this:
Code:
if (!argument || !*argument) { send_to_char(ch, "%s%s", action->char_no_arg, action->others_no_arg ? "\r\n" : ""); /* <--- this will check if there is a message to be sent to others and add a newline only if something was sent to the room */ act(action->others_no_arg, action->hide, ch, 0, 0, TO_ROOM); return; }
But not sure if that would be enough for you since most of socials.new have "others_no_arg" set.
Last edit: 02 Apr 2018 13:33 by lacrc.

Please Log in or Create an account to join the conversation.

More
02 Apr 2018 14:49 #7869 by cry1004

Please Log in or Create an account to join the conversation.

More
07 Apr 2018 17:23 #7892 by Parnassus
Am I missing something?

> accuse
Accuse who??

I don't see a blank line. I thought it might be because I use an outdated version but I saw the same thing online. I thought it was possibly related to toggle compact but I see that my home version has it toggled on and the online version has it toggled off.

Please Log in or Create an account to join the conversation.

Time to create page: 0.179 seconds