keyboard events/send/execute

Posted by Ogomez92 on Mon 03 May 2010 06:16 PM — 5 posts, 22,359 views.

#0
Hi,
I'm trying to code a little function for the tts plugins that interrupts when the user hits enter. I tried using OnPluginCommandEntered for this, and it worked fine but whenever the plugin uses world.Execute for aliases, it stops speech and we don't want that. So, is there a way to send a command for aliases to process without it actually going through OnPluginCommandEntered? I tried Send, but of course send wouldn't process the aliases.
Alternatively, I could use some kind of OnKeyPress so when the user hits enter it stops the speech.
Thnx all.
#1
If any of you are wondering why we use alias calls inside scripting is so we can call plugin functions inside other plugins without having to use callPlugin. It's easier to use Execute("history_add text") than CallPlugin("longid","func","param")
:)
Australia Forum Administrator #2
Would backslash be acceptable? That is just above Enter on a lot of keyboards and is usually a bit larger than the other keys. Then you can just use the AcceleratorTo script function to stop the speech.

Or do you mean not so much "when the player hits enter" as "when the player manually enters a command"?
#3
I mean when the player manually enters a command. By backslash, you mean that instead of pressing enter we'd have to hit backslash to send text? Or, do you mean binding enter to an accelerator - if that's even possible - to stop the speech and send the text?
If so, I guess that would work just as well.
Australia Forum Administrator #4
Ogomez92 said:

I tried using OnPluginCommandEntered for this, and it worked fine but whenever the plugin uses world.Execute for aliases, it stops speech and we don't want that.


According to this:

Template:post=6572
Please see the forum thread: http://gammon.com.au/forum/?id=6572.


... OnPluginCommandEntered should *not* be called when you call world.Execute. And indeed a quick test shows that if you call Execute it does not call OnPluginCommandEntered. So you should be able to use OnPluginCommandEntered to distinguish between manually-entered commands and scripted commands.