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

P3D v2 MAKE_STRING macro

Messages
74
Country
flag
Hi guys
Is there a way to totally hide/disable (not set to 0) the MAKE_STRING Macro?
Thank you
 
YOu mean hide the element? A macro is just a macro... don't think you hide them.
 
Hi WarpD, thank you for reply
What I would like to do it's simply hide a string when my L var is carried out. It's be useful when you will need to simulate the behavior of radio(on/off switch). I can see the only solution now - use hide/show geometry (modeldef <Visibility> ) on which C gauge is rendered. But I think it's weird.. Should be a possibility to that from C++ gauge, am I wrong?!

Any suggestion will be much appreciated. Thanks )
 
Most of us use a modified version of the gauges.h header file that has macros set up for showing and hiding elements.
 
Thanks WarpD ) Sorry, what do you mean by saying "modified version of the gauges.h"? Can I have one ?! ))

Btw, I am an absolute lamer, dammit! For do what I described above, guys, just send to sprintf empty string ---< sprintf(bla bla bla, "") >---
 
Perhaps use the twin macros from gauges.h SHOW_IMAGE and HIDE_IMAGE?

Code:
if ( HSIpower == 1 ) { SHOW_IMAGE(pelement) ; } else { HIDE_IMAGE(pelement) ; }
sprintf(pelement->string,"HDG %03.0f",rwert);
 
Thank you very much Bill
As I know(from Creating C-Gauges by Dai Griffiths) the drawing element Macros (SHOW_IMAGE/HIDE_IMAGE) doesn't work with MAKE_STRING macro..
Anyway when you put empty string in sprintf - the string "disappear", so I'm happy ))

Thanks to all )
 
How odd. This code above has been working as written for many years now... o_O
 
Yeah... I thought it worked as well. Of course, maybe it's the 'code sequence'. Setting the visibility every time just before you update the contents of the string.
 
MAKE_STRING....makes things extra difficult. Why not use the GDI+ gauge drawing template with/without the Direct2D setup? PM with your email address...I can send you blank templates for both if you like.
 
MAKE_STRING works fine... if you understand how it works. GDI+/Direct2D is like using a nuclear bomb to take out a fly if you're not displaying a lot.
 
I have another question regarding subject, with your permission
Does IMAGE_USE_BRIGHT work with string?
I put it in makro but at night no glowing string...
Thank you =)
 
Here is a method to control a string's illumination: off/dim/bright...

Code:
FLOAT64 FSAPI RTU_callback5( PELEMENT_STRING pelement)
{
    VAR32 rwert3=pelement->source_var[0].var_value.d;
    char rwert2[6]; double rwert; wsprintf(rwert2, "1%d%d.%d%d", (rwert3 >>12) & 0x000f, (rwert3 >>8) & 0x000f, (rwert3 >>4) & 0x000f, rwert3 & 0x000f); rwert = atof(rwert2);
    if ( powerl == 1  &&  rtu_brite1 == 1 )
        { DARKEN_IMAGE(pelement) ; SHOW_IMAGE(pelement) ; LUMINOUS_IMAGE(pelement) ; }
    if ( powerl == 1  &&  rtu_brite1 == 2 )
        { SHOW_IMAGE(pelement) ; LIGHT_IMAGE(pelement) ; }
    if ( powerl == 0 || rtu_brite1 ==  0 )
        { HIDE_IMAGE(pelement) ; DARKEN_IMAGE(pelement) ; }
    sprintf(pelement->string,"%3.2f",rwert);
    return 0;
}

MAKE_STRING(RTU_String6,&RTU_ElementList7,NULL,IMAGE_USE_ERASE | IMAGE_USE_TRANSPARENCY | BIT7,0,194,186,460,46,1000000,
            NAV1_FREQUENCY,MODULE_VAR_NONE,MODULE_VAR_NONE,RGB(0,255,0),RGB(0,0,0),RGB(0,0,0),
            GAUGE_FONT_DEFAULT26,GAUGE_WEIGHT_DEFAULT26,GAUGE_CHARSET26,0,0,NULL,RTU_callback6)
PELEMENT_HEADER RTU_ElementList6[] = {
&RTU_String6.header,
NULL
};
 
Another odd thing
When I set com 1 failure and then shutoff the radio 1 (Comm1_On_Off != 1) - the string remains frozen and appears
Any suggestion to avoid it? Thanks

Code:
FAILURE_RECORD fail_Comm_I[] =
{
    { FAIL_SYSTEM_ELECTRICAL_PANELS, FAIL_ACTION_NO_DRAW },
    { FAIL_SYSTEM_ELECTRICAL_AVIONICS, FAIL_ACTION_NO_DRAW },
    { FAIL_GAUGE_COMMUNICATIONS, FAIL_ACTION_FREEZE },
    { FAIL_NONE, FAIL_ACTION_NONE }
};

Code:
FLOAT64 FSAPI com1_ACTV_string_cb(PELEMENT_STRING pelement)
{
    int com1_ACTV = pelement->source_var[0].var_value.d;
  
    if ((Comm1_On_Off == 1) && (Battery_On_Off == 1) && (Avionics_On_Off == 1))
    {
        SHOW_IMAGE(pelement);
    }
    else
    {
        HIDE_IMAGE(pelement);
    }

    sprintf(pelement->string, "1%02x.%02x", com1_ACTV / 0x100, com1_ACTV % 0x100);
    return com1_ACTV;
}

Code:
MAKE_STRING
(
com1_ACTV_string,
NULL,
fail_Comm_I,
IMAGE_USE_ERASE | IMAGE_USE_BRIGHT | IMAGE_USE_TRANSPARENCY,
0,
47, 26,
210, 74,
6,
COM_FREQUENCY,
MODULE_VAR_NONE,
MODULE_VAR_NONE,
RGB(255, 0, 0),
RGB(0, 0, 0),
RGB(92, 92, 92),
GAUGE_FONT_DEFAULT,
GAUGE_WEIGHT_DEFAULT,
GAUGE_CHARSET,
0,
0,
NULL,
com1_ACTV_string_cb
)

Code:
PELEMENT_HEADER avionics_icon_list[] =
{
    &com1_ACTV_string.header,
    NULL
};
 
I have never used the FAILURE_RECORD. I find it pretty worthless.
Indeed
My thought is to use failure to disable radio completely. That's why I'm trying different methods of interaction with failures now
 
If you want failures, you're going to have to write your own custom code. The built-in stuff isn't worth the effort.
 
Back
Top