1. Trouble with the game?
    Try the troubleshooter!

    Dismiss Notice
  2. Issues with the game?
    Check the Known Issues list before reporting!

    Dismiss Notice
  3. Before reporting issues or bugs, please check the up-to-date Bug Reporting Thread for the current version.
    0.32 Bug Reporting thread
    Solutions and more information may already be available.

Can you create "hidden" variables

Discussion in 'Troubleshooting: Bugs, Questions and Support' started by Capkirk, Jan 20, 2019.

  1. Capkirk

    Capkirk
    Expand Collapse

    Joined:
    Nov 19, 2017
    Messages:
    673
    I was wondering if it's possible to create a Jbeam variable that acts like a normal variable but is "hidden" from the player, and is only used as a variable for some internal math. I'm trying to use (heavily abuse) the stock variable system to create a dynamic engine, and while it does work, it also fills the tuning menu with variables that the player can't modify. If I could hide them from the tuning menu, it would make it a lot nicer.
     
  2. Diamondback

    Diamondback
    Expand Collapse
    Vehicle Systems Lead
    BeamNG Team

    Joined:
    Apr 8, 2014
    Messages:
    1,957
    No, that's not possible atm. Technically it's probably no problem to hide them but we are trying to keep the complexity low.
    What exactly are you working on?
     
  3. Capkirk

    Capkirk
    Expand Collapse

    Joined:
    Nov 19, 2017
    Messages:
    673
    I'm using variables to store data in single parts to make more heavily customizable engines. For example, if I give an engine separate "block" and "head" parts, and all of those parts have a variable in them representing their max torque, I can take the min of those to variables to set max torque. This way, it simulates having a built block with a stock head, the block can handle a shot of nitrous, but you'll blow the head off, or vice versa. It works really well, but fills the tuning menu with variables that you can't adjust.
     
  4. Diamondback

    Diamondback
    Expand Collapse
    Vehicle Systems Lead
    BeamNG Team

    Joined:
    Apr 8, 2014
    Messages:
    1,957
    Interesting, we'd basically need custom merging strategies when parts overwrite parent data I guess (Ie define if the merging is a sum, a max, min, whatever instead of simply overwriting)

    Do you mind sharing what you are working on with me so that I can take a look?
     
  5. Capkirk

    Capkirk
    Expand Collapse

    Joined:
    Nov 19, 2017
    Messages:
    673
    I can send you the full file later, but basically what it is is:
    Code:
    "engine_test":{
    //engine code stuff
         "maxTorque":"$=min($headTorque, $blockTorque),
    //more engine code
    }
    "test_head_stock":{
    //intake torque modifiers
    "variable":[
         [name, type, unit, default, min, max]
         ["$headTorque", "range", "", 400, 400, 400]
    ],
    },
    "test_head_heavy":{
    //intake torque modifiers
    "variable":[
         [name, type, unit, default, min, max]
         ["$headTorque", "range", "", 800, 800, 800]
    ],
    },
    "test_block_stock":{
    //durability modifiers
    "variable":[
         [name, type, unit, default, min, max]
         ["$blockTorque", "range", "", 500, 500, 500]
    ],
    },
    "test_block_heavy":{
    //durability modifiers
    "variable":[
         [name, type, unit, default, min, max]
         ["$blockTorque", "range", "", 1000, 1000, 1000]
    ],
    },
    },
    This is heavily simplified, but hopefully you get the idea. It works perfectly in my tests, although it's a bit difficult to set up.
     
    • Like Like x 2
    • Informative Informative x 1
  6. Capkirk

    Capkirk
    Expand Collapse

    Joined:
    Nov 19, 2017
    Messages:
    673
    So, any opinion on this @Diamondback? I was thinking that since there is already a "type" for variables, you could make "constant" or something a type alongside "range".
     
  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