dynamic variables with lua and .jbeam

Discussion in 'Content Creation' started by VertexStyle, Sep 28, 2018.

  1. VertexStyle

    VertexStyle
    Expand Collapse

    Joined:
    Dec 11, 2016
    Messages:
    180
    Im struggling for a while now to find a way to overwrite a variable that is defined in a jbeam file with lua.
    Its easy with hydros just by saying electrics.values['myhydroinput'] = x.

    Now I want to redefine the vehicle engine values like torque, rpm etc. via lua.
    However something like v.data.mainEngine['idleRPM'] = x does not work. I can only read the current value, not set it.
    Is there a method for this that I should know of?
    Like obj:changeVar(v.data.mainEngine['idleRPM'], x) or similar..
     
    #1 VertexStyle, Sep 28, 2018
    Last edited: Sep 28, 2018
  2. Cobra_Fast

    Cobra_Fast
    Expand Collapse

    Joined:
    Sep 8, 2015
    Messages:
    25
    I just ran into this with the intention of writing a simple app that would let me change the idle RPM.
    Just trying around with the Vehicle Lua console, doing powertrain.getDevice("mainEngine").idleRPM=2000 does nothing.
    Yet powertrain.getDevice("mainEngine").maxIdleThrottle seems to have an effect as setting it to 0.01 makes the engine slowly die.
    Is there some other way these engine settings can be updated or is it just not possible (yet)?
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice