Jump to content
The simFlight Network Forums

Tilesix LUA modification


Recommended Posts

Hello, I want to modify the tilesix script in order that it works in this way:

When activated by pressing a button it should appear on the monitor a request to input a number

Each number (one for each aircraft type) correspond to a specific panels positioning on the screens

example if for the variable "aircraft" is assigned the number 1 that can correspond to the Learjet 45 the following are executed

ext.position("Electrical", 0, 0, 40, 20,3)
ext.position("APU", 40, 20, 20, 15,3)
ext.position("Throttle quadrant", 0, 20, 40, 76,3)
ext.position("Trim", 65, 0, 20, 15,3)
ext.position("Fuel", 40, 0, 25, 20,3)

on the other hand if to the variable aircraft is assigne the number 2 than can correspond to the "grumman" the following are executed

ext.position("Electrical", 28, 70, 35, 21,3)
ext.position("Trim", 0, 70, 28, 26,3)
ext.position("Fuel", 0, 48, 50, 22,3)
ext.position("Overhead Panel", 0, 3, 68, 46,3)
ext.position("Radio stack", 68, 3, 26, 71,3)
ext.position("Landing Gear", 50, 48, 15, 22,3)

 

Better if the script can automatically recognize the aircraft type.

Can anyone help me?

Cristiano

 

 

Link to comment
Share on other sites

I think there could be at least 2 different ways to do this - 


1) When the lua is started it will get the .air file name then selecting the correct ext.position wanted from the air file name.  Ex. Code not tested

airFileName = ipc.readSTR(0x3C00, 256) -- get the air file name on lua load

if string.find(airFileName, "Lear45") then -- air file name of FS9 Lear45 as an example
	ext.position("Electrical", 0, 0, 40, 20,3)
	ext.position("APU", 40, 20, 20, 15,3)
	ext.position("Throttle quadrant", 0, 20, 40, 76,3)
	ext.position("Trim", 65, 0, 20, 15,3)
	ext.position("Fuel", 40, 0, 25, 20,3)
end

if string.find(airFileName, "Aerosoft F-14A") then  -- air file name of FSX Aerosoft F-14A as an example
	ext.position("Electrical", 28, 70, 35, 21,3)
	ext.position("Trim", 0, 70, 28, 26,3)
	ext.position("Fuel", 0, 48, 50, 22,3)
	ext.position("Overhead Panel", 0, 3, 68, 46,3)
	ext.position("Radio stack", 68, 3, 26, 71,3)
	ext.position("Landing Gear", 50, 48, 15, 22,3)
end

2) Exactly what you asked for - This will ask you for a keyboard input to the ext.position wanted ...
NOTE - In FSX I occasionally get a problem with this when the asking dialog comes up it also selects (right click on screen) "Mouse as Yoke" ?? it is very weird. (can live with it) 
Ex. Code partially tested but should work as is

-- THIS IS THE POPUP ASKING DIALOG
local askOptions = " LOAD WINDOW LOCATION TYPE\n Type in number then press ENTER\n\n    0 = none\n    1 = Lear 45\n    2 = Grumman\n    3 = empty slot\n    4 = empty slot\n    5 = empty slot"

n = ipc.ask(askOptions, WHITE)

if n == "1" then -- REPLY WAS 1, LEAR 45
	ext.position("Electrical", 0, 0, 40, 20,3)
	ext.position("APU", 40, 20, 20, 15,3)
	ext.position("Throttle quadrant", 0, 20, 40, 76,3)
	ext.position("Trim", 65, 0, 20, 15,3)
	ext.position("Fuel", 40, 0, 25, 20,3)
end

if n == "2" then  -- REPLY WAS 2, GRUMMAN
	ext.position("Electrical", 28, 70, 35, 21,3)
	ext.position("Trim", 0, 70, 28, 26,3)
	ext.position("Fuel", 0, 48, 50, 22,3)
	ext.position("Overhead Panel", 0, 3, 68, 46,3)
	ext.position("Radio stack", 68, 3, 26, 71,3)
	ext.position("Landing Gear", 50, 48, 15, 22,3)
end

if n == "3" then  -- REPLY WAS 3, EMPTY

end

if n == "4" then  -- REPLY WAS 4, EMPTY

end

if n == "5" then  -- REPLY WAS 5, EMPTY
	
end

Here is a screenshot of the asking dialog ( of course from something of my own )

ipc.ask dialog.jpg

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.