Gammon Forum
Entire forum
MUSHclient
General
Execute without echo
It is now over 60 days since the last post. This thread is closed.
  Refresh page
Posted by
| Shadox
(2 posts) bio
|
Date
| Sun 13 Sep 2009 05:25 PM (UTC) |
Message
| Is there any way to send an Execute style command, meaning one that will be evaluated against aliases, without it local echoing? I can find no way to do it. | top |
|
Posted by
| Blainer
(191 posts) bio
|
Date
| Reply #1 on Sun 13 Sep 2009 11:20 PM (UTC) Amended on Sun 13 Sep 2009 11:44 PM (UTC) by Blainer
|
Message
| I have echo off for all my commands.
Game -> Configure -> Commands menu has an Echo My Input Option. This will toggle echoing all your commands.
Help for the Commands dialog is here.
http://mushclient.com/scripts/doc.php?dialog=IDD_PREFS_P9
The is an option on the alias or trigger dialog to Omit from Command history.
To send one command without echoing it use this function.
| top |
|
Posted by
| Shadox
(2 posts) bio
|
Date
| Reply #2 on Mon 14 Sep 2009 01:51 AM (UTC) |
Message
| That doesn't address my issue.
I'm scripting, and at present just setting EchoInput to False, sending all of my commands, and then changing it back to true.
The issue is sending commands (in a script) with execute level processing but having them not echo (primarily those commands that turn out to not get processed as aliases, as an alias can already be set to not echo). | top |
|
Posted by
| Blainer
(191 posts) bio
|
Date
| Reply #3 on Mon 14 Sep 2009 02:13 AM (UTC) Amended on Mon 14 Sep 2009 02:15 AM (UTC) by Blainer
|
Message
| Sorry I didn't understand your post. As a work around until an expert can answer this worked for me.
SetOption ("display_my_input", 0)
Execute ("look")
SetOption ("display_my_input", 1)
| top |
|
Posted by
| Nick Gammon
Australia (22,975 posts) bio
Forum Administrator |
Date
| Reply #4 on Mon 14 Sep 2009 10:19 AM (UTC) |
Message
| I am inclined to agree with Blainer. Make your own execute function like this:
function ExecuteNoEcho (whatever)
SetOption ("display_my_input", 0)
Execute (whatever)
SetOption ("display_my_input", 1)
end -- function
Then in your script call ExecuteNoEcho instead of Execute. Anything that execute does, that would have echoed your input, won't.
Or, if you have lots of scripts with Execute in them and don't want to rename Execute as ExecuteNoEcho, you could do this in your script file:
function fixup_execute ()
local Execute = Execute
return function (whatever)
SetOption ("display_my_input", 0)
Execute (whatever)
SetOption ("display_my_input", 1)
end
end -- function
Execute = fixup_execute ()
That replaces the Execute function with one that saves a copy of the original, changes the option, executes the original Execute, and puts the option back. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Fiendish
USA (2,514 posts) bio
Global Moderator |
Date
| Reply #5 on Mon 04 Apr 2016 03:09 PM (UTC) |
Message
| The previous replies in this thread are bad. Safer code would be
local original_echo_setting = GetOption("display_my_input")
SetOption ("display_my_input", 0)
Execute (whatever)
SetOption ("display_my_input", original_echo_setting)
|
https://github.com/fiendish/aardwolfclientpackage | top |
|
Posted by
| Nick Gammon
Australia (22,975 posts) bio
Forum Administrator |
Date
| Reply #6 on Mon 04 Apr 2016 08:18 PM (UTC) |
Message
| My code was bad in the sense it assumed echo was already on. Fiendish has a point that if it is already off, my suggestion would turn it on. So an improved function would be:
function ExecuteNoEcho (whatever)
local original_echo_setting = GetOption("display_my_input")
SetOption ("display_my_input", 0)
Execute (whatever)
SetOption ("display_my_input", original_echo_setting)
end -- function
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | 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.
22,534 views.
It is now over 60 days since the last post. This thread is closed.
  Refresh page
top
Quick links:
MUSHclient.
MUSHclient help.
Forum shortcuts.
Posting templates.
Lua modules.
Lua documentation.
Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.