Jump to content
The simFlight Network Forums

LUA Friction question


Recommended Posts

4 hours ago, PhugoidEffect said:

Can I easily prevent one specific aircraft from using the LUA Friction solution, and let all others use it normally?

If you have all aircraft in profiles, just use the appropriate [Auto.profile] sections to say whether to load it or not.

Otherwise, add an aircraft identity check at the start of the Lua plug in, restoring instead of changing the values if the aircraft name matches one you don't want it applied to. An event triggered by changing aircraft name would ensure it knows.

Pete

 

Link to comment
Share on other sites

On 22/02/2017 at 6:44 AM, Pete Dowson said:

If you have all aircraft in profiles, just use the appropriate [Auto.profile] sections to say whether to load it or not.

Otherwise, add an aircraft identity check at the start of the Lua plug in, restoring instead of changing the values if the aircraft name matches one you don't want it applied to. An event triggered by changing aircraft name would ensure it knows.

Pete

 

 

Is there a function or something that allows me to get the aircraft name? This is the only thing lacking in order to try to rewrite the script. :-)

Thanks!

 

Link to comment
Share on other sites

1 hour ago, PhugoidEffect said:

Is there a function or something that allows me to get the aircraft name?

You simply read it from FS using the ipc.readSTR function. The data you can read from FS is all listed in the Offsets Status list.   I just searched for it and found:

3D00    256
Name of the current aircraft (from the “title” parameter in the AIRCRAFT.CFG file)

so

name = ipc.readSTR(0x3D00)

Pete

 

Link to comment
Share on other sites

On 2/26/2017 at 10:13 AM, PhugoidEffect said:

 

Is there a function or something that allows me to get the aircraft name? This is the only thing lacking in order to try to rewrite the script. :-)

Thanks!

 

 

PhugoidEffect, do you mind sharing your ready script here, thanks!

Sabrefly

Link to comment
Share on other sites

12 hours ago, Sabrefly said:

 

PhugoidEffect, do you mind sharing your ready script here, thanks!

Sabrefly

Absolutely!

First I'd like to thank Pete for his always great support, and actually I have read the manuals and googled a bit and found the good stuff. Now my script is like below. It seems to be working good for all aircraft.

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

-- This sets frictions according to recommendations by Johan Dees, early December 2012

-- Modded by Bob Scott to restrict wheel and brake reduced rolling friction effects to taxi speeds
-- in order to preserve FDE-driven TOLD performance (on hard-surfaces only)

ipc.RestoreFriction()

acftname = ipc.readSTR("3D00", 35)
if string.find(acftname,"FSLabs",0,true)
then
ipc.exit()
end

-- The original FSX values are shown in the comment at the end of each code line

ipc.SetFriction(WHEEL,    CONCRETE,        ROLLING,    DRY,    0.030) --0.050
ipc.SetFriction(WHEEL,    GRASS,            ROLLING,    DRY,    0.060) --0.080
ipc.SetFriction(WHEEL,    GRASS_BUMPY,        ROLLING,    DRY,    0.070) --0.090
ipc.SetFriction(WHEEL,    ASPHALT,        ROLLING,    DRY,    0.025) --0.050
ipc.SetFriction(WHEEL,    SHORT_GRASS,        ROLLING,    DRY,    0.050) --0.060
ipc.SetFriction(WHEEL,    LONG_GRASS,        ROLLING,    DRY,    0.060) --0.090
ipc.SetFriction(WHEEL,    DIRT,            ROLLING,    DRY,    0.050) --0.060
ipc.SetFriction(WHEEL,    GRAVEL,            ROLLING,    DRY,    0.060) --0.080
ipc.SetFriction(WHEEL,    BITUMINUS,        ROLLING,    DRY,    0.030) --0.050
ipc.SetFriction(WHEEL,    MACADAM,        ROLLING,    DRY,    0.030) --0.050
ipc.SetFriction(WHEEL,    TARMAC,            ROLLING,    DRY,    0.030) --0.050

