May 23, 200323 yr I have a gauge I would like to receive a var sent out from a server gauge. I have read the SDK, which illustrates three syntax codes: void register_var_by_name(PVOID var, VAR_TYPE var_type, PSTRINGZ name)void unregister_var_by_name(PSTRINGZ name)void initialize_var_by_name(PMODULE_VAR module_var, PSTRINGZ name)However, I'm a little unsure how to use them, as I cannot find any examples in the SDK or elsewhere. If anyone has any experience setting up a client gauge to receive a custom var from a server gauge I would really appreciate a little help getting started! Many thanks. Andrew
May 23, 200323 yr Server Gauge:BOOL fcc_pos;In PANEL_SERVICE_PRE_INSTALL: register_var_by_name (&fcc_pos, TYPE_BOOL, "FCC Power On");In PANEL_SERVICE_PRE_KILL: unregister_var_by_name ("FCC Power On");Make sure the server gauge is on the main panel.Client Gauge:MODULE_VAR fcc_pos;BOOL* FCC_On;In PANEL_SERVICE_PRE_UPDATE:if (fcc_pos.var_ptr == NULL){ initialize_var_by_name (&fcc_pos, "FCC Power On"); FCC_On = fcc_pos.var_ptr;}Use FCC_On as normal. ;)Matt Matt KaprockiFor fastest support, please submit a ticket at http://support.precisionmanuals.com
May 24, 200323 yr Check the SDK.Flightmap.c sample from the SDK, it shows the use of a clint gauge (not the server).Arne Bartels
May 25, 200323 yr Thanks for your help. I have looked at the Flightmap.SDK and the above example - though I'm still missing something - and I can't find out what. I don't understand why what I have below does not work? If anyone can see anything I have missed out, or something that may be in the wrong place I would be very grateful if you could let me know. The gauge compiles and works in FS with token vars - though I would like it to use my own. /////////////////////////////////////////MODULE_VAR afttrim;initialize_var_by_name (&afttrim, "Afttrim System");aft = (afttrim*)afttrim.var_ptr;void FSAPI atatankCallback ( PGAUGEHDR pgauge, SINT32 service_id, UINT32 extra_data ){switch(service_id){case PANEL_SERVICE_CONNECT_TO_WINDOW:FSUIPC_Open(SIM_FS2K2 , &dwResult);break;case PANEL_SERVICE_PRE_UPDATE://if condition to top up tanks set the level to 100%=66536*128if (aft == 0){ fuellevel=66536*128;FSUIPC_Write(LEFT_AUX_LEVEL, 4, &fuellevel, &dwResult);FSUIPC_Write(RIGHT_AUX_LEVEL, 4, &fuellevel, &dwResult);FSUIPC_Process(&dwResult);}//if condition to empty tanks set the level to 0%=0if (aft == 1){ fuellevel=0;FSUIPC_Write(LEFT_AUX_LEVEL, 4, &fuellevel, &dwResult);FSUIPC_Write(RIGHT_AUX_LEVEL, 4, &fuellevel, &dwResult);FSUIPC_Process(&dwResult);}break;////////////////////////////////////////Thanks again, Andrew
May 25, 200323 yr Got it to work. :-) I found some good examples in the sd2gau14 documentation that showed the layout of the client gauge. Thanks Matt for the post, and also a big thank you to Arne, for all your help this week. Regards,Andrew
Create an account or sign in to comment