Does switch_add have a size limit

Questions about deployment and use of Air Manager Instruments

Moderators: russ, Ralph

Post Reply
Message
Author
brlowe
Posts: 91
Joined: Fri Oct 16, 2020 6:08 pm

Does switch_add have a size limit

#1 Post by brlowe » Tue Jul 20, 2021 6:43 pm

I'm trying to make a brake lever using the switch_add function but the graphic keeps getting bunched up. The image is 208x778 but that does not seam to work.
The the X and Y settings have a limit?

Here is the code to add the images
switch_add("Parking_off.png", "Parking_on.png" , 0, 0, 208, 778, new_park_brake).
Once I getting it working I will trim the background out of the image.

I'm also including one of the images and the results.
Brake example.PNG
Parking_On.PNG

User avatar
Ralph
Posts: 5321
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Does switch_add have a size limit

#2 Post by Ralph » Tue Jul 20, 2021 7:49 pm

No, there are no limits. But I think we'll need more information, because I have no clue about what I'm looking at. Maybe someone else understands.

brlowe
Posts: 91
Joined: Fri Oct 16, 2020 6:08 pm

Re: Does switch_add have a size limit

#3 Post by brlowe » Tue Jul 20, 2021 8:27 pm

Let me try to explain more. I'm using the code from one of the generic parking brakes and just want to change the image to the Piper parking brake handle. So I created 2 images, 1 for brake on and 1 for brake off. Changed the image names in the code and adjusted the size. When the image is displayed by air manager is it compressed and messed up as in the sample above.

Here is the code and an export of the instrument. The code is only 18 lines long including blank lines and comments.
Sorry I do not know how to make the code box so just pasting it here

--PARKING BRAKE

function new_park_brake(position)
xpl_command("sim/flight_controls/brakes_toggle_max")
fsx_event("PARKING_BRAKES")
fs2020_event("PARKING_BRAKES")
end
park_brake_sw = switch_add("Parking_off.png", "Parking_on.png" , 0, 0, 208, 778, new_park_brake)

function park_brake_switch(position)
sw_on = fif( position > 0 , 1, 0 )
switch_set_position(park_brake_sw, position)
end
xpl_dataref_subscribe("sim/cockpit2/controls/parking_brake_ratio","FLOAT",park_brake_switch)
fsx_variable_subscribe("BRAKE PARKING POSITION", "Position", park_brake_switch )
fs2020_variable_subscribe("BRAKE PARKING POSITION", "Position", park_brake_switch )

--end PARKING BRAKE
Piper Parking Brake.siff
(737.2 KiB) Downloaded 46 times

User avatar
Sling
Posts: 4620
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Does switch_add have a size limit

#4 Post by Sling » Tue Jul 20, 2021 11:52 pm

2 things to check.

Did you adjust the instrument size to compensate for the larger images. I suspect the parking brake you are basing this on is quite small. These can be adjusted by clicking the Info button along the top ribbon.

Are both the images the same size 208 width by 778 height. If one of them is say the other way round with 208 as the height and 778 as the width then that will not work. Post the images here if you are not sure.

Tony

brlowe
Posts: 91
Joined: Fri Oct 16, 2020 6:08 pm

Re: Does switch_add have a size limit

#5 Post by brlowe » Wed Jul 21, 2021 7:41 pm

Thank you Tony that was it.
I did not know or forgot that was there as I have never changed an instrument that much.
Now to clean it up a bit

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests