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
➜ MUSHclient
➜ Bug reports
➜ Echo of input command break the output line
Echo of input command break the output line
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Jcl
(42 posts) Bio
|
Date
| Wed 29 Jul 2015 09:04 AM (UTC) |
Message
| When receiving plenty of lines from the server, the echo of the input command probebly break a output line into two. | Top |
|
Posted by
| Fiendish
USA (2,534 posts) Bio
Global Moderator |
Date
| Reply #1 on Wed 29 Jul 2015 06:41 PM (UTC) |
Message
| Probably? |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #2 on Wed 29 Jul 2015 08:27 PM (UTC) |
Message
| Input lines arrive in packets. It is possible that if you type something, and have it echoed, the client would think that the last packet has finished, terminate that line, and then echo your command.
There is no way it can know there is more data coming "soon".
What you could do is make a plugin which handles OnPluginPacketReceived, and batch up incoming lines as they arrive, and only "release" them once a newline is found. That would stop lines being split up.
The bad part is that you wouldn't see "prompts", like when you first connect and it asks your name and password. You could disable the plugin on world connect, or have a flag to tell it not to do it until 20 seconds after connecting, or until a certain line has arrived, for example.
There are examples of batching up lines on this site. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Jcl
(42 posts) Bio
|
Date
| Reply #3 on Thu 30 Jul 2015 01:09 AM (UTC) |
Message
| Although there is no way it can know there is more data coming "soon", but you have the ability to know if the packets is coming currently or not.
If not coming currently then echo it immediately, otherwise echo it after a newline. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #4 on Thu 30 Jul 2015 05:29 AM (UTC) |
Message
| User input (command input) is not echoed back during the processing of a packet. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Jcl
(42 posts) Bio
|
Date
| Reply #5 on Fri 31 Jul 2015 02:27 PM (UTC) |
Message
|
Nick Gammon said:
User input (command input) is not echoed back during the processing of a packet.
I think you should be able to judge whether there was a packet arrived within the past one millisecond.
If not so then echo it immediately, otherwise echo it after a newline. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #6 on Fri 31 Jul 2015 10:44 PM (UTC) |
Message
| What? You want me to know whether a packet arrives in the future, not the past.
I can't tell whether or not another packet will arrive in one millisecond, 100 ms or 5 minutes. And if I build in any sort of delay everyone is going to whine that the client does not show data as soon as it arrives. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Jcl
(42 posts) Bio
|
Date
| Reply #7 on Sat 01 Aug 2015 02:11 AM (UTC) |
Message
| I said that "arrived within the past one millisecond."
Is it ambiguous? I am very sorry for that.
I meant the past, not the future. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #8 on Sat 01 Aug 2015 04:46 AM (UTC) |
Message
|
Quote:
If not so then echo it immediately, otherwise echo it after a newline.
If I understand you correctly, you are saying to wait for a newline before echoing the packet. However that won't work for prompts when the MUD asks:
With no newline.
And it's no good saying "only do that if another packet is going to come in a millisecond" - how do I know that? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Jcl
(42 posts) Bio
|
Date
| Reply #9 on Mon 03 Aug 2015 05:01 AM (UTC) |
Message
| I am very sorry for the ambiguous meaning. I try to express more clearly.
When user typed input command, If no packets were received in the past one millisecond, the input command should be echoed immediately. If there were any packets received in the past one millisecond, the input command should be echoed after a newline.
I write some simple code to explain.
On Packet Received:
long lastPacketTime = GetSystemTimeInMilliseconds();
if (cacheOfInputCommand.size() > 0) {
int newLinePos = packetStr.find_first_of(NEW_LINE_CHAR);
if (newLinePos != string:npos) {
DisplayOutput(packetStr, 0, newLinePos);
DisplayNewLine();
EchoInputCommand(); // echo the input command after the newline.
DisplayOutput(packetStr, newLinePos, packetStrLength);
} else {
DisplayOutput(packetStr, 0, packetStrLength);
}
} else {
DisplayOutput(packetStr, 0, packetStrLength);
}
On Input Command:
if (lastPacketTime < GetSystemTimeInMilliseconds() - 1) {
EchoInputCommand(); // echo the input command immediately
} else {
CacheInputCommand(); // put the input command into cacheOfInputCommand for later use. see OnPacketReceived.
}
| 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.
24,109 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top