Oxygen?

Fly high, fast, and far in first class comfort
User avatar
CaptKornDog
Airman First Class
Posts: 67
Joined: 28 Nov 2013, 22:47

Re: Oxygen?

Post by CaptKornDog »

Caldemeyn wrote:Well, one would think that having options at your disposal is A2A's way, having this system would only better the plane.
Definitely.

User avatar
CaptKornDog
Airman First Class
Posts: 67
Joined: 28 Nov 2013, 22:47

Re: Oxygen?

Post by CaptKornDog »

Anyone know of aircraft edits that may be able to force hypoxia to disabled? I've been looking but can't seem to find anything.

User avatar
Nick - A2A
A2A Captain
Posts: 13766
Joined: 06 Jun 2014, 13:06
Location: UK

Re: Oxygen?

Post by Nick - A2A »

CaptKornDog wrote:Anyone know of aircraft edits that may be able to force hypoxia to disabled?
Using FSUIPC, you could certainly modulate the "L:OxyBloodLevel" L:Var, keeping it at (or close to) 100 via a Lua plug-in or something. :wink: Not sure if there any other ways to go about 'overcoming' the hypoxia effect which don't rely on owning a registered copy of FSUIPC.

Nick

User avatar
CaptKornDog
Airman First Class
Posts: 67
Joined: 28 Nov 2013, 22:47

Re: Oxygen?

Post by CaptKornDog »

Nick M wrote:
CaptKornDog wrote:Anyone know of aircraft edits that may be able to force hypoxia to disabled?
Using FSUIPC, you could certainly modulate the "L:OxyBloodLevel" L:Var, keeping it at (or close to) 100 via a Lua plug-in or something. :wink: Not sure if there any other ways to go about 'overcoming' the hypoxia effect which don't rely on owning a registered copy of FSUIPC.

Nick
Could you elaborate? I've never used Lua.

User avatar
Nick - A2A
A2A Captain
Posts: 13766
Joined: 06 Jun 2014, 13:06
Location: UK

Re: Oxygen?

Post by Nick - A2A »

CaptKornDog wrote:Could you elaborate? I've never used Lua.
Yeah, sure. I'd never created a Lua script either, but I did have a little play with this earlier in case anyone asked! :mrgreen:

In its simplest form you could just use something like...

Code: Select all

-- Loop until stopped with LuaKill
while 1 do
    -- Set blood oxygen saturation at 100%
    ipc.writeLvar('L:OxyBloodLevel', 100)
end
Once started, this script should keep the "OxyBloodLevel" L:Var permanently at 100, effectively disabling the A2A hypoxia simulation.

