I have been using SimVim for the FlightFactor A320 for some time now. I noticed that I always have to click "Reload Configuration" after starting SimVim, otherwise the displays do not work. I tested it with the Baron B58. There everything works after the start. Now, due to programming work with LUA-Script, I have an idea why this error occurs.
In my LUA-Script, which processes DataRefs and commands, I have to insert a delay at startup. The DataRefs and commands specifically used by FlightFactor are loaded rather late when the A320 is launched. This caused the LUA-Script to abort with an error. Another user gave me the tip to integrate a function in the LUA-Script which waits for the availability of the special DataRefs/Commands and only then starts. Since then it has worked without any problems.
Now my suspicion is that SimVim encounters the same problems at startup. When SimVim is started the required DataRefs/commands are not loaded. Therefore SimVim only works after a "Reload Configuration".
Is it possible to start SimVim delayed ? Would it be possible to integrate a function in SimVim that waits for the availability of a specific dataref ?

Best regards

Andreas
2 weeks ago in Custom Aircraft by

1 Answer

Simply call the SimVim function at the end of your script,
It is the command "simvim/reconnect"
1 week ago by

Good idea :-)

I have adapted the LUA script. With the DataRef for "XPLMFindDataRef" I searched for a while. Some keys did not work with SimVim yet. You really have to find a DataRef, which is created at the end. Otherwise the LUA-Script is finished, but still not all special DataRefs are there.
Now the start of SimVim works without problems.


function MapAircraftSpecific()
  if (PLANE_ICAO == "A320") then
  -- Flight Factor A320
 
    command_once("simvim/reconnect")
   
  end
end

function specific_commands_exist()
  local ac_ready = false
  if PLANE_ICAO == "A320" then
  -- Flight Factor A320
    if XPLMFindCommand("a320/Panel/SidestickTakeoverL_button")   ~= nil and
       XPLMFindDataRef("a320/Aircraft/Cockpit/MCDU1/Key19/Click") ~= nil then
      ac_ready = true
    end
  else
    ac_ready = true
  end
  return ac_ready
end

function monitor()
  if not init_completed then
    if specific_commands_exist() then
      MapAircraftSpecific()
      init_completed = true
    else
      draw_string_Helvetica_18(50, 500, "Waiting on A/C specific commands/datarefs to be created!")
    end
  end
end

local init_completed = false

if init_completed == false then
  do_every_draw("monitor()")
else
  do_sometimes("monitor()")
end

 

...