Plugin Callback

Posted by Tspivey on Sun 02 Jul 2006 07:11 PM — 10 posts, 37,733 views.

Canada #0
In converting people over to Mushclient, we noticed that tab completion doesn't have a plugin callback. I am suggesting something similar to the following:
A function that takes 2 parameters: the word you typed before pressing tab, and the word that it got replaced with.
Australia Forum Administrator #1
You mean with the option to change that replacement?

eg.


function OnPluginTabCompletion (before, after)

 if before == "foo" then
  return "bar"
 else
  return after
 end -- if

end -- OnPluginTabCompletion 
Amended on Mon 03 Jul 2006 07:03 AM by Nick Gammon
United Kingdom #2
Hi,
new on the scene here but also a blind Mushclient user (or soon to be, just as soon as I figure out the nuances of ShareIt).

Replacing would be nice - but it's like the argument for doing the same with the OnPluginLineReceived function on the plugins page - neat if you could do it, but for blind users who use screen reading software, the power is to intercept and announce the new word, more than changing what it does.

When I first started MUDding, I scripted the screen reader to work with the client.
This meant that you had to be in the clients window all the time, only certain things would be read, any pop-up windows (from the client or other programs) would interfeer, and if you come back to the Mud after answering something else - like an IM - the screen reader would think there'd been an entire redraw of the screen and read absolutely everything again.

Nowadays of course with Mushclient's superb balance of power and ease-of-use, you can script the client to work with the screen reader: I have a Mudding page at my site aimed toward blind users.
I have a feeling the content there will change to Mushclient specific info and or plugins within the next couple of weeks.

Er well sorry for ranting on - first post and all that, so hello and it's nice to be around.
Great program, very friendly to use and I think I've stated my case why I particularly would use the tab completion callback.

Sean.
Australia Forum Administrator #3
Ah that makes sense. You simply want to know if you pressed "ki" <tab> whether you will get "kick" or "kill" or something?

I don't see a big problem in doing that. :)

Quote:

I have a Mudding page at my site aimed toward blind users.


I would be interested to read that. Positive feedback is an encouragement to developers to add support to their programs.

BTW, I'm not sure how easy the GUI interface is to use if you can't see much or at all. I never use screen reading software so I have no idea how well it represents dialog boxes with lots of checkbuttons etc.

The ideas presented in this thread might help:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=7123&page=999999

For example, assuming you install into your script space the script ItemToTable (near the bottom of the page), and use the tprint function provided in the supplied exampscript.lua file, then you could simply examine a trigger by typing:


t = ItemToTable ("trigger", "exits")
tprint (t)


In this case my trigger was called "exits". This would display (and thus have read out to you):


"enabled"="y"
"custom_colour"="2"
"name"="exits"
"sequence"="100"
"match"="Obvious exits:"


Now assuming you also install the functions mentioned in the first post on that page, you can change a value (like the enabled flag) and replace the trigger:


t.enabled = false
LuaAddTrigger (t)


This effectively would let you add or modify triggers, aliases and timers using a command-line type interface. I'm not sure if that is easier or not, but the option is there.




To find the names of all your triggers, you can do a simple script in Lua:


table.foreachi (GetTriggerList (), print)


You could start getting fancy and make an alias that gets the trigger list and filters it against a supplied regexp, to filter down to a handful.
United Kingdom #4
To be honest, I haven't even made any triggers or aliases yet.

The simple reason is, the only things I've done so far with Mushclient is to program on a MOO - not something that requires extensive tweeking insofar as modifying a client is concerned.

I did write a quick VBScript (I need to learn Lua properly) to send the MOO output to a notepad (listing code with a screen reader tends to rap).
Other than that, I've been limited to useing the nice features of mushclient, without actually needing to write any triggers or such.

I guess the UI would work fine - everything else does, including the plugin wizard and all the configuration screens.
Australia Forum Administrator #5
I have added a plugin callback to version 3.75 that has a single argument, the replacement text after tab completion. Basically you can use that to speak the replacement text. You could also modify it if you wanted (eg. by using a dialog box) to change the replacement text.
Canada #6
Great. Would there be a simple way to get the text before tab completion, also? That'd help with modification.
Australia Forum Administrator #7
Quote:

Would there be a simple way to get the text before tab completion, also?


It is fiddly to do because of internal design reasons. If it was desperately needed it could be done, however ...

Quote:

... but for blind users who use screen reading software, the power is to intercept and announce the new word, more than changing what it does ...


It seems to me that the main requirement is to know what the replacement word is. Thus assuming you can't see the screen, and you type "foo<tab>" an announcement that you will get "foot" would help, otherwise, you simply cancel (Ctrl+Z) and type something else.
United Kingdom #8
Never have I seen a developer so responsive - fantastic.
Are there betas of 3.75 I can play with, or did I miss an announcement?
Australia Forum Administrator #9
Not yet, check the main page of this forum:

http://www.gammon.com.au/forum/bbshowpost.php?bbsection_id=1

That is where new verions are mentioned (near the top), also:

http://www.gammon.com.au/forum/bbshowpost.php?bbtopic_id=1

The "News and Updates" forum is where the announcement will be made.

Quote:

Would there be a simple way to get the text before tab completion, also?


I have added a couple of new selectors to GetInfo, so that you can find the start and end column of the current selection. If you really wanted to, you could work out what the tab completion text (prior to completion) must be by taking that in conjunction GetCommand.