8000 Fix: Show send(cmd, true) on screen despite profile setting by mpconley · Pull Request #7881 · Mudlet/Mudlet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix: Show send(cmd, true) on screen despite profile setting #7881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: development
Choose a base branch
from

Conversation

mpconley
Copy link
Contributor
@mpconley mpconley commented May 31, 2025

Brief overview of PR changes/additions

This PR updates the behavior of the send() function so that its showOnScreen argument consistently overrides the global "Show the text you sent" setting in both directions. Previously, send(cmd, false) would suppress echo regardless of the global setting, but send(cmd, true) would not show the text if the global setting was disabled. Now, explicitly passing true or false to showOnScreen will always control whether the sent text is echoed, making the behavior more predictable and script-friendly.

Motivation for adding to Mudlet:

Resolves inconsistent behavior reported in #6919, improving script compatibility and user control over input echoing.

Other info (issues closed, discussion etc):

Closes #6919. No changes to default behavior unless showOnScreen is explicitly set in scripts.


Left is before the PR, right is after the PR:

  1. "Show the text you sent" ✅ + send(cmd, true)
  2. "Show the text you sent" ✅ + send(cmd, false)
  3. "Show the text you sent" ❌ + send(cmd, true) ◀️ The change == smile prints!
  4. "Show the text you sent" ❌ + send(cmd, false)
Screenshot 2025-05-31 at 6 19 26 PM

This is a video of the above in action, before the PR, after the PR:

Screen.Recording.2025-05-31.at.6.15.06.PM.mov

@mpconley mpconley requested a review from a team as a code owner May 31, 2025 22:19
@mpconley mpconley self-assigned this May 31, 2025
@add-deployment-links
Copy link
add-deployment-links bot commented May 31, 2025

Hey there! Thanks for helping Mudlet improve. 🌟

Test versions

You can directly test the changes here:

Copy link
Member
@vadi2 vadi2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn't a right and a wrong way here, as it all depends upon the perspective - do you give the control to the player (option overrides scripts), or do you give control to the scripts here (scripts can override the option)?

Moving control from the players to the script like this might backfire with some players who'd prefer not to see the commands on the screen, despite what the script wants. Some scripts could have also been written with this option in mind working the way it is now.

So this isn't necessarily fixing an issue per se, but changing how the option works from one way to the other. I'm on the fence about this for this reason, esp. since we've just had just one feedback of this, not dozens.

Thoughts from others?

@mpconley
Copy link
Contributor Author
mpconley commented Jun 1, 2025

Currently, the impact of "Show the text you sent" is quite broad. As a user, I would expect this setting to filter out only what I type directly, but it actually affects much more.

As demonstrated in the current state (see left image), unchecking "Show the text you sent" suppresses the echo of the lua command. This suppression applies not only to manually typed commands, but also to commands sent from actions, aliases, keys, timers, and triggers—even though the default for send is true for showOnScreen in these contexts.

Would it make sense to reconsider this setting? For example, we could change it to "Text from commands sent:" and offer three scopes:

  1. Show all commands (showOnScreen not set as false)
  2. Show only commands with showOnScreen set as true
  3. Never show command text (ignore showOnScreen)

More detail:

  1. Show all commands sent from actions, aliases, manually typed commands, keys, timers, and triggers
  2. Show only commands explicitly set to display
  3. Do not show text from any of these sources

Would this be more intuitive for users? Open to thoughts from others!

@@ -1240,12 +1240,13 @@ QPair<QString, QString> Host::getSearchEngine()
// cTelnet::sendData(...) call:
void Host::send(QString cmd, bool wantPrint, bool dontExpandAliases)
{
if (wantPrint && (!mIsRemoteEchoingActive) && mPrintCommand) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👎 The "profile" setting is entirely contained within this use of mPrintCommand - so removing it here renders everything else about the setting as dead cruft in several files.

Perhaps, the default setting of mPrintCommand to true - currently in the Host constructor initialisation list but really should be moved to the header file - should be amended to false instead - would this address the discomfort you have with this setting @mpconley?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other place this is used is TCommandLine::enterCommand(QKeyEvent* event) for MiniConsole.

Showing what text is sent is my preferred default option for a profile, as-is. This is a nuance for sure.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, you are right, my searching was flawed and didn't give me that second usage. I suppose there is an option to turn the control in the preferences into a tri-state - with the default being partially checked meaning - "go with the Lua arguments" and the other two being always/never show the send command.

🤷

@vadi2
Copy link
Member
vadi2 commented Jun 13, 2025

I'm wary of adding more detail to the option - and thus making it harder to use - without a good amount of impetus behind this from the playerbase. I'll ask around to see if there is a need for it! Should there be large demand, we should go with it. Otherwise, better to keep things simpler.

@mpconley
Copy link
Contributor Author

I don't have an emotional tie to this PR, but I want to give the issue requester a chance, so I will present a case. A bit dramatic perhaps, but a scenario:

We have a package repo now for a world of authors. A package may have something critical to tell a user from its functionality. A core dev may have reviewed that package and gave it a 👍 because it informed the user of something. The package gets deployed, used for months, and then it is found that something unwanted is occuring consistently to multiple users and no one knows why. The package author did their diligence - they sent output. The core dev did not consider this "feature" of Mudlet. The end-user did not think that would have been an effect of checking a box to not "Show the text you sent". But Mudlet scoped out the critical script output with that checkbox, and now people are scared to use packages from others anymore, the package repo dies, and people start looking for their ZMud license codes.

Let's enable presenting information to people wherever we can, unless the opt-out is very clear.

@ZookaOnGit
Copy link
Collaborator

I agree with the intent of the PR here.

As a user, I would expect this setting to filter out only what I type directly, but it actually affects much more.

This was what I originally thought the preference was for as well. I would also think that any 'send command directly to the game' options would follow this setting ie., Command boxes in aliases and keybindings. I would assume that send() would be toggleable as per the API.

Showing what text is sent is my preferred default option for a profile, as-is.

Agreed: I manually sent a command, I need feedback that this command has been sent, otherwise lag (whether network or game imposed) may see me sending it again with disastrous consequences.

I'm wary of adding more detail to the option

Agreed: we are trying to simplify preferences.

I note in the tooltip that the server can turn this option off. How does this affect scripts with/without the patch? Is the result expected?

Lastly, perhaps scripts should be using a 'best practice' with getConfig("showTextSent") if certain things should be displayed or not? e.g., always show for ultra laggy multi-command functions, or not for one-liner quick return functions. This patch at least gives that option now.

e.g.,

function autoEat()
   local echoCmd = getConfig("showTextSent")
   send("eat apple", echoCmd)
end

@mpconley
Copy link
Contributor Author
mpconley commented Jun 17, 2025

I note in the tooltip that the server can turn this option off. How does this affect scripts with/without the patch? Is the result expected?

The note in the tooltip is geared toward the ECHO handling with the server, however it is possible for a script to toggle showTextSent. While setConfig("showTextSent") is a helpful function (perhaps used for a11y), it could be used with unwanted intent by a script, too.

Should certain settings come with a prompt to ensure the user is OK with changing the setting?

@mpconley
Copy link
Contributor Author

Lastly, perhaps scripts should be using a 'best practice' with getConfig("showTextSent") if certain things should be displayed or not?

Great idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Send()'s showOnScreen argument only overrides "Show the text you sent" in one direction
4 participants
0