Jump to content
The simFlight Network Forums

How many AI LUA - help needed


Recommended Posts

Guys,

I'm using this LUA on a networked PC (for WideClient), that shows me FPS and VAS used:

Quote

 

-- Create the display window for 2 values, position x=800, y=400
h = display.create("My next display", 2, 800, 400)


-- Update the display at 500 msec intervals (see event at end)
function mytimer(time)


    -- display 1 = frame rate
    fr = ipc.readUW(0x0274)
    if fr ~= 0 then fr = 32768/fr end
    fr = math.floor((fr * 10) + 0.5)/10
    display.show(h, 1, "Frame Rate " .. fr .. " fps")
   
    -- display 2 = memory left free
    mem = ipc.readUD(0x024C)
    memmb = math.floor((mem/1024) + 0.5)
    display.show(h, 2, "Memory free " .. mem .. " kb (" .. memmb .. " Mb)")
   
end


-- Adjust timing to taste: 500 = 1/2 second
event.timer(500, "mytimer")

 

Could somebody savvy with FSUIPC and LUA kindly add necessary lines to the above also to display number of AI aircraft currently in P3Dv4?

Thanks

PS: I'm on P3Dv4

Edited by Sabrefly
Link to comment
Share on other sites

I've moved your support request from the "User Contributions" subforum, which is a library repository for user contributions, to the correct Support Forum. Please always post support questions here if you want answers!

12 minutes ago, Sabrefly said:

Could somebody savvy with FSUIPC and LUA kindly add necessary lines to the above also to display number of AI aircraft currently in P3Dv4?

Since the "memory left" is useless in P3D4 why not just replace the offset (24C) read there by the one for the AI count (25C), also a "UD", and change the text label accordingly?

Pete

 

  • Like 1
Link to comment
Share on other sites

13 hours ago, Pete Dowson said:

I've moved your support request from the "User Contributions" subforum, which is a library repository for user contributions, to the correct Support Forum. Please always post support questions here if you want answers!

Since the "memory left" is useless in P3D4 why not just replace the offset (24C) read there by the one for the AI count (25C), also a "UD", and change the text label accordingly?

Pete

 

Will do that,

Thank you.

Quote

  -- display 2 = number of AI
    traff = ipc.readUD(0x025C)
    display.show(h, 3, "AI Number " ..traff)

The above should work

Edited by Sabrefly
Link to comment
Share on other sites

Hmm unfortunately I don't get AI count in the display (second value). I still have Frame Rate indication but no AI count?

-- Create the display window for 2 values, position x=800, y=400
h = display.create("My next display", 2, 800, 400)


-- Update the display at 500 msec intervals (see event at end)
function mytimer(time)


    -- display 1 = frame rate
    fr = ipc.readUW(0x0274)
    if fr ~= 0 then fr = 32768/fr end
    fr = math.floor((fr * 10) + 0.5)/10
    display.show(h, 1, "Frame Rate " .. fr .. " fps")
   
    -- display 2 = number of AI
    traff = ipc.readUD(0x025C)
    display.show(h, 3, "AI Number " ..traff)
   
end


-- Adjust timing to taste: 500 = 1/2 second
event.timer(500, "mytimer")

What could be wrong there?

Win10, P3Dv4.1, FSUIPC v5.122a, MT6

WideClient v6.999z4 (Win7)

Thanks.

PS: Do I need to set anything special for that in FSUIPC?

 

Edited by Sabrefly
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.