Jump to content

Quick LUA question


Burner_Tbird2

Recommended Posts

Quick question on what's possible in the 1.1 LUA's

 

I see that in the export.lua you can input game commands- keystrokes basically. What I want to know is can you modify any game game parameters in these lua's (view, server, etc)

 

ex.

-- in the server.lua this is the regular config

-- vAngleRearMin = -8.0

 

-- could I make a conditional loop that assigns a variable to vAngleRearMin like this

vAngVar = LastvAngVar + 1

vAngleRearMin = vAngVar

 

-- so that I could have a continually increasing vAngleRearMin until I stopped the loop

 

A more detailed question would be what can be changed in export.lua and what can be changed in the other lua's. Can the other lua's access dat files and then uses the dat values to change variables like vAngleRearMin. Also will the server.lua parameter vAngleRearMin change in game? Or can ingame changes only be affected thru 'commands' ie, keypresses.

 

Thx for your time,

Link to comment
Share on other sites

  • ED Team
Quick question on what's possible in the 1.1 LUA's

 

I see that in the export.lua you can input game commands- keystrokes basically. What I want to know is can you modify any game game parameters in these lua's (view, server, etc)

 

ex.

-- in the server.lua this is the regular config

-- vAngleRearMin = -8.0

 

-- could I make a conditional loop that assigns a variable to vAngleRearMin like this

vAngVar = LastvAngVar + 1

vAngleRearMin = vAngVar

 

-- so that I could have a continually increasing vAngleRearMin until I stopped the loop

 

A more detailed question would be what can be changed in export.lua and what can be changed in the other lua's. Can the other lua's access dat files and then uses the dat values to change variables like vAngleRearMin. Also will the server.lua parameter vAngleRearMin change in game? Or can ingame changes only be affected thru 'commands' ie, keypresses.

 

Thx for your time,

 

You can change everything in Lua files on your own risk. PLease try and see your results. Note that Lua error messages may be found in the Temp/Error.log file. Please, read excellent Programming in Lua book by Roberto Ierusalemschy (http://www.lua.org/pil/) for Lua details.

 

As a rule Lua files are read and executed once at the mission start. But some Lua functions may be called by the program during mission execution. Read comments and examples in Lua files, please.

Valery Blazhnov

Eagle Dynamics Veteran

Link to comment
Share on other sites

  • ED Team
Ok a more specific question, how often is the view/server.lua accessed. As well as how often the view Functions are accessed. I think these are more Lomac questions than LUA questions.

There are no common frequency. They are called on demand. But some functions may be called at every frame.

Valery Blazhnov

Eagle Dynamics Veteran

Link to comment
Share on other sites

I'm not sure about how often the server functions are called, but I used GetSnapAngles before and this is how it works:

 

function GetSnapAngles(iPlane, iKey)

- called when a player is in snap view and is pressing a keypad button (keypad0 or keypad0 + keypad something)

- the key is sent repeatedly while the key is held down, so if you hold keypad0 down for about a second, GetSnapAngles will be called with iKey = 1 (0+1) many times. Also, if you were holding keypad0+keypad6, GetSnapAngles would be called with iKey = 7...

sig36aa.jpg
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...