[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Aborting command within OnPluginCommandEntered without clearing command window?

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Aborting command within OnPluginCommandEntered without clearing command window?
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by j0nas   (56 posts)  [Biography] bio
Date Wed 12 Jul 2006 10:08 PM (UTC)  quote  ]
Message
It does indeed, thank you!
[Go to top] top

Posted by Nick Gammon   Australia  (18,801 posts)  [Biography] bio   Forum Administrator
Date Wed 12 Jul 2006 10:04 PM (UTC)  quote  ]

Amended on Wed 12 Jul 2006 10:05 PM (UTC) by Nick Gammon

Message
In the meantime, this seemed to work OK:


  -- if check failed, cancel sending
  if check == 0 then
    DoAfterSpecial (0.1, string.format ("PasteCommand (%q)", sText), 12)
    return '\t'	-- cancelled, don't process
  end


This introduces a slight delay, which lets MUSHclient clear the command window, and then puts the command back, that should be a workaround for now.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (18,801 posts)  [Biography] bio   Forum Administrator
Date Wed 12 Jul 2006 09:27 PM (UTC)  quote  ]
Message
Hmmm, I didn't think of that. :)

There is another bug too, it shouldn't clear the command window if "auto-repeat" is set.

Version 3.76 will offer a new option - if you return the \r character, the command will not be sent, but will be retained in the command window.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by j0nas   (56 posts)  [Biography] bio
Date Wed 12 Jul 2006 05:50 PM (UTC)  quote  ]

Amended on Wed 12 Jul 2006 05:55 PM (UTC) by j0nas

Message
I'm trying to implement spellchecks for certain inputs only, like says, poses, <whatever>, but not anything else like movement-commands and such. Initially, I did that using Nick's OnPluginCommand-example, but it turns out I can't have the input parsed by my aliases and OnPluginCommand at the same time, so I promptly upgraded to 3.75 and started using OnPluginCommandEntered instead.

The problem I'm having now is, I can't find a way to abort the sending of the text without also wiping the input from the input-buffer permamently, no way to get it back. I'd like to be able to cancel the spellcheck to add/remove something, without having to rewrite the entire <whatever>.

Right now, I have this Lua stuffed into a plugin:


function OnPluginCommandEntered (sText)
  a, b, c = rex.new ("(?:say |:|spoof |ooc |page \w+|whisper \w+)(.+)"):exec (sText)

  if a == nil then
    return sText  -- not matched our regular expression
  end

  -- matched regular expression - check the command
  check = SpellCheckCommand (c [1], c [2])

  -- if check failed, cancel sending
  if check == 0 then
  	SelectCommand()
    PasteCommand(sText)
    return '\t'	-- cancelled, don't process
  end

  -- get the amended command, send that instead
  return GetCommand ()
end



Any suggestions?
[Go to top] 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.


1,318 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]