Jump to content
The simFlight Network Forums
Sign in to follow this  
codatcri

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

 

 

Share this post


Link to post
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

Share this post


Link to post
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...
Sign in to follow this  

×
×
  • 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.