Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Outerra Tech Demo download. Help with graphics driver issues

Pages: [1] 2

Author Topic: The inclusion of code blocks in "packages\package\vehicle\vehicle.js"  (Read 16260 times)

SteelRat

  • Sr. Member
  • ****
  • Posts: 380
  • newbie

Code: [Select]
/* file: scripts\test.js */
var test = ["test.js"];

Code: [Select]
/* file: scripts\test2.js */
test.push("test2.js");

Code: [Select]
/* file: scripts\test3.js */
test.push("test3.js");

Code: [Select]
/*
    objdef: Logic
    script: logic.js
*/

$include("scripts/test.js");
$include("scripts/test2.js");
$include("scripts/test3.js");

function init_chassis() {

}

function init_vehicle() {
    _veh = this;
    test.forEach(function (val, idx) {
        _veh.log_inf("file is included: " + val);
    });

    /*  Result
        INFO: file is included: test.js
        INFO: file is included: test2.js
        INFO: file is included: test3.js
    */
}

function update_frame() {

}
Logged

HiFlyer

  • Hero Member
  • *****
  • Posts: 1788
  • newbie
Re: The inclusion of code blocks in "packages\package\vehicle\vehicle.js"
« Reply #1 on: March 28, 2015, 05:48:48 pm »

Hmmmmmmmmmmm?
Logged
Spex: Intel Core i7 6700K @ 4.6GHz / 32.0GB G.SKILL TridentZ Series Dual-Channel Ram / ASUS STRIX GeForce GTX 1080 / Sound Blaster Z / Oculus Rift VR Headset / Klipsch® Promedia 2.1 Computer Speakers / ASUS ROG SWIFT PG279Q ‑ 27" IPS LED Monitor ‑ QHD / 2x Samsung SSD 850 EVO 500GB / Windows 10 Pro

SteelRat

  • Sr. Member
  • ****
  • Posts: 380
  • newbie
Logged

HiFlyer

  • Hero Member
  • *****
  • Posts: 1788
  • newbie
Re: The inclusion of code blocks in "packages\package\vehicle\vehicle.js"
« Reply #3 on: March 28, 2015, 06:46:26 pm »

Hmmmmmmmmmmm?

The question?

Not sure what this code is the answer too.......
Logged
Spex: Intel Core i7 6700K @ 4.6GHz / 32.0GB G.SKILL TridentZ Series Dual-Channel Ram / ASUS STRIX GeForce GTX 1080 / Sound Blaster Z / Oculus Rift VR Headset / Klipsch® Promedia 2.1 Computer Speakers / ASUS ROG SWIFT PG279Q ‑ 27" IPS LED Monitor ‑ QHD / 2x Samsung SSD 850 EVO 500GB / Windows 10 Pro

SteelRat

  • Sr. Member
  • ****
  • Posts: 380
  • newbie
Re: The inclusion of code blocks in "packages\package\vehicle\vehicle.js"
« Reply #4 on: March 28, 2015, 07:10:18 pm »

Code: [Select]
/* file: myConstructor\car.js */

var engines = {
engine500Kwt: {
cylinderBlock: {
count: 8.0,
diameter: 0.120,
pistonStroke: 0.130
},
mainGear: 256/24
},
engine750Kwt: {
// ...
},
engine1000Kwt: {
// ...
}
}

var transmissions = {
transmission_1: {
gears: [128/24, 0.0, 128/24, 64/24, 32/24, 24/24], // [R, N, D0,...,Dx]
type: "Avtomatic"
},
transmission_2: {
// ...
},
transmission_3: {
// ...
}
}

Code: [Select]
/*
    objdef: Car_1
    script: Car_1.js
*/

$include("myConstructor/car.js");

function init_vehicle() {
this.engine = engines.engine500Kwt;
this.transmission = transmissions.transmission_1;
// ...
}

Code: [Select]
/*
    objdef: Car_2
    script: Car_2.js
*/

$include("myConstructor/car.js");

function init_vehicle() {
this.engine = engines.engine500Kwt;
this.transmission = transmissions.transmission_1;
// ...
}

Code: [Select]
/*
    objdef: Car_3
    script: Car_3.js
*/

$include("myConstructor/car.js");

function init_vehicle() {
this.engine = engines.engine1000Kwt;
this.transmission = transmissions.transmission_3;
// ...
}

Understand the meaning?
Logged

josem75

  • Sr. Member
  • ****
  • Posts: 286
  • newbie
Re: The inclusion of code blocks in "packages\package\vehicle\vehicle.js"
« Reply #5 on: March 28, 2015, 07:37:14 pm »

U create diferent options for choose one ingame? No idea..
« Last Edit: March 31, 2015, 02:12:51 pm by cameni »
Logged

PytonPago

  • Hero Member
  • *****
  • Posts: 2284
  • It´s way too complex, dont let me try to explain !
