Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Download Outerra Tech Demo. Unofficial Outerra Discord server, MicroProse Discord server for OWS.

Author Topic: html config scripting  (Read 7421 times)

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1761
html config scripting
« on: July 03, 2019, 09:30:07 am »

I am trying to do a minimal modification of the config window of the tatra t817 found in the Anteworld/packages/outerra/  folder to start learning to use the functionality offered by this window.
As a start I just wanted to add a slider for wheel-radius but cannot get it to work. Here is what i did:

In vehicle_config file   (which for me is in   C:\Program Files (x86)\Outerra\Anteworld\packages\outerra\t817\config)
to the unordered list inside the <div> tag I added a new slider  ("radius") and inside the <script> tag
added one more component  ("radius") and adjusted the radius property of the function create_dummy_domain_object ()  so to be compatible with a slider. In the t817.js model javascript correspondingly adjusted
var DefaultWheelParams = {radius: { default: 0.7 , min:0.5, max:2, step: 0.1 },....


I can open the config window after having spawned the t817 using "t" key and adjust all values, but there is a problem: for the radius whatever value I set after closing and reopening the config window it allways
keeps the min value instead of the set value. Also changing the radius value and closing the window does not affect the vehicle physics whereas all other values do affect the vehicle physics. As I am new to the html scripting in outerra I am struggling to understand what is wrong. I could not identify any point in the html where something else should be added.

Note that I left the "return statement of the model javascript as is " (see below). I guess the steering_params: {radius: 0.195} there has nothing to do with wheel_params radius.


Code: [Select]

<div>
....
    <li id="radius" class="fn fcr margin-sm-top">
       <span class="f1 ellipsis">Radius</span>
       <span class="f1 margin-h"><input style="width: auto;" type="range"></span>
       <span class="fn"><input class="input input-sm input-secondary tac" type="text" size="3"></span>
    </li>

</div>


 <script>
   var components = {};
   components.radius = create_component('radius'); <-----new component
   components.suspension_max = create_component('suspension_max');
  ..
     function create_dummy_domain_object () {
            var $ctx = {};
            $ctx.DefaultWheelParams = {
                radius: { default: 0.7 , min:0.5, max:2, step: 0.1 },
      ...
     }



</script>




Code: [Select]
return {
    mass:mass,
    com:{z:com},
    config: "config/vehicle_config.html",
    steering_params: {
      radius: 0.195
    }
  };
}
« Last Edit: July 03, 2019, 10:20:49 am by fly77 »
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: html config scripting
« Reply #1 on: July 03, 2019, 05:13:58 pm »

Um .. I don't think the radius there is used at all, not even sure what it was supposed to do (in steering params). There's a radius in wheel params (when adding wheels in init_chassis), and there is also a dynamic set_wheel_radius(int wheel, float rad) method.
Logged