[X-Plane 11.32r2] No commands received by X-Plane

Announcements, questions
peewee
Posts: 9
Joined: 30 Mar 2019, 13:43

[X-Plane 11.32r2] No commands received by X-Plane

Post by peewee » 01 Apr 2019, 16:40

I've downloaded the file linked on the Download Page, and copied win.xpl to my /Resources/plugins/luamacros/64 folder. 

When I run luamacros.exe, the version number is shown as 0.1.1.98

When I startup X-Plane, my log.txt shows that the plugin has loaded

Code: Select all

Loaded: E:\Spel/X-Plane 11/Resources/plugins/luamacros/64/win.xpl (PetrMedek.LuaMacros.Controller).
And I wrote this test script

Code: Select all

-- lmc_print_devices()
lmc_device_set_name('XPlane01','20E1235')

function lights( type )
    if     type == "nav"  then
        lmc_xpl_command('sim/lights/nav_lights_toggle')
    elseif type == "bcn"  then
        lmc_xpl_command('sim/lights/beacon_lights_toggle')
    elseif type == "taxi" then
        lmc_xpl_command('sim/lights/taxi_lights_toggle')
    elseif type == "strb" then
        lmc_xpl_command('sim/lights/strobe_lights_toggle')
    elseif type == "land" then
        lmc_xpl_command('sim/lights/landing_lights_toggle')
    else
    end
    print(type)
end

lmc_set_handler('XPlane01', function( button,direction )
    if ( direction == 1 ) then
        if     ( button == 49 ) then
               lmc_xpl_command_begin('sim/engines/engage_starters')
        end
        return
    end
    if     ( button == 49 ) then
        lmc_xpl_command_end('sim/engines/engage_starters')
    elseif ( button == 90 ) then lights("nav")
    elseif ( button == 88 ) then lights("bcn")
    elseif ( button == 67 ) then lights("taxi")
    elseif ( button == 86 ) then lights("strb")
    elseif ( button == 66 ) then lights("land")
    end
end)
I can run the script, and when I press any of the keys for the lights, I get the proper text output response in the luamacros window ("bcn", "nav", etc.), so the script is loading, and the key reading is working, the function call lights() is working properly, as well as sending the right parameter. 

But nothing happens in the sim. I've stripped away possible conflicting plugins, to no effect. I remember being able to make this work with HIDmacros in XP10, but now I'm stumped. Help? Have I misspelled something crucial?

Log.txt

admin
Site Admin
Posts: 595
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: [X-Plane 11.32r2] No commands received by X-Plane

Post by admin » 02 Apr 2019, 08:55

Ok, let's troubleshoot
1) try to run xpl commands directly, no handlers, no callbacks - just script with lmc_xpl_command and execute the script
2) try other commands that talks to xplane, what about e.g. lmc_xpl_text
3) create empty file in xplane dir (next to xplane log) with name lmc_log_file_trigger.log. When xpl plugin finds this file it should put some debug info in there. So check the output after sending some command from luamacros
Petr Medek
LUAmacros author

peewee
Posts: 9
Joined: 30 Mar 2019, 13:43

Re: [X-Plane 11.32r2] No commands received by X-Plane

Post by peewee » 02 Apr 2019, 09:36

Thank you for the rapid reply!

Running a simple macro:

Code: Select all

lmc_xpl_command("sim/lights/beacon_lights_toggle")
lmc_xpl_text("HELLO WORLD") 
Nothing happens.

Logfile:

Code: Select all

2019-04-02 10:17:30:276 [XPLLUMplugin 4440]: LuaMacros Plugin started
2019-04-02 10:17:30:279 [XPLLUMplugin 4440]: Going to init internal structures...
2019-04-02 10:17:30:282 [XPLLUMplugin 4440]: LuaMacros init done
Do I need some other communications addon installed, like XPUIPC? I do have 2.0.5.9. installed, though.

admin
Site Admin
Posts: 595
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: [X-Plane 11.32r2] No commands received by X-Plane

Post by admin » 03 Apr 2019, 20:17

I just tried and works fine for me. No other pieces are needed.
If I run script like

Code: Select all

lmc_log_module('XPL')
lmc_xpl_text("HELLO WORLD")
The text is displayed and in luamacros I have output

Code: Select all

2019-04-03 21:16:06:275 [XPL]: Initiated command slot 1 with request id 4 at 1554326166275.
2019-04-03 21:16:06:275 [XPL]: XPL memory: last id 3, updated 1554326166.
2019-04-03 21:16:06:275 [XPL]: Sending DrawText command for text HELLO WORLD at pos 0,30.
Are you running xplane and luamacos as the same user?
Petr Medek
LUAmacros author

peewee
Posts: 9
Joined: 30 Mar 2019, 13:43

Re: [X-Plane 11.32r2] No commands received by X-Plane

Post by peewee » 05 Apr 2019, 14:59

Yes, running as same user, and I've tried to run both and none as Administrator as well.

How are luamacros and the plugin communicating? Is there something in Windows i might've blocked, or a service I might've stopped, that could cause this?

admin
Site Admin
Posts: 595
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: [X-Plane 11.32r2] No commands received by X-Plane

Post by admin » 08 Apr 2019, 08:49

Plugin and luamacros used shared memory for communication - https://docs.microsoft.com/en-us/window ... red-memory
When request in lua code is done, it stores some memory structure and plugin is periodically checking this memory and behaves accordingly.
I'm not sure what can go wrong in your case - error cases when shared memory can't be initialized should be handled.
I could just build version with some extended logging...
Petr Medek
LUAmacros author

peewee
Posts: 9
Joined: 30 Mar 2019, 13:43