Re: The inclusion of code blocks in "packages\package\vehicle\vehicle.js"
« Reply #6 on: March 28, 2015, 11:07:24 pm »

Id say hes trying out multiple-file scripting for vehicles ... its actually a great thing.


If i  get it right those first are defining there are three .js files to be and to be tested potentially (test1-3.js).
(first line just shows what .js file it is) var test = ["test.js"]; defines a file being a variable and test.push("test2-3.js"); as prolongation of variables .... the logic.js is then the main .js file hat has the function set to search for any files included with     test.forEach(function (val, idx) {
        _veh.log_inf("file is included: " + val);
    });   ... on witch OT gives these messages in the error log : 

        INFO: file is included: test.js
        INFO: file is included: test2.js
        INFO: file is included: test3.js   (... you just left it before function update frame to let people know right in script, what kind of messages should be shown in OT later.)

then there you try an analog whyt possible engine-characteristics ... are you trying to make an script for testing out multiple sets of engine propertyes ?  Actually i would be really interested if something like that could be applied specifically to actual style wheel-definitions, cause that could lead to being able to set aether a flat tire, or changing of tire-airpressure (mainly diameter and grip) !!!

Also, additional functionalityes could be keept out of the main script (like gauges animation scripts of the main pannel, functionality stuff to other elements of the car, oppen-able stuff) witch would be great for my ural to keep a variety of scripts inter-vehicle-type usable or at least keep the changes in aditional stuff in a separate file to not mess up some things during theyr tweaking/rewrites ...
« Last Edit: March 28, 2015, 11:10:16 pm by PytonPago »
Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.

SteelRat

  • Sr. Member
  • ****
  • Posts: 380
  • newbie
Re: The inclusion of code blocks in "packages\package\vehicle\vehicle.js"
« Reply #7 on: March 29, 2015, 09:13:47 am »

Thanks for the help PytonPago!

Я хочу верить что не будет нарушением правил если я воспользуюсь при общении с вами языком, которым я владею лучше чем международным.)

Если я правильно понял, у вас есть вопросы. Но транслятор не дал возможности понять более конкретно, что вас интересует. Я с удовольствием отвечу на ваши вопросы.

И у меня к вам просьба, попросите от моего имени администрацию форума создать параллельно этой ветке такую же с префиксом RU.
Это даст возможность мне и другим, таким же как я, более развёрнуто, и более качественно доносить некую информацию сообществу.
А для интересной и полезной темы всегда найдётся хороший человек), который сделает качественный перевод и репост в международную ветку.

Logged

PytonPago

  • Hero Member
  • *****
  • Posts: 2284
  • It´s way too complex, dont let me try to explain !
Re: The inclusion of code blocks in "packages\package\vehicle\vehicle.js"
« Reply #8 on: March 29, 2015, 10:58:23 am »

Я хочу верить что не будет нарушением правил если я воспользуюсь при общении с вами языком, которым я владею лучше чем международным.)

Если я правильно понял, у вас есть вопросы. Но транслятор не дал возможности понять более конкретно, что вас интересует. Я с удовольствием отвечу на ваши вопросы.

И у меня к вам просьба, попросите от моего имени администрацию форума создать параллельно этой ветке такую же с префиксом RU.
Это даст возможность мне и другим, таким же как я, более развёрнуто, и более качественно доносить некую информацию сообществу.
А для интересной и полезной темы всегда найдётся хороший человек), который сделает качественный перевод и репост в международную ветку.


" I hope it wont be a too much problem to use my native language as i dont do good with the multinational.

As i understand, ya have some questions, but the translator didnt really do good ... just ask what ya like.

I have also a little thing to ask , for the administrators, if a topick o the same in RUss, in paralel to this one, could be created so i and my kindsmen could contribute a little more to it. Well, there will be always someone who would be able to translate that one here into ENG. "




---- SteelRat - ill translate it when i find time to do so at each post of you cirilic users ... no problem. As for those questions, they didnt much understand what those scripts were about, but i have done a little explaining in my last post (i hope its correct).
Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.

SteelRat

  • Sr. Member
  • ****
  • Posts: 380
  • newbie
Re: The inclusion of code blocks in "packages\package\vehicle\vehicle.js"
« Reply #9 on: March 29, 2015, 12:30:06 pm »

Я хочу верить что не будет нарушением правил если я воспользуюсь при общении с вами языком, которым я владею лучше чем международным.)

Если я правильно понял, у вас есть вопросы. Но транслятор не дал возможности понять более конкретно, что вас интересует. Я с удовольствием отвечу на ваши вопросы.

И у меня к вам просьба, попросите от моего имени администрацию форума создать параллельно этой ветке такую же с префиксом RU.
Это даст возможность мне и другим, таким же как я, более развёрнуто, и более качественно доносить некую информацию сообществу.
А для интересной и полезной темы всегда найдётся хороший человек), который сделает качественный перевод и репост в международную ветку.


" I hope it wont be a too much problem to use my native language as i dont do good with the multinational.

