Custom Gauges

Moderators: Tony, admin

Custom Gauges

Postby frankturley » Thu Oct 18, 2018 9:47 am

My eyesight isn't what it used to be, I have trouble sometimes reading the gauges - I use a monitor, not VR.

In the FSX SDK there were two things to help me, a variable list, and the ACE tool. Using these I could make simple digital XML gauges, which I saved in the FSX gauges file. I then edited the host aircraft's panel.cfg file, and added my gauges to a pop-up window with a transparent background, at a nice large sized resolution. When flying, holding down shift and pressing the appropriate number brought up the gauge into view, a nice add-on to have for example is the RADALT gauge when landing helicopters.

Is it possible to do something similar in FFS? If so, could someone do a "Gauges for Dummies" tutorial, I have looked at the SDK, but I have no idea where to start.
frankturley
 
Posts: 67
Joined: Sat Nov 25, 2017 5:24 am

Re: Custom Gauges

Postby admin » Thu Oct 18, 2018 3:59 pm

Hi Frank,

I would recommend checking out the first three tutorials (currently the only tutorials ;) ):
1. http://cdn.flyinside-fsx.com/sdk/Tutorials/AddOn/ - Shows you how to get started with creating a script.
2. http://cdn.flyinside-fsx.com/sdk/Tutorials/UI/ - Gets a little bit more advanced, shows how to create a dialog
3. http://cdn.flyinside-fsx.com/sdk/Tutorials/State/ - Shows how to create a VR dialog which displays aircraft status

Depending upon your programming experiencing this may be too complicated. Unfortunately we don't have anything easier. If you are comfortable writing a bit of code though, you could create custom "gauge" dialogs to display the different things you want. Sort of like how we did with flaps in the third tutorial.

Thanks,
Dan
Your friendly neighborhood developer!
Contact Me: dan@flyinside-fsx.com
admin
Site Admin
 
Posts: 2672
Joined: Tue Feb 06, 2007 8:36 am

Re: Custom Gauges

Postby frankturley » Fri Oct 19, 2018 11:03 am

Thanks for pointing me to the tutorials, I managed the first one, but got stuck on the last part of the second one. I've probably made a typo somewhere, the problem I have is that the error reporting is unhelpful, it refers to an error at (39,66). I have been using Windows notepad as a script editor, is there another you could recommend that displays line numbers.

The error reporting also says it could not find the objects 'onStart' and 'onGraphicsFrame', but they were both there! I assume that this is a result of the first error confusing the system.

You ask about my experience of coding, I have used Basic and subsequently Visual Basic since the 1970's, but not C++, but so far I have managed to follow the tutorials. At least so far I can see I should be able get my digital gauges up and going in FFS, if I can crack the error interpretation issue.
frankturley
 
Posts: 67
Joined: Sat Nov 25, 2017 5:24 am

Re: Custom Gauges

Postby admin » Fri Oct 19, 2018 11:07 am

Hi Frank,

I recommend Notepad++ :) It'll give you line numbers, if you choose "Language -> C", some pretty syntax highlighting as well. Should help you find the typo (39 is the line number).

I started with QBasic myself, was lots of fun. My first job was in Visual Basic, loved that as well!

Thanks,
Dan
Your friendly neighborhood developer!
Contact Me: dan@flyinside-fsx.com
admin
Site Admin
 
Posts: 2672
Joined: Tue Feb 06, 2007 8:36 am

Re: Custom Gauges

Postby frankturley » Fri Oct 19, 2018 11:12 am

Thanks for that, I'll try it now.
frankturley
 
Posts: 67
Joined: Sat Nov 25, 2017 5:24 am

Re: Custom Gauges

Postby frankturley » Fri Oct 19, 2018 1:32 pm

Brilliant, works well, found my bugs, completed 2nd tutorial, thanks.
frankturley
 
Posts: 67
Joined: Sat Nov 25, 2017 5:24 am

Re: Custom Gauges

Postby frankturley » Sat Oct 20, 2018 5:46 am

I have started trying to build a simple digital gauge, but I have got stuck! My chai file has the usual def onStart and def onGraphics Frame sections (both empty), followed by -

def getAirspeed()
{
auto& ac = GetUserAircraft();
auto& vp = ac.getVariableProvider();
return vp.getValueFloat("Aircraft.Position.Airspeed.True", "number");
}
def onUIFrame()
{
auto& ui = GetUI();
ui.startWindow("Airspeed Test");
ui.text("Airspeed - need to know how to insert value here" );
ui.endWindow();
}

This works without any error, but I haven't been able to deduce how to get the value returned by getAirspeed into the ui.text statement. Can anyone help with this please?
frankturley
 
Posts: 67
Joined: Sat Nov 25, 2017 5:24 am

Re: Custom Gauges

Postby frankturley » Sat Oct 20, 2018 11:37 am

Finally cracked it -
ui.text("Airspeed" + "$(getAirspeed())" );
I now have a display of airspeed, but comparing it to the gauge it appears to be only half what it should be?
frankturley
 
Posts: 67
Joined: Sat Nov 25, 2017 5:24 am

Re: Custom Gauges

Postby admin » Sat Oct 20, 2018 12:02 pm

Good find! I didn't even know the dollarsign trick. Perseonally I would've tried

Code: Select all
auto airspeed = getAirspeed();
ui.text("Airspeed: " + airspeed.to_string());


Looks like you're getting airspeed in its default units, which for us, is meters/second. Try
Code: Select all
return vp.getValueFloat("Aircraft.Position.Airspeed.True", "knots");
Your friendly neighborhood developer!
Contact Me: dan@flyinside-fsx.com
admin
Site Admin
 
Posts: 2672
Joined: Tue Feb 06, 2007 8:36 am

Re: Custom Gauges

Postby frankturley » Sat Oct 20, 2018 1:55 pm

Thanks for that, changing number to knots gives the correct answer. Off to try with other variables now.
frankturley
 
Posts: 67
Joined: Sat Nov 25, 2017 5:24 am

Next

Return to Add-On Developers Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron