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.

Can anyone tell me what is wrong with this code?

Featured Replies

Hi all,

This code what I wrote is all about getting an alarm to sound when the fuel reaches a certain value of emptiness, i.e. at 47 gallons. But it ain't working. It is not my intention to assign it to a button. It resides in the actions.lua file for the specific aircraft. The sound file resides in the fsx/sound folder:

-- Fuel Alarm --
function Fuel_Alarm()
if ipc.readLvar("A:FUEL_TOTAL_QUANTITY, gallons")==47 then
    alarmf=sound.play("BingoFuel")
    sound.adjust(alarmf, 100)
    end
    ipc.sleep(50)
end

So far, all my coding that I've assigned to button/switches are working so where have I gone wrong chaps?

Thanks in advance,

D

P.S. If anyone has any idea why my landing lights work but do not illuminate the ground texture in FSX SE, I would love to know.

If you are not assigning your Fuel_Alarm function to a button or switch then how are you calling it?

Chris.

Christopher Bell.

The code looks good but again how are you calling it?

might work better if you make it an LUA file and place it in the modules folder.

Aircraft lights illuminated ground option checked in Fsx settings?

Luke Pype

The function will only trigger when the fuel quantity is exactly 47. This is unlikely. Use <= instead.

When developing functions in LINDA editor you can call them by right-clicking on the function name. You will see a notification in the top line as you do this. It is not necessary to assign functions to buttons to test it.

Andrew Gransden

Scotland, UK

LINDA Support/Developer - VATSIM and BAVirtual - Airbus Flyer

i7 1TB SSD GTX980 - FSX/P3D - Aerosoft Airbus A318/A319/A320/A321 - FS2Crew

<=47 Does that mean “less than or equal to” 47 ?

thanks

Edited by MaDDogz

Luke Pype

== equal to

<= less than or equal to

>= greater than or equal to

~= not equal to

Andrew Gransden

Scotland, UK

LINDA Support/Developer - VATSIM and BAVirtual - Airbus Flyer

i7 1TB SSD GTX980 - FSX/P3D - Aerosoft Airbus A318/A319/A320/A321 - FS2Crew

  • Author

Hi all,

Sorry for the delay in saying thank you for your help.

To answer ccb777, the code resides within a function triggered by a fuel pump switch. Fuel pump is switched on by a .lua function in the action file and then the 'fuel alarm' code sits in the same actions file. I thought the .lua would just keep running so the code would test the fuel level all the time.

But it ain't working. However, at least now you guys think the code is good, I'll look elsewhere.

Thanks all!

D

Well , if it ain’t working then I certainly can’t help you as you have failed to state whether you made changes to the code, as stated above, or not. No time to ask twice...sorry.

 

Luke Pype

Take a look at fsuipc events.

 

Chris.

Christopher Bell.

Apologies for being a bit hot headed with last reply.

using Linda tracer, does ("A:FUEL_TOTAL_QUANTITY, gallons") ever give a value of 47 or below?

also I’m not sure on the (“A...........gallons”)

have you tried removing the quote marks, so (A:.........gallons)?

Luke Pype

  • Author

Thanks for the clues guys, I'll have a look at these suggestions and see what happens.

Don't worry MaDDogz, we all have our moments... Just ask my ex!

Archived

This topic is now archived and is closed to further replies.

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.