Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

register_variable_by_name

Featured Replies

  • Commercial Member

I'm just at the tidying-up stage of a new sound gauge for FS9/FSX when I realise that what's good for me isn't good for the rest of you... i.e I've been playing sound files by referring to them as a number read from a list and not as a string. Looking down through the fsxgauges.h files, I seeregister_variable_by_name(PCSTRINGZ)which looks like it sorts the problem. Well, that problem anyway. Maybe. :). The follow-up problem is that if I register a string variable to carry the soundfile name, how do I read it at the other end?get_variable_by_nameby any chance? Anyone got any ideas....? samples....?-Dai

Dai,I think you are referring to: ID (FSAPI *register_named_variable) (PCSTRINGZ name);This function creates an XML L:Variable, not a shared string variable.My suggestion would be to declare an old fashioned C gauge shared variable which will hold a pointer to the structure you have your sound names and .wav files stored in.Doug

  • Author
  • Commercial Member

Ed: Unless I'm completely mistaken (which is very definately not beyond the realms of possibility!) typedef_enum VAR_TYPE contains only numerical fields of various radices. I have to admit that the only var type that has me puzzled is TYPE_VARxx; it has to be something I've never needed to use and so I've never pursued it.Doug:The last time I tried to do that, the compiler repeatedly gave me the proverbial finger. Could I ask you to provide a code snippet example please? Email me if you think it's easier. I'd like to get this gauge out ASAP. I will state that it is only a stop-gap and that currently it will only play mono sounds - stereo and panning will come later.-Dai

  • Commercial Member

>Ed: >>Unless I'm completely mistaken (which is very definately not>beyond the realms of possibility!) typedef_enum VAR_TYPE>contains only numerical fields of various radices. I have to>admit that the only var type that has me puzzled is>TYPE_VARxx; it has to be something I've never needed to use>and so I've never pursued it.>You're completely mistaken... ;)Your variable is one of these: VAR_TYPE. Do a search in gauges.h. For a pointer you would use TYPE_VOID, for a pointer to a pointer you would use TYPE_PVOID. As an example, assume you have a variable declared as:char* wpt_id[40];To allow other gauges to 'see' this... you'd declare it like this:register_var_by_name(&wpt_id,TYPE_PVOID,"wpt_id");This would pass a pointer to the char* variable named wpt_id.

Ed Wilson

Mindstar Aviation
My Playland - I69

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.