As i understand, ya have some questions, but the translator didnt really do good ... just ask what ya like.

I have also a little thing to ask , for the administrators, if a topick o the same in RUss, in paralel to this one, could be created so i and my kindsmen could contribute a little more to it. Well, there will be always someone who would be able to translate that one here into ENG. "




---- SteelRat - ill translate it when i find time to do so at each post of you cirilic users ... no problem. As for those questions, they didnt much understand what those scripts were about, but i have done a little explaining in my last post (i hope its correct).

Yes, you correctly translated my idea. Thank you!
Logged

Uriah

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 569
  • We do these things not because they are easy. -JFK
Re: The inclusion of code blocks in "packages\package\vehicle\vehicle.js"
« Reply #10 on: March 31, 2015, 04:28:07 am »

Ah ha! So it is possible to include multiple javascript files! Excellent! I tried and just didn't define the include correctly. Thank you very much!

Regards,
Uriah
Logged

SteelRat

  • Sr. Member
  • ****
  • Posts: 380
  • newbie
Re: The inclusion of code blocks in "packages\package\vehicle\vehicle.js"
« Reply #11 on: March 31, 2015, 09:26:27 am »

Ah ha! So it is possible to include multiple javascript files! Excellent! I tried and just didn't define the include correctly. Thank you very much!

Regards,
Uriah

Это предоставляет широкие возможности скриптинга.
Вы можете иметь одну копию файла с неким кодом, которую можете использовать во многих местах.
Как результат код выглядит не так массивно, легко читаемо, структурировано, то есть легко ориентироваться.
Logged

PytonPago

  • Hero Member
  • *****
  • Posts: 2284
  • It´s way too complex, dont let me try to explain !
Re: The inclusion of code blocks in "packages\package\vehicle\vehicle.js"
« Reply #12 on: March 31, 2015, 12:57:39 pm »

Это предоставляет широкие возможности скриптинга.
Вы можете иметь одну копию файла с неким кодом, которую можете использовать во многих местах.
Как результат код выглядит не так массивно, легко читаемо, структурировано, то есть легко ориентироваться.

"It will broathen the use of scipts.
You can have a copy of a code file, witch can be used at multiple objects. Also, the code wont be so massive, will be more structured and good for orientation"



Logged
We are still undeveloped as long as we don´t realize, that all our science is still descriptive, and than beyond that description lies a whole new world we just haven´t even started to fully understand.

SteelRat

  • Sr. Member
  • ****
  • Posts: 380
  • newbie
Re: The inclusion of code blocks in "packages\package\vehicle\vehicle.js"
« Reply #13 on: January 27, 2016, 10:38:42 am »

Hi cameni!

RU
Я имею пользовательскую папку
D:\Outerra_data\packages\Ptm

Эта папка содержит библиотеку функций и созданных объектов("JScript").
Содержимое этой библиотеки используется для создания конструктора("vehicle.js") в разных пакетах с объектами.

Это разумно, иметь один экземпляр данных, которые используются совместно разными пакетами. Многие объекты имеют общие(одинаковые) свойства и методы.
Так же это упрощает процесс создания логики, и внесение изменений в уже созданную логику. Изменения будут применяться сразу ко всем пакетам использующим данные из библиотеки. Это очень упрощает, и организует работу.

Проблема в реализации этого в том, что метод "$include()" не позволяет обратиться к папке которая размещенна, в иерархии папок, выше.
Я догадываюсь, что вы, скорее всего, имеете свой вид на этот аспект, и в будущем это будет как то реализованно.

Но пока не настало светлое будущее, дайте пожалуйста энтузиасту "SteelRat" возможность навигации по пользовательской папке "D:\Outerra_data\packages" c помощью метода "$include()".

Translate
I have a custom folder
D:\Outerra_data\packages\Ptm

This folder contains a library of functions and objects("JScript") created.
The contents of this library used to create a constructor ("vehicle.js") in different packages with objects.

It is prudent to have one copy of the data that are shared by different packages. Many of the objects have in common (same) properties and methods.
It also simplifies the process of logic, and amendments to the already created logic. The changes will apply to all packages use the data from the library. This greatly simplifies and organizes the work.

The problem of this implementation is that the method of "$include()" does not allow the address to which the layout folder in the folder hierarchy, above.
I guess that you are likely to have your view on this aspect, and in the future it will be as it implemented.

But while it is not bright future, please give the enthusiast "SteelRat" the opportunity to navigate the user folder "D:\Outerra_data\packages" by "$include()".
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: The inclusion of code blocks in "packages\package\vehicle\vehicle.js"
« Reply #14 on: February 01, 2016, 03:22:22 pm »

This will be addressed, but it will be a compromise between the convenience of development and the need to avoid dependency and versioning hell. Basically, $include will allow you to address libs with common functionality outside of the package directory, but model exporter will pack all dependencies into the package so that the model can function in standalone way too.
Logged
Pages: [1] 2