Some ideas presented in another thread show how to speak things using the SAPI COM object:
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=6586
As that is a VBscript thread, in the Lua section I will show how you could make a trigger that speaks a warning when your health is low:
For this to work you need luacom.dll in the same directory as MUSHclient.exe, which I found at:
This uses a test on the "talk" variable to save re-instantiating the COM object every time the trigger fires. It also does asynchronous speaking (thanks, Ked!) so the client does not pause while it speaks.
It also remembers the last health level to save repeating the same value.
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=6586
As that is a VBscript thread, in the Lua section I will show how you could make a trigger that speaks a warning when your health is low:
<triggers>
<trigger
enabled="y"
match="^\<(\d+)\/(\d+)hp (\d+)\/(\d+)m (\d+)\/(\d+)mv (\d+)\/(\d+)xp\>"
regexp="y"
send_to="12"
sequence="100"
>
<send>if not talk then
assert (loadlib ("luacom.dll","luaopen_luacom")) ()
talk = assert (luacom.CreateObject ("SAPI.SpVoice"), "cannot open SAPI")
end -- no talk yet
if %1 < 100 and oldhealth ~= %1 then
talk:Speak ("Health is down to %1!", 1)
oldhealth = %1 -- remember health level
end -- low health</send>
</trigger>
</triggers>
For this to work you need luacom.dll in the same directory as MUSHclient.exe, which I found at:
http://luaforge.net/frs/download.php/922/luacom-1.3-luabinaries-bin.zip
This uses a test on the "talk" variable to save re-instantiating the COM object every time the trigger fires. It also does asynchronous speaking (thanks, Ked!) so the client does not pause while it speaks.
It also remembers the last health level to save repeating the same value.