Solved simpleFunction for hot water temperature

Discussion in 'Mod Support' started by schumacher, Feb 3, 2018.

  1. schumacher

    schumacher
    Expand Collapse

    Joined:
    Sep 1, 2013
    Messages:
    1,053
    hotengine seem to not work anymore. Is there any other command to get it working?
     
  2. Deleted member 160369

    Deleted member 160369
    Expand Collapse
    Guest

    EDIT - Misread, sorry.
     
  3. Diamondback

    Diamondback
    Expand Collapse
    Vehicle Systems Lead
    BeamNG Team

    Joined:
    Apr 8, 2014
    Messages:
    1,957
    There are both "oiltemp" and "watertemp", maybe these are what you are looking for :)
     
  4. Deleted member 160369

    Deleted member 160369
    Expand Collapse
    Guest

    I think he's trying to simulate the high temperature warning light in the instrument panel. watertemp is the thermometer function (same as the coolant instrument gauge in the GUI), right?
     
  5. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    Well, there is coolantTemperature variable in combustionEngineThermals.lua

    Problem is that I'm not aware how I could set or read variables in combustionEngineThermals.lua

    In guiSend there is coolantTemperature = M.coolantTemperature, which gets coolant temperature. M is from my limited understanding current program, that is combustionEngineThermals.lua

    In function reset there is M.coolantTemperature = startingTemperature

    With my limited understanding, I would think that there should be function coolantTemperature in combustionEngineThermals.lua because it is called with M like in M.coolantTemperature, but there is none, so this lua is not really quite working way I except, I know bit too little.

    However coolantTemperature seems to be what one needs to set, somehow, I don't know how. Or then set startingTemperature.

    Diamondback says everything is in electrics, but I know only of electrics.values and I can't get list of what is in there with print(electrics.values) because it wants to spit out table and that is not working.

    Even when I try print(electrics.values.waterTemp) it gives me NIL in vehicle lua. Would need to figure out bit more to give you anything useful, but if you figure out how to use coolantTemperature or waterTemp, I'm interested to hear how.
     
  6. Diamondback

    Diamondback
    Expand Collapse
    Vehicle Systems Lead
    BeamNG Team

    Joined:
    Apr 8, 2014
    Messages:
    1,957
    What you are looking for is
    Code:
    dump()
    instead of
    Code:
    print()
    :)
     
  7. fufsgfen

    fufsgfen
    Expand Collapse

    Joined:
    Jan 10, 2017
    Messages:
    6,782
    Aah, thanks from this, I learned new useful thing, so my world domination is again one step closer ... erm, just ignore that last part :p
     
  8. schumacher

    schumacher
    Expand Collapse

    Joined:
    Sep 1, 2013
    Messages:
    1,053
    Thank you all for trying to help me.

    I tried darrens method first. What I did is creating a new lua file with this code

    Code:
    local M = {}
    
    local function init()
       electrics.values.waterwarn = 0
    end
    
    local function reset()
       init()
    end
    
    local function updateGFX(dt)
     
       if electrics.values.watertemp > 105 then electrics.values.waterwarn = 1 else electrics.values.waterwarn = 0 end
     
    end
    
    M.onInit = init
    M.onReset = init
    M.updateGFX = updateGFX
    
    return M
    Then I opened my jbeam file and replaced the "simpleFunction":"hotengine" with "electrics.values.watertemp" which gave me a fatal vehicle exception. I tried some others like 0, 1 and coolantTemperature but it's not working. I am convinced I just understood some steps wrong or so.

    Unbenannt.png Unbenannt2.png
     
  9. schumacher

    schumacher
    Expand Collapse

    Joined:
    Sep 1, 2013
    Messages:
    1,053
    Thank you! It now works perfectly fine. I just created another lua file for the oil temperature and connected them to the glow map path and adjusted the temperatures.
     
  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