Send without newline

Posted by Daniel P on Sat 21 Dec 2013 02:01 PM — 7 posts, 28,269 views.

USA #0
So it looks like in all of the help documentation, Send and its derivatives automatically append a newline character after every bit of text you try to send.

As I sometimes like to use MUSHClient for serial applications using a COM port redirector, some of the applications I use don't wait for a newline to start executing stuff (i.e. A prompt asking for "y/n" will detect the "y" character and start executing instantly, and the extra return character starts wreaking havoc with default selections in an ascii menu system or selection).

Is there any way to send a string but trim off the tailing newline character(s)?
Australia Forum Administrator #1
Template:function=SendPkt
SendPkt

The documentation for the SendPkt script function is available online. It is also in the MUSHclient help file.

USA #2
Ah very good. Thank you.

One thing I've noticed with this function though...is that so far the MUD community really has only used this command solely for the purpose of the common subnegotiation stuff, so all the examples I've never seen with this command used are (in my mind) slightly confusing telnet option commands.

So then, if I were given my above example of "Do you want to continue (y/n)?" and the "y" character or "n" character were the single characters to be processed, could I do something as simple as:


<trigger
 enabled="y"
 match="^(y|n)$"
 regexp="y"
 send_to="12"
>
<send>SendPkt("%1")</send>
</trigger>


or do I need to, for whatever reason, encode each character as a byte and re-encode into char as is given in the subnegotiation command examples? Like:

<send>
if "%1" == "y" then
  SendPkt(string.char(121))
elseif "%1" = "n" then
  SendPkt(string.char(110))
end -- if
</send>


Or is the only reason for doing this byte-to-char encoding is in case you were running a MUD in UTF-8, but needed to send pure ASCII text in the middle of it?
USA #3
Dang.. Few more SQL errors got my browser a bit twisted and I ended up replying twice. I'll email you about that.
Amended on Tue 24 Dec 2013 07:44 AM by Daniel P
Australia Forum Administrator #4
Don't over-think it. This should be fine:


SendPkt("y")
Australia Forum Administrator #5
I should point out though that SendPkt jumps any queued output. So for example if you were speedwalking and there was a queue of speedwalk output, then SendPkt would not go to the end of the queue.

It sounds like this won't apply to you.
USA #6
Thank you so much. I'll give it a go.