ipc.SetFriction(WHEEL,    CONCRETE,        SLIDING,    DRY,    1.000) --0.640
ipc.SetFriction(WHEEL,    GRASS,            SLIDING,    DRY,    0.800) --0.640
ipc.SetFriction(WHEEL,    GRASS_BUMPY,        SLIDING,    DRY,    0.800) --0.640
ipc.SetFriction(WHEEL,    ASPHALT,        SLIDING,    DRY,    0.950) --0.640
ipc.SetFriction(WHEEL,    SHORT_GRASS,        SLIDING,    DRY,    0.800) --0.640
ipc.SetFriction(WHEEL,    LONG_GRASS,        SLIDING,    DRY,    0.800) --0.640
ipc.SetFriction(WHEEL,    DIRT,            SLIDING,    DRY,    0.800) --0.640
ipc.SetFriction(WHEEL,    GRAVEL,            SLIDING,    DRY,    0.800) --0.640
ipc.SetFriction(WHEEL,    BITUMINUS,        SLIDING,    DRY,    1.000) --0.640
ipc.SetFriction(WHEEL,    MACADAM,        SLIDING,    DRY,    0.950) --0.550
ipc.SetFriction(WHEEL,    TARMAC,            SLIDING,    DRY,    1.000) --0.640

ipc.SetFriction(BRAKE,    CONCRETE,        ROLLING,    DRY,    0.900) --0.700
ipc.SetFriction(BRAKE,    GRASS,            ROLLING,    DRY,    0.700) --0.500
ipc.SetFriction(BRAKE,    GRASS_BUMPY,        ROLLING,    DRY,    0.650) --0.400
ipc.SetFriction(BRAKE,    ASPHALT,        ROLLING,    DRY,    0.900) --0.700
ipc.SetFriction(BRAKE,    SHORT_GRASS,        ROLLING,    DRY,    0.650) --0.500
ipc.SetFriction(BRAKE,    LONG_GRASS,        ROLLING,    DRY,    0.650) --0.500
ipc.SetFriction(BRAKE,    GRAVEL,            ROLLING,    DRY,    0.650) --0.500
ipc.SetFriction(BRAKE,    BITUMINUS,        ROLLING,    DRY,    0.900) --0.700
ipc.SetFriction(BRAKE,    MACADAM,        ROLLING,    DRY,    0.900) --0.700
ipc.SetFriction(BRAKE,    TARMAC,            ROLLING,    DRY,    0.900) --0.700

--restore friction/braking to default when above taxi speed to preserve FDE performance fidelity

taxi_spd = 10  --changeover threshold in knots groundspeed
cur_status = 1
while 1 do

GS_ipc = ipc.readSD(0x2B4)
GS = GS_ipc / 65536.0 * 1.94384 --groundspeed in knots
if GS < taxi_spd
  then
    slow = 1
  else
    slow = 0
end

if cur_status ~= slow   -- threshold was crossed
  then
    cur_status = slow
    if slow
      then
        ipc.SetFriction(WHEEL,    CONCRETE,        ROLLING,    DRY,    0.025)
        ipc.SetFriction(WHEEL,    ASPHALT,        ROLLING,    DRY,    0.030)
        ipc.SetFriction(WHEEL,    BITUMINUS,        ROLLING,    DRY,    0.030)
        ipc.SetFriction(WHEEL,    MACADAM,        ROLLING,    DRY,    0.030)
        ipc.SetFriction(WHEEL,    TARMAC,            ROLLING,    DRY,    0.030)
        ipc.SetFriction(BRAKE,    CONCRETE,        ROLLING,    DRY,    0.900)
        ipc.SetFriction(BRAKE,    ASPHALT,        ROLLING,    DRY,    0.900)
        ipc.SetFriction(BRAKE,    BITUMINUS,        ROLLING,    DRY,    0.900)
        ipc.SetFriction(BRAKE,    MACADAM,        ROLLING,    DRY,    0.900)
        ipc.SetFriction(BRAKE,    TARMAC,            ROLLING,    DRY,    0.900)
      else --restore to defaults when above taxi spd
        ipc.SetFriction(WHEEL,    CONCRETE,        ROLLING,    DRY,    0.050)
        ipc.SetFriction(WHEEL,    ASPHALT,        ROLLING,    DRY,    0.050)
        ipc.SetFriction(WHEEL,    BITUMINUS,        ROLLING,    DRY,    0.050)
        ipc.SetFriction(WHEEL,    MACADAM,        ROLLING,    DRY,    0.050)
        ipc.SetFriction(WHEEL,    TARMAC,            ROLLING,    DRY,    0.050)
        ipc.SetFriction(BRAKE,    CONCRETE,        ROLLING,    DRY,    0.700)
        ipc.SetFriction(BRAKE,    ASPHALT,        ROLLING,    DRY,    0.700)
        ipc.SetFriction(BRAKE,    BITUMINUS,        ROLLING,    DRY,    0.700)
        ipc.SetFriction(BRAKE,    MACADAM,        ROLLING,    DRY,    0.700)
        ipc.SetFriction(BRAKE,    TARMAC,            ROLLING,    DRY,    0.700)
    end
end

ipc.sleep(999)

end --loop indefinitely

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.