Re: [X-Plane 11.32r2] No commands received by X-Plane

Post by peewee » 08 Apr 2019, 19:38

If you could, that'd be great. I'm sure it's something silly we're overlooking =P

admin
Site Admin
Posts: 595
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: [X-Plane 11.32r2] No commands received by X-Plane

Post by admin » 10 Apr 2019, 23:25

Ok, download plugin and luamacros exe from http://www.hidmacros.eu/xpldebug/
Start xplane
Start luamacros with switch -L XPL
In luamacros execute

Code: Select all

lmc_xpl_text('From LUA macros', 0.3, 5)
You should see log in luamacros:

Code: Select all

2019-04-11 00:20:16:879 [XPL]: Xpl -> lmc shared memory mapped with handle 616
2019-04-11 00:20:16:879 [XPL]: Lmc -> xpl shared memory mapped with handle 620
2019-04-11 00:20:16:879 [XPL]: Lmc will send first id 1
2019-04-11 00:20:16:879 [XPL]: Size of TLmcCommandRec is 557
2019-04-11 00:20:16:879 [XPL]: Size of TComSlotRec is 17
2019-04-11 00:20:16:879 [XPL]: Initiated command slot index 0 with request id 1 at ts 1554942017.
2019-04-11 00:20:16:879 [XPL]: XPL memory: last id 0, updated 1554942017.
2019-04-11 00:20:16:879 [XPL]: Sending LMC started command to reset XPL plugin structures
2019-04-11 00:20:24:008 [XPL]: Initiated command slot index 1 with request id 2 at ts 1554942024.
2019-04-11 00:20:24:008 [XPL]: XPL memory: last id 1, updated 1554942024.
2019-04-11 00:20:24:008 [XPL]: Sending DrawText command for text From LUA macros at pos 0,30.
And in plugin's lmc_log_file_trigger.log something similar to

Code: Select all

2019-04-11 00:18:13:018 [XPLLUMplugin 12152]: LuaMacros Plugin started
2019-04-11 00:18:13:021 [XPLLUMplugin 12152]: Xpl -> lmc shared memory mapped with handle 3048
2019-04-11 00:18:13:021 [XPLLUMplugin 12152]: Lmc -> xpl shared memory mapped with handle 3156
2019-04-11 00:18:13:021 [XPLLUMplugin 12152]: Going to init internal structures...
2019-04-11 00:18:13:021 [XPLLUMplugin 12152]: Size of TLmc2XplSharedMem is 56266
2019-04-11 00:18:13:021 [XPLLUMplugin 12152]: Size of TLmcCommandRec is 557
2019-04-11 00:18:13:029 [XPLLUMplugin 12152]: Size of TComSlotRec is 17
2019-04-11 00:18:13:031 [XPLLUMplugin 12152]: LuaMacros init done
2019-04-11 00:19:58:772 [XPLLUMplugin 12152]: Xpl tick number 500
2019-04-11 00:20:09:421 [XPLLUMplugin 12152]: Xpl tick number 1000
2019-04-11 00:20:16:879 [XPLLUMplugin 12152]: Detected valid request with id 1. Setting fMaxComIdInTick to 1
2019-04-11 00:20:16:879 [XPLLUMplugin 12152]: Tick 1331: Detected valid command index 0, id 1 type 1
2019-04-11 00:20:16:888 [XPLLUMplugin 12152]: Processing Lmc started command
2019-04-11 00:20:16:888 [XPLLUMplugin 12152]: Tick 1331: After slot process we have fLastProcessedId = 0, fMaxComIdInTick = 1
2019-04-11 00:20:16:892 [XPLLUMplugin 12152]: After xpl tick 1331 we have fLastProcessedId = 1, fMaxComIdInTick = 1
2019-04-11 00:20:20:718 [XPLLUMplugin 12152]: Xpl tick number 1500
2019-04-11 00:20:24:012 [XPLLUMplugin 12152]: Detected valid request with id 2. Setting fMaxComIdInTick to 2
2019-04-11 00:20:24:018 [XPLLUMplugin 12152]: Tick 1647: Detected valid command index 1, id 2 type 2
2019-04-11 00:20:24:018 [XPLLUMplugin 12152]: Received DrawText From LUA macros at pos 0,30.
2019-04-11 00:20:24:018 [XPLLUMplugin 12152]: Tick 1647: After slot process we have fLastProcessedId = 1, fMaxComIdInTick = 2
2019-04-11 00:20:24:018 [XPLLUMplugin 12152]: After xpl tick 1647 we have fLastProcessedId = 2, fMaxComIdInTick = 2
2019-04-11 00:20:31:931 [XPLLUMplugin 12152]: Xpl tick number 2000
2019-04-11 00:20:33:698 [XPLLUMplugin 12152]: Starting plugin shutdown
2019-04-11 00:20:33:712 [XPLLUMplugin 12152]: Plugin shutdown complete
Petr Medek
LUAmacros author

crbascott
Posts: 1
Joined: 11 Apr 2019, 02:45

Re: [X-Plane 11.32r2] No commands received by X-Plane

Post by crbascott » 11 Apr 2019, 02:49

I was having the same issue. I copied win.xpl from the download directory provided and everything began working for me.

Thanks for the fix! :D

peewee
Posts: 9
Joined: 30 Mar 2019, 13:43

Re: [X-Plane 11.32r2] No commands received by X-Plane

Post by peewee » 11 Apr 2019, 06:37

Starting luamacros.exe with the parameters generates this:

Image

HOWEVER...

starting the program WITHOUT the parameters, everything seems to work! :shock:

Post Reply