Sign in to follow this  
Guest A320 Co-Pilot

Making a Map Gauge in XML

Recommended Posts

I am making a Gauge which shows the Flight plan and Navaids etc, and have been for the last month or so making bit maps, I now have the bit maps I need but am having problems with the HSI Range Switch. When I first load the gauge the switch for the HSI Range is not there but when I move the mouse pointer over the area and click the switch appears and set the range to 80, but will not switch to any other range. I always seem to have problems with the mouse click section and have been trying to work it out all day so now I am getting a bit mad with it, so if someone could help me I would be most greatful.This is the XML code I am using.(L:HSI RANGE, number)HSI Switch(L:HSI RANGE, number) 20 ==if { 10 (>L:HSI RANGE, number) } (L:HSI RANGE, number) 40 ==if { 20 (>L:HSI RANGE, number) } (L:HSI RANGE, number) 80 ==if { 40 (>L:HSI RANGE, number) } (L:HSI RANGE, number) 160 ==if { 80 (>L:HSI RANGE, number) } (L:HSI RANGE, number) 320==if { 160 (>L:HSI RANGE, number)}(L:HSI RANGE, number) 160 ==if { 320 (>L:HSI RANGE, number) } (L:HSI RANGE, number) 80 ==if { 160 (>L:HSI RANGE, number) } (L:HSI RANGE, number) 40 ==if { 80 (>L:HSI RANGE, number) } (L:HSI RANGE, number) 20 ==if { 40 (>L:HSI RANGE, number) } (L:HSI RANGE, number) 10==if { 20 (>L:HSI RANGE, number)}

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Why not simplify it a little bit so it's a little easier to manage and more efficient as well. Jan is right about the =={if probably breaking it, but try this:HSI Switch(L:HSI RANGE, number) 0.5 * 10 max (>L:HSI RANGE, number)(L:HSI RANGE, number) 2 * 320 min (>L:HSI RANGE, number)Just set the initial somevalue (>L:HSI RANGE, number) when the gauge loads, and you're all set.--Jon

Share this post


Link to post
Share on other sites

Thanks Jan and Jon. If I have got this right then it should look like this:(L:HSI RANGE, number) 20 ==if{ 10 (>L:HSI RANGE, number) }Jon have tried yours and works ok, but does not show up in panel untill you click on it.Will try Jans and then I know 2 ways to do the mouse clicks.

Share this post


Link to post
Share on other sites

>>Jon have tried yours and works ok, but does not show up in>>panel untill you click on it.Well you have to set the initial value when the gauge loads, otherwise it's going to be zero. In your gauge, before you do anything else, insert a startup block like so. You can use it to initialize variables like your HSI scale.(L:Startup, bool) ! if{ 20 (>L:HSI RANGE, number) 1 (>L:Startup, bool) }

Share this post


Link to post
Share on other sites

Realised what you meant about: Just set the initial somevalue (>L:HSI RANGE, number) whenthe gauge loads, and you're all set.Thanks for the reply anyway and thanks for the help.Thanks also Jan.

Share this post


Link to post
Share on other sites

After Looking at the code, There is one thing I can not understand. Why 0.5 and 2.0 ???(L:HSI RANGE, number) 0.5 * 10 max (>L:HSIRANGE, number)Click>(L:HSI RANGE, number) 2 * 320 min (>L:HSIRANGE, number)

Share this post


Link to post
Share on other sites

Because all your values were multiples of 2. 160 * 2 = 320, etc. I used 0.5 * instead of 2 / for reducing the scale because it's more efficient in terms of processing, but it's really insignificant particularly in a state-based role.I mean why have a bunch of if{ blocks if all the values are just half or double the previous value:)--Jon

Share this post


Link to post
Share on other sites

Jon I got this scrolling my ECAM pages 1 to 9 on a single button click. How can get it to reset to 1 after 9 and go round again, Is it possible? Paul

Share this post


Link to post
Share on other sites

I have now made a HSI Mode Switch. So all the value go up by one. This is the code :(L:HSI MODE, number)(L:Startup, bool) ! if{ 1 (>L:HSI MODE, number) 1 (>L:Startup, bool) }HSI Mode Switch(L:HSI MODE, number) 1 - 1 max (>L:HSI MODE, number)(L:HSI MODE, number) 1 + 6 max (>L:HSI MODE, number)Now what happens is when I UpArrow Click goes straight to 6 but when I DownArrow click it works as it should do goes from 6 to 1. Have tried * - / in the UpArrow click but with no success.

Share this post


Link to post
Share on other sites

Hi Try (L:HSI MODE, number) 1 + 6 min (>L:HSI MODE,number)(L:HSI MODE, number) 1 - 1 max (>L:HSI MODE,number) Paul

Share this post


Link to post
Share on other sites

It now goes from 1 to 6, and then 6 to 1 like it should, but does not show up in the panel untill clicked on.

Share this post


Link to post
Share on other sites

Hi,This is my working code for the HSI Switch:(L:HSI STARTUP,enum) 0 == if{ 4 (>L:hsi,enum) 1 (>L:HSI STARTUP,enum) } (L:hsi,enum)Plan --> Rose Ils(L:hsi,enum) 1 - 0 max (>L:hsi,enum)Rose Ils --> Plan(L:hsi,enum) 1 + 5 min (>L:hsi,enum)At startup always at position 4.May be it helps,Jan"Beatus ille qui procul negotiis..."

Share this post


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