However, you could elaborate on this a bit to create a slightly more authentic 'magic cannula' effect which periodically tops up the blood oxygen level. (Magic, inasmuch as it doesn't need an oxygen supply and never runs out!) A script like this for example should do the trick...

Code: Select all

-- Loop until stopped with LuaKill
while 1 do
   -- Pause for 10 seconds
   ipc.sleep(10000)
   BloodOxy = ipc.readLvar("OxyBloodLevel")
   if BloodOxy < 90 then
      -- Increase blood oxygen saturation by 4%
      ipc.writeLvar('L:OxyBloodLevel', BloodOxy + 4)
   end
end
Basically, all you'll need to do is create a text file containing the above text, rename it with the ".Lua" extension, e.g. "Oxycheat.lua" and drop it into your "Modules" directory. Then start the host sim, and in FSUIPC assign a button or keystroke for "Lua Oxycheat" (to turn it on) and another for "LuaKill Oxycheat" (to stop it).

Of course, this is no substitute for a proper A2A simulated oxygen delivery system but in the meantime it should allow you to reach the service ceiling of the Comanche without blacking out. It should work with the rest of the A2A GA fleet too.

Cheers,
Nick

P.S. Hope it's okay with the A2A guys to describe this little cheat for FSUIPC users. If any Lua gurus have suggestions for a better script, please be my guest. :wink:

User avatar
CaptKornDog
Airman First Class
Posts: 67
Joined: 28 Nov 2013, 22:47

Re: Oxygen?

Post by CaptKornDog »

Nick M wrote:
CaptKornDog wrote:Could you elaborate? I've never used Lua.
Yeah, sure. I'd never created a Lua script either, but I did have a little play with this earlier in case anyone asked! :mrgreen:

In its simplest form you could just use something like...

Code: Select all

-- Loop until stopped with LuaKill
while 1 do
    -- Set blood oxygen saturation at 100%
    ipc.writeLvar('L:OxyBloodLevel', 100)
end
Once started, this script should keep the "OxyBloodLevel" L:Var permanently at 100, effectively disabling the A2A hypoxia simulation.

However, you could elaborate on this a bit to create a slightly more authentic 'magic cannula' effect which periodically tops up the blood oxygen level. (Magic, inasmuch as it doesn't need an oxygen supply and never runs out!) A script like this for example should do the trick...

Code: Select all

-- Loop until stopped with LuaKill
while 1 do
   -- Pause for 10 seconds
   ipc.sleep(10000)
   BloodOxy = ipc.readLvar("OxyBloodLevel")
   if BloodOxy < 90 then
      -- Increase blood oxygen saturation by 4%
      ipc.writeLvar('L:OxyBloodLevel', BloodOxy + 4)
   end
end
Basically, all you'll need to do is create a text file containing the above text, rename it with the ".Lua" extension, e.g. "Oxycheat.lua" and drop it into your "Modules" directory. Then start the host sim, and in FSUIPC assign a button or keystroke for "Lua Oxycheat" (to turn it on) and another for "LuaKill Oxycheat" (to stop it).

Of course, this is no substitute for a proper A2A simulated oxygen delivery system but in the meantime it should allow you to reach the service ceiling of the Comanche without blacking out. It should work with the rest of the A2A GA fleet too.

Cheers,
Nick

P.S. Hope it's okay with the A2A guys to describe this little cheat for FSUIPC users. If any Lua gurus have suggestions for a better script, please be my guest. :wink:
Thank you. Is there a way to display a momentary message or indication that the LUA script is actually on/active?

User avatar
Nick - A2A
A2A Captain
Posts: 13766
Joined: 06 Jun 2014, 13:06
Location: UK

Re: Oxygen?

Post by Nick - A2A »

Yeah, I believe it would be possible to add something like that using the ipc.linedisplay function (or offset 3380). I'm working away from home for the next week or so but I'll try and take a look when I get a few moments next month...

Cheers,
Nick

User avatar
renaissanceman
Technical Sergeant
Posts: 597
Joined: 13 Apr 2008, 08:29
Location: Bedford, Texas

Re: Oxygen?

Post by renaissanceman »

CaptKornDog wrote:
Thank you. Is there a way to display a momentary message or indication that the LUA script is actually on/active?
Hi Capt,

Creating a display in a Lua script is pretty easy. I'm just scratching the surface of Lua but here is a script I use to monitor my strobe lights and display the status:

Code: Select all

-- A2A_PA24_StrobeStatus.lua

-- Reads value of L:StrobeLightSwitch and displays On or Off

function dispStrobe(Lvar, val)

ipc.setowndisplay("Strobe Light", 15, 5, 25, 5)	-- Set size and location of display window titled Strobe Light

StrobeVal=val	-- Pass StrobeLightSwitch value to 'StrobeVal' variable

	if StrobeVal == 0 then

		ipc.display("Strobe Light Off", 5)  -- Display text for 5 sec

	end

	if StrobeVal == 1 then

		ipc.display("Strobe Light On", 5)  -- Display text for 5 sec

	end


end

event.Lvar("L:StrobeLightSwitch",2000,"dispStrobe")  -- Read Lvar 'L:StrobeLightSwitch' and pass value to 'dispStrobe' function above
Paul/GypsyBaron is the FSUIPC/Lua guru around here, he will probably chime in at some point.

Hope this helps,
Jim
i7-6700K @ 4.0 GHz | ASUS Maximus VIII Formula | 32 GB DDR4 | EVGA GeForce GTX 980TI Classified |
Win 10 Pro 64 | FSX SE | Registered FSUIPC | All Accu-Sim Birds | Accu-Feel v2 | TrackIR5 | AS16 | PRO-ATC/X

User avatar
CaptKornDog
Airman First Class
Posts: 67
Joined: 28 Nov 2013, 22:47

Re: Oxygen?

Post by CaptKornDog »

Nick M wrote:Yeah, I believe it would be possible to add something like that using the ipc.linedisplay function (or offset 3380). I'm working away from home for the next week or so but I'll try and take a look when I get a few moments next month...

Cheers,
Nick
Thank you.

User avatar
Nick - A2A
A2A Captain
Posts: 13766
Joined: 06 Jun 2014, 13:06
Location: UK

Re: Oxygen?

Post by Nick - A2A »

The method that Jim posted above should work fine CaptKD. You'd just need to to edit the script as follows...

Code: Select all

ipc.display("Magic Oxygen Supply Active", 4) -- Display text for 4 seconds
while 1 do  -- Loop until stopped with LuaKill
   -- Pause for 10 seconds
   ipc.sleep(10000)
   BloodOxy = ipc.readLvar("OxyBloodLevel")
   if BloodOxy < 90 then
      -- Increase blood oxygen saturation by 4%
      ipc.writeLvar('L:OxyBloodLevel', BloodOxy + 4)
  end
end
Cheers,
Nick

kityatyi
Airman
Posts: 48
Joined: 21 May 2016, 18:14

Re: Oxygen?

Post by kityatyi »

Works like a charm, thank you so much guys! Just tested, spending 60 minutes at FL160 holding at SNU VOR near LOWW! Just to make it "complete" is there any chance to add an "Oxygen Supply Off" message to display for 4 seconds when turning it off (since there is a message displayed when turning it on, it would be nice to have one when deactivating, too).

User avatar
Nick - A2A
A2A Captain
Posts: 13766
Joined: 06 Jun 2014, 13:06
Location: UK

Re: Oxygen?

Post by Nick - A2A »

Glad you found it helpful. :) I'm not sure it's possible to add a deactivation message to the script above though. That's because it's disabled by simply 'killing' the entire Lua. As mentioned above, I'm very much a Lua novice and this is the first/only time I've experimented with it. Maybe one of the other guys such as Paul S ("Gypsy Baron") who is a Lua expert will be able to suggest something?

Cheers,
Nick

alioth
Senior Airman
Posts: 162
Joined: 01 Feb 2017, 17:05

Re: Oxygen?

Post by alioth »

In my a2a comanche home cockpit Im building Im going to add a oxygen tank in a similar way.

The tank will fill everytime you are in ground.
With a switch (a real one) you open the valve and a indicator (real led lights) show you how many oxygen is in tank. It can be programed to last the time needed. I dont know how many time is the usual.

The realair lancair v2 has this system simulated. I will study those variables to do something similar.

I think that better than "while 1 do..." is to use the event.Lvar function

I have working in something quite similar right now.
I have made a bendix king KA51b free-slave switch which is used with and bendix king hsi. All synchro with a2a comanche.
In slave mode, with lua programming, drift variable is decreasing little by little (at real world correction rate).

I can show it here if you want.

Lua rocks!

User avatar
Nick - A2A
A2A Captain
Posts: 13766
Joined: 06 Jun 2014, 13:06
Location: UK

Re: Oxygen?

Post by Nick - A2A »

alioth wrote:I can show it here if you want.
Yes please! It sounds great. :)

Thanks,
Nick

Taka taka
Senior Airman
Posts: 202
Joined: 30 Aug 2005, 22:04
Contact:

Re: Oxygen?

Post by Taka taka »

I have a suggestion. (Don't hit me please) :mrgreen:

An addon.

Can you imagine going to your favorite flight shop and buying a three dollar O2 addon?
"Spring Chicken to Shite Hawk in one easy lesson...taka taka taka taka..."

new reply

Return to “Piper Comanche 250”

Who is online

Users browsing this forum: No registered users and 5 guests