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

Release notes for MUSHclient version 3.75


Version 3.75

Released on 11 Jul 2006

1. Changed the behaviour of the Accelerator script function, so that if you set a key combination to the empty string, the accelerator is removed (rather than that key combination doing nothing).

This lets you return to the original behaviour, as if the Accelerator function had never been applied to that key.

eg.

Accelerator ("a", "attack") --> pressing "a" sends "attack" to the MUD
Accelerator ("a", "") --> pressing "a" simply enters "a" into the command window

Also made some changes to the way it recognises certain keys. It seems that "OEM" keys were not being properly processed. These keys should now work:

; + , - . / ` [ \ ] '


2. Added new plugin callback: OnPluginCommandEntered

The player has typed some text into the command window and pressed <Enter>.

You can modify the command in this function, and return the modified string which is what will be sent to the command processor.

If you return an empty string, that will sent to the command processor.

If you return a tab character on its own (\t or hex 09) then the command will be discarded, and the command window cleared.

This differs from OnPluginCommand which processes individual command lines, after command stacking and other processing has taken place.

The (Lua) example below replaces line breaks by %r.

You might use this to implement your own "rules" for evaluating command stacking, spell checking, keeping a command history, and so on.


function OnPluginCommandEntered (s)
return string.gsub (s, "\r\n", "%%r")
end -- OnPluginCommandEntered


3. Fixed error in Lua_Chat.xml plugin where (near the end of the script) the line:

Note (GetPluginInfo (GetPluginID, 3))

should have read:

Note (GetPluginInfo (GetPluginID (), 3))


4. Changed the way scripts are called in Lua to allow periods in the script name. Thus a script (called from a trigger, timer, or alias) could now be called: timer_scripts.timer4

This only affects Lua scripting, and is intended to allow script-writers to make their scripts neater by putting (say) all timer scripts into a single table.

What MUSHclient does in this case is split up the name at the periods, and repeatedly locate the table (eg. "timer_scripts" in the above example) and index into that to find the next table, until it is left with a function that can be called as the final item.


5. Added new selectors to GetTriggerInfo, GetTimerInfo and GetAliasInfo to return a boolean to show whether or not the script name is valid. It will be true if there is a script name and that script function was found in the script file, and has previously executed without errors (or not executed at all), false otherwise.


6. Added a new feature to the Triggers, Timers, Aliases, and Variables world configuration dialog listing.

There is now a "filter" checkbox, which lets you specify a script to conditionally filter the items displayed in the list. This is intended for "power" users who may have hundreds of triggers etc. and who need to find one that matches a complex criteria. For example, to find all triggers that had bad script names (ie. a script name, but the script wasn't found in the script file):

-- check for bad scripts
function filter (s)

if not GetTriggerInfo (s, 34) and -- script not compiled OK?
GetTriggerInfo (s, 4) ~= "" then -- had script name?
return true -- show it
end

return false -- hide it
end -- filter

Adjacent to the filter checkbox is a button labelled "..." which, if you click on it, leads you to script-editing dialog box. Inside that you need to place a function, written in Lua, that executes in its own Lua address space. This function has available to it all of the "world" and other functions available in the normal Lua address space. It uses its own space in case you are using a different script language for the main world (eg. VBscript).

The function must be named "filter" and has a single argument, which is the name (key) of the item which is about to be displayed in the list. This would be the trigger/timer/alias/variable name.

You can use that to do GetTriggerInfo/GetTimerInfo/GetAliasInfo/GetVariable to find more details about the item in question, and then decide if you want it shown in the list or not.

Another example, shows all triggers that use regular expressions:

function filter (s)

if GetTriggerInfo (s, 9) then -- regexp
return true
end

return false
end -- filter


The default is for the item to be displayed. You must return a boolean value of false for the item to be not displayed.

Here is an example which filters aliases so that only non-enabled ones are shown:

function filter (s)
return not GetAliasInfo (s, 6)
end -- filter

The script text for all four types (triggers/timers/aliases/variables) are saved to the world file, so they are available for next time. The state of the filter flag is NOT saved, so that the default is always to display everything. However clicking the checkbox (or pressing Alt+I) will enable the filtering.

An example of filtering triggers/timers/aliases is provided in the file Example_Filters.lua which ships with MUSHclient.

7. Added new dialog box under the menu Input -> Key Name. This lets you type a key and see what its "Accelerator" name is. In some cases it is not intuitive, for example the "&" key is really "Shift+7". You can use this dialog to quickly test various keys (including Shift, Alt, Control combinations) and then copy the corresponding name from the dialog box into your script.


8. Added new DoCommand functions "Maximize" and "Restore". These let you script maximizing and restoring the world window.


9. Added new plugin callback: OnPluginTabComplete

The player has typed some text into the command window, pressed <Tab>, and the tab completion processing has found a match.

You can modify the match in this function, and return the modified string which is what will be taken as the tab completion string.

The primary intention here is for players using screen readers, to that the screen reader can echo the replacement text (speak it). eg.

function OnPluginTabComplete (s)
utils.msgbox (s, "Tab completing")
end -- OnPluginTabComplete


10. Added new selectors 236 and 237 to function GetInfo - these give the start and end column of the currently-selected text in the command window.


11. Added new selector 238 to function GetInfo. This give the "show state" of the first world window for this world.


12. Improved the "Lua sandbox" default a bit to make it more readable, in the way that it enables some of the "os" functions.

View all MUSHclient release notes

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.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

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

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]