Documentation. First post is always kind of manual page, being continuously updated by author. Following posts are discussion about the topic.
Post Reply
Site Admin
Posts: 425
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic


Post by admin » 19 Sep 2015, 22:14

This one is quite simple: LuaMacros can talk to you! Sometimes you want some confirmation that macro was triggered, code was done, mode was changed, whatever. When interfacing Xplane you can use command lmc_xpl_text which will show text at simulator's screen.
But now (version and later) you can also use command lmc_say and some nice lady from windows will talk to you :-).
You can try yourself with code

Code: Select all

lmc_say('Hello world')
No big deal - as I said, this is simple but useful.

One more script for Xplaners, little more complicated. This will call selected radar altitudes when getting close to ground. Now it talks in both way, but comment out one of the lmc_say commands if you need only landing notifications:

Code: Select all

gLastRAltInterval = 0
gRAltCalls = {5, 10, 20, 50, 100, 200, 500}

function getRAltInterval(value)
  if value < gRAltCalls[1] then
    return 0
  for i = 1,#gRAltCalls do
    if value <= gRAltCalls[i] then
      return i-1
  return #gRAltCalls

function checkRAlt(cra)
  curIndex = getRAltInterval(cra)
  if gLastRAltInterval ~= curIndex then
    if gLastRAltInterval > curIndex then
      lmc_say('' .. gRAltCalls[gLastRAltInterval])
      lmc_say('' .. gRAltCalls[curIndex])
    gLastRAltInterval = curIndex

lmc_on_xpl_var_change('sim/cockpit2/gauges/indicators/radio_altimeter_height_ft_pilot', checkRAlt, 1000)
Disclaimer: For the speech engine Microsoft speech API is used. I have neither idea nor tests about compatibility. It works at my Windows7 64bit and should work almost everywhere (Vista+ I suppose), but this is some COM magic so don't be upset if your computer keeps silent...
Petr Medek
HIDmacros author

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest