• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Gauge Parameters

Messages
76
In FSPS there is a field called Param which the manual for FSPS says is a parameter field. It is used so that you don't have to make four separate gauges for four separate engines rpm readouts (for example).

I have 87 gauges that are essentially the same except for their ID and would like to take advantage of this param field. But how do I get to that bit of data in the C gauge code?

Edit: the Param field shows up in the panel.cfg after the gauge's x,y,w,h fields.
 
Last edited:
See page 90 of Dai Griffith's sd2gau30 book for details.

Essentially you need to read the "5th parameter" in the gauge entry as you've noted. In the example below, I'm reading an entry that contains the folderpath\filename for a "preflight.ini" file, but the technique is essentially the same.

I've added a flag "params_read" to prevent reading the "5th parameter" twice, since this case actually is read twice on panel load!

You can actually pass a LOT of information via the "5th parameter." It's strictly a matter of how you parse it! :D

gauge00=Citation CJ1 MultiGauge!CJ1_Preflight, 0,0,1,1,ESDG\Cessna Citation CJ1 2.0\CJ1_Preflight_FS9

I do it in the PANEL_SERVICE_POST_INSTALL section:

Code:
		case PANEL_SERVICE_POST_INSTALL:
			if (pgauge->parameters && params_read == 0)
			{
				if ( strlen(pgauge->parameters) > 0 )
				{
					strcpy(param,(PCHAR)(pgauge->parameters));
					ExtractWord(1,param,"\\",esdgPath,MAX_PATH);
					// grab the 2nd part of it, should be aircraft specific
					ExtractWord(2,param,"\\",aircraftPath,MAX_PATH);
					// grab the 3rd part of it, should be the file name
					ExtractWord(3,param,"\\",filename,MAX_PATH);
					// place the app data folder in our string
					strcpy(total_name,appdataPath);
					// add the ESDG to it
					strcat(total_name,esdgPath);
					// check to see if the folder exists, if not create it
					if (!DirectoryExists(total_name))
					{
						_mkdir(total_name);
					}
					// add the aircraft name to it
					strcat(total_name,"\\");
					strcat(total_name,aircraftPath);
					// see if the folder exists, if not create it
					if (!DirectoryExists(total_name))
					{
						_mkdir(total_name);
					}
					// now add the file name
					strcat(total_name,"\\");
					strcat(total_name,filename);
					strcat(total_name,file_extension_pre);
					// we're ready to go
				}
				params_read = 1;
			}
                               break;
 
Last edited:
Fantastic! Thanks Bill. I've modified the code to give it a test. But I came across another hiccough... In the mouse callback there is no obvious way to get the pelement to identify which widget the user clicked in. I must be missing something. See, I need to know which widget was clicked on so I can send it's param (which is an int) along to another function. Hopefully you'll know the answer to this one, if not I will continue to examine samples and the SDK...

Oh, BTW - this is a fantastic find... I can see lot's of potential for this "5th field".
 
I'm not entirely sure what you're actually asking about, but I'm sure you'll figure out how to do whatever it is you want... ;)

Actually, I've already exploited what I think is most useful: pointing to a "configuration.ini" type file which can be kept in a custom folder location. This file may be used to read/write an almost limitless amount of configurable data... :D
 
Ok, I figured it out. In the update function:


Code:
		case PANEL_SERVICE_POST_INSTALL:
			if (pgauge->parameters && params_read == 0) {
				if ( strlen(pgauge->parameters) > 0 ){
					if (pgauge->parameters){
						strcpy(param,(PCHAR)(pgauge->parameters));
						sb = atoi(param);
/						pgauge->user_data = sb;

in the mouse callback function:

Code:
BOOL FSAPI sonobuoy_readout_mcb( PPIXPOINT relative_point, FLAGS32 mouse_flags ){
	PGAUGEHDR gauge_header = GAUGEHDR_FOR_MOUSE_CALLBACK(relative_point);
	int val;

	val = gauge_header->user_data;

val will then contain the id of the gauge. I can now reduce 87 identical gauges into just one. :wizard:
 
Back
Top