Jump to content
The simFlight Network Forums

Lua event.sim


mroschk

Recommended Posts

Hello,

 

i have a little Lua Script which should set a offset when i start the sim .

function LightsCLEAR()
   ipc.display("LightsCLEAR")
	ipc.setbitsUB(0x5301, 1)
	ipc.setbitsUB(0x5301, 2)
	ipc.setbitsUB(0x5301, 4)
	ipc.setbitsUB(0x5301, 8)
	ipc.setbitsUB(0x5301, 16)
	ipc.setbitsUB(0x5301, 32)
	ipc.setbitsUB(0x5301, 64)
	ipc.setbitsUB(0x5301, 128)
end
event.sim(ANY, "LightsCLEAR")

but it is only running, when i change the Time in the sim, as example from Day to Night.

Why is the script not running when i start the sim?

Or how can i run a script, when the sim starts?

 

thx

MR

Link to comment
Share on other sites

Hi MR,

Lua questions should really be posted in the main support forum. This sub-forum is for programming with .NET languages.

However, looking at the documentation, event.sim doesn't fire when the sim loads. Only on CLOSE, FLIGHTLOAD, FLIGHTSAVE and AIRCRAFTCHANGE.

You can run a LUA script when the sim has finished loading and is ready to fly by naming your LUA file 'ipcready.lua'. That might be useful to you.

I'm not an expert on LUA so if you need more help please ask in the main forum.

Kind Regards,

Paul

Link to comment
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
×
×
  • 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.