Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, 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.
Entire forum
➜ MUSHclient
➜ General
➜ Send without newline
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Daniel P
USA (97 posts) Bio
|
Date
| Sat 21 Dec 2013 02:01 PM (UTC) |
Message
| 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)? | Top |
|
Posted by
| Nick Gammon
Australia (23,057 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sat 21 Dec 2013 03:45 PM (UTC) |
Message
| |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Daniel P
USA (97 posts) Bio
|
Date
| Reply #2 on Tue 24 Dec 2013 07:37 AM (UTC) |
Message
| 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? | Top |
|
Posted by
| Daniel P
USA (97 posts) Bio
|
Date
| Reply #3 on Tue 24 Dec 2013 07:42 AM (UTC) Amended on Tue 24 Dec 2013 07:44 AM (UTC) by Daniel P
|
Message
| Dang.. Few more SQL errors got my browser a bit twisted and I ended up replying twice. I'll email you about that. | Top |
|
Posted by
| Nick Gammon
Australia (23,057 posts) Bio
Forum Administrator |
Date
| Reply #4 on Tue 24 Dec 2013 01:55 PM (UTC) |
Message
| Don't over-think it. This should be fine:
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,057 posts) Bio
Forum Administrator |
Date
| Reply #5 on Tue 24 Dec 2013 01:58 PM (UTC) |
Message
| 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. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Daniel P
USA (97 posts) Bio
|
Date
| Reply #6 on Wed 25 Dec 2013 02:44 PM (UTC) |
Message
| Thank you so much. I'll give it a go. | 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.
19,682 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top