Jump to content
The simFlight Network Forums
Sign in to follow this  
Claude Troncy

Problem with ipc.display

Recommended Posts

Bonjour,

I have this simple script

Quote

print("display")
ipc.display("HI")

No window appears on the screen and of course nothing is displayed even when I try the non simconnect window using the parameter NoMessageWindows=Yes in the ini file.

What can I do investigate more ?

Thanks

Claude

Share this post


Link to post
Share on other sites

Hi Claude,

Is this a lua script? If so, 'print' is not a statement and will cause the script to fail. And, without tis line, the script would end very quickly anyway!

Also, how are you starting the lua? In FSUIPC, to automatically start a lua script it must be added to the '[Auto]' section, otherwise it should be activated from a button or key press.

If you are trying lua for the first time, you can also try activating 'Log Lua plugins separately' (and maybe 'Debug/Trace Lua plugins') from the FSUIPC logging tab, which will create a <yourLuaScript>.log file.

Also, please check-out the documentation and example scripts provided.

Cheers,

John

 

Share this post


Link to post
Share on other sites
Quote

'print' is not a statement and will cause the script to fail.

Sorry, this is not correct - 'print' IS a basic lua command (just one I've never had need to use!). The rest of my comments still apply.

 

Share this post


Link to post
Share on other sites

Bonjour John,

Print is here only to have a trace in the fsuipc log file.
The script is called with a joystick button.

I have of course use the console to trace  the lua script, and have activate the lua log but nothing special in it.

Quote

********* LUA: "test_sound" Log [from FSUIPC version 5.15] *********
  1372840 System time = 03/02/2019 18:58:21, Simulator time = 14:23:03 (13:23Z)
  1372840 LUA: beginning "C:\Program Files\Lockheed Martin\Prepar3D v4\Modules\test_sound.lua"
  1372840 LUA: ...s\Lockheed Martin\Prepar3D v4\Modules\test_sound.lua:1
  1372840 LUA: Global: ipcPARAM = 0
  1372840 LUA: display
  1372840 LUA: ...s\Lockheed Martin\Prepar3D v4\Modules\test_sound.lua:2
  1372871 LUA: ...s\Lockheed Martin\Prepar3D v4\Modules\test_sound.lua:3
  1372934 >>> Thread forced exit (ipc.exit or os.exit) <<<
  1372934 System time = 03/02/2019 18:58:21, Simulator time = 14:23:03 (13:23Z)
********* LUA execution terminated: Log Closed *********
 

The  script is this one

Quote

print("display")
ipc.display("HI")
ref = sound.play("GearUpCall")

 

The print "display"  works and I can see it in the fsuipc log
The display("HI") doesn't work
The sound is played without a problem.

Cheers

Claude

 

Share this post


Link to post
Share on other sites

Quite possibly your display window may be off screen if undocked and set there once before.
In FSX this display location is saved in a saved flight file.
Maybe try setting a new location and also give it a display duration in case it is clearing too quick.
Also try in windowed mode if you are full screen.

ipc.setowndisplay("My Lua Display Test", 48, 2, 4, 0) -- this will relocate the window top dead center in the fs main window
ipc.display("HI", 5-- 5 second display duration
ref = sound.play("GearUpCall")

Roman

Share this post


Link to post
Share on other sites
17 minutes ago, spokes2112 said:

ipc.setowndisplay("My Lua Display Test", 48, 2, 4, 0) -- this will relocate the window top dead center in the fs main window

On P3D4 with FSUIPC5, the displays use SimConnect windows, and can't be set with a user title. Their position can be remembered. FSUIPC stores that (but optionally and defaulted off because of Windowed mode / Full Screen changeover problems with it), 

51 minutes ago, Claude Troncy said:

The print "display"  works and I can see it in the fsuipc log
The display("HI") doesn't work
The sound is played without a problem.

I think the problem is simply that the plug-in only exists for a fraction of a second. Display windows are closed when the requesting plug-in closes. if you want to see it, try adding an ipc.sleep(5000) at the end, so it hangs around for 5 seconds. (The sound request won't delay its termination -- that only initiates the sound).

Pete

 

 

Share this post


Link to post
Share on other sites

Hi Pete,

Of course you are right, it is obvious now that the script terminate before it has the time to display the window. What an idiot I am.
I have 50 years of software development  behind me, and it looks like a beginner's mistake. May be I am getting younger...😃 or NOT !

Thanks Pete

Cheers

Claude

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.