Jump to content
The simFlight Network Forums

Inconsistent running of Lua scripts


severniae
 Share

Recommended Posts

Hi, 

I have a strange problem..

I'm finding with some scripts, ones that appear to work fine, randomly...don't..

For example, I have one script that's only function is to call two other scripts - sometimes, when I load this script, it functions, calls the other two scripts in turn and they load fine. Other times, it just exits for apparently no reason before completing its tasks.. the same goes for a few other scripts I am using...

Example script:

"

function CallScripts()
ipc.sleep(2000)
ipc.runlua("DC6_MP_CONTROL")
ipc.sleep(50)
ipc.runlua("DC6_RPM_CONTROL")
ipc.sleep(1000)
end

CallScripts()
ipc.sleep(250)
ipc.exit()

"

Here is the output for the log - same script ran twice - one time it works, the next not, no change to the scripts between executions...:

********* LUA: "DC6_WATCHENGINES" Log [from FSUIPC version 7.2.1] *********
  1872344 System time = 01/07/2021 00:13:10, Simulator time = 13:15:44 (12:15Z)
  1872344 LUA: beginning "C:\FSUIPC7\DC6_WATCHENGINES.lua"
  1872344 LUA: C:\FSUIPC7\DC6_WATCHENGINES.lua:8
  1872360 LUA: Global: ipcPARAM = 0
  1872391 >>> Thread forced exit (ipc.exit or os.exit) <<<
  1872391 System time = 01/07/2021 00:13:10, Simulator time = 13:15:44 (12:15Z)
********* LUA execution terminated: Log Closed *********

********* LUA: "DC6_WATCHENGINES" Log [from FSUIPC version 7.2.1] *********
  1872469 System time = 01/07/2021 00:13:10, Simulator time = 13:15:45 (12:15Z)
  1872469 LUA: beginning "C:\FSUIPC7\DC6_WATCHENGINES.lua"
  1872469 LUA: C:\FSUIPC7\DC6_WATCHENGINES.lua:8
  1872469 LUA: Global: ipcPARAM = 0
  1872485 LUA: C:\FSUIPC7\DC6_WATCHENGINES.lua:2
  1872500 LUA: C:\FSUIPC7\DC6_WATCHENGINES.lua:10
  1872516 LUA: C:\FSUIPC7\DC6_WATCHENGINES.lua:4 fn: CallScripts
  1872657 LUA: C:\FSUIPC7\DC6_WATCHENGINES.lua:6 fn: CallScripts
  1872797 LUA: C:\FSUIPC7\DC6_WATCHENGINES.lua:8 fn: CallScripts
  1872813 LUA: C:\FSUIPC7\DC6_WATCHENGINES.lua:12
  1872828 >>> Thread forced exit (ipc.exit or os.exit) <<<
  1872828 System time = 01/07/2021 00:13:11, Simulator time = 13:15:45 (12:15Z)
********* LUA execution terminated: Log Closed *********

 

Link to comment
Share on other sites

9 hours ago, severniae said:

Here is the output for the log - same script ran twice - one time it works, the next not, no change to the scripts between executions...:

The first execution of the script started at timestamp 1872344. The second execution started at 1872469, which 125ms later. As the first execution of the script was still running when you ran it again, the thread with for first execution was terminated. You can only ever have a script running once - if you try to run it again and it is already running, the current running instance will terminated.

Also seems a strange script.... You don't need the ipc.exit() as the script will exit anyway, and you don't need the function call (or delays). The following script would do the same:

ipc.runlua("DC6_MP_CONTROL")
ipc.sleep(50)
ipc.runlua("DC6_RPM_CONTROL")

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...

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.