GT6N-OpenSource-Skripte
-
-
Nööö, das ist mehr ein Zufall...
Ab dem nächsten Patch werden die Scripts im OpenSource-Ordner aktuell gehalten!
-
I began to study the script and began to look at how everything was done in the GT6N and there were questions.
1) What are files like StdElements.pas and TechElements.pas for?
2) What is ZStellungFederkonst and ZStellungDamping?
3) What is under the red inscription signs? What is there to describe?
https://pp.userapi.com/c846221…73/15f219/Zn3sBo_sxwU.jpg -
1) will be answered very quickly. These scripts contain the various elements you need, such as buttons, levers, etc., so you don't have to write that code in your own script.
2) I'm not sure myself right now
3) If you mean this "{$I StdElements.pas}", that command is similar to a include command which is used in C or Basic
-
3) I just did not understand what it signs. But it seems to be about the work of section C, then about the couplers and at the very end about the animation of the vents and IBIS. I understood correctly?
-
I believe, 2) is about this: https://www.facebook.com/LOTUS…420783965/?type=3&theater
However, as it's all commented out, the ZStellung constants and variables don't actually do anything.
-
To describe it roughly, the {$I ***.pas} command imports another script so that you can use a variable from the other script in the current script.
For example, TechElements includes many buttons, switches, relais, levers, sliders and so on. Now, if you want to implement a switch in your script, you import the functions of TechElements with "{$ I TechElements.pas}". Then you can then use "TSwitch" or "TStepSwitch" to script the switch.
-
2) That is, I do not need to describe there that I have a single-section car and how should it behave?3
I just realized that there is described the behavior of the sections.
3) And yes, but what should I write after the lines where it is written in red?
Kira, I understood that. I ask what to write, where it starts like this:Code- const
- ZStellungFederkonst = 3;
- ZStellungDamping = 2;
- KUPPLUNGSSPEED = 1;
- var
- ZStellungsV_C: single;
- Coupling_A_target: boolean;
- Coupling_B_target: boolean;
- NOT_FIRST_RUN: boolean;
- prev_standlicht: single;
- procedure Schienensounds;
- begin
- if (railquality_0_0 > 0) then
- begin
- Snd_Rumpeln_Weiche1 := 1
- end
- else
- Snd_Rumpeln_Weiche1 := 0;
- Snd_Rumpeln_Pitch := 0.9 + v_Axle_mps_0_0 / 18;
- end;
- procedure ZStellung;
- var
- z_target_c: single;
- z_feder: single;
- drehSpeed: single;
- begin
- {
- z_target_c := ZStellung_A + ZStellung_B;
- z_feder := z_target_c - ZStellung_C;
- drehSpeed := -invradius_1_0 * v_Axle_mps_1_0;
- ZStellungsV_C := ZStellungsV_C - drehSpeed;
- ZStellungsV_C := ZStellungsV_C + z_feder * ZStellungFederkonst * timegap;
- ExponentialApproach(ZStellungsV_C, ZStellungDamping, 0);
- ZStellungsV_C := ZStellungsV_C + drehSpeed;
- ZStellung_C := ZStellung_C + ZStellungsV_C * timegap;
- }
- ZStellung_C := ZStellung_C + 0.1*(ZStellung_A + ZStellung_B - ZStellung_C);
- //ZStellung_C := ZStellung_C + invradius_1_0 * timegap * v_Axle_mps_1_0;
- end;
- procedure Couplings_SimStep;
- begin
- if coupled_0 and (CouplingState_0 = 2) then
- begin
- Coupling_A_E_open := 1;
- Coupling_A_target := false;
- Coupling_A_hingeA := 0;
- Coupling_A_hingeB := 0;
- end
- else
- Coupling_A_E_open := 0;
- if coupled_1 and (CouplingState_1 = 2) then
- begin
- Coupling_B_E_open := 1;
- Coupling_B_target := false;
- Coupling_B_hingeA := 0;
- Coupling_B_hingeB := 0;
- end
- else
- Coupling_B_E_open := 0;
- if Coupling_A_target then
- begin
- CouplingState_0 := 0;
- if Coupling_A_hingeA < 1 then
- begin
- Coupling_A_hingeA := Coupling_A_hingeA + KUPPLUNGSSPEED * Timegap;
- Coupling_A_hingeB := 0;
- end
- else if Coupling_A_hingeB < 1 then
- begin
- Coupling_A_hingeA := 1;
- Coupling_A_hingeB := Coupling_A_hingeB + KUPPLUNGSSPEED * Timegap;
- end
- else
- begin
- Coupling_A_hingeA := 1;
- Coupling_A_hingeB := 1;
- Coupling_A_vis := false;
- Coupling_A_casecap := true;
- couplingOffsetY_0 := -0.59;
- end;
- end
- else
- begin
- Coupling_A_vis := true;
- Coupling_A_casecap := false;
- couplingOffsetY_0 := 0;
- if Coupling_A_hingeB > 0 then
- begin
- Coupling_A_hingeA := 1;
- Coupling_A_hingeB := Coupling_A_hingeB - KUPPLUNGSSPEED * Timegap;
- end
- else if Coupling_A_hingeA > 0 then
- begin
- Coupling_A_hingeA := Coupling_A_hingeA - KUPPLUNGSSPEED * Timegap;
- Coupling_A_hingeB := 0;
- end
- else
- begin
- Coupling_A_hingeA := 0;
- Coupling_A_hingeB := 0;
- if CouplingState_0 = 0 then
- CouplingState_0 := 1;
- end;
- end;
- if Coupling_B_target then
- begin
- CouplingState_1 := 0;
- if Coupling_B_hingeA < 1 then
- begin
- Coupling_B_hingeA := Coupling_B_hingeA + KUPPLUNGSSPEED * Timegap;
- Coupling_B_hingeB := 0;
- end
- else if Coupling_B_hingeB < 1 then
- begin
- Coupling_B_hingeA := 1;
- Coupling_B_hingeB := Coupling_B_hingeB + KUPPLUNGSSPEED * Timegap;
- end
- else
- begin
- Coupling_B_hingeA := 1;
- Coupling_B_hingeB := 1;
- Coupling_B_vis := false;
- Coupling_B_casecap := true;
- couplingOffsetY_1 := 0.59;
- end;
- end
- else
- begin
- Coupling_B_vis := true;
- Coupling_B_casecap := false;
- couplingOffsetY_1 := 0;
- if Coupling_B_hingeB > 0 then
- begin
- Coupling_B_hingeA := 1;
- Coupling_B_hingeB := Coupling_B_hingeB - KUPPLUNGSSPEED * Timegap;
- end
- else if Coupling_B_hingeA > 0 then
- begin
- Coupling_B_hingeA := Coupling_B_hingeA - KUPPLUNGSSPEED * Timegap;
- Coupling_B_hingeB := 0;
- end
- else
- begin
- Coupling_B_hingeA := 0;
- Coupling_B_hingeB := 0;
- if CouplingState_1 = 0 then
- CouplingState_1 := 1;
- end;
- end;
- end;
- procedure SimStep;
- begin
- //if not NOT_FIRST_RUN then
- //begin
- // AllCockpits_FirstRun;
- // NOT_FIRST_RUN := true;
- // end;
- AllCockpits_SimStep;
- PowerSupply_SimStep;
- Lights_SimStep;
- Doors_SimStep;
- AllTractionAndBrakeUnits_SimStep;
- Couplings_SimStep;
- M_Axle_N_0_1 := TractionAndBrakeUnitA.CurrTractionForce;
- M_Axle_N_1_1 := TractionAndBrakeUnitB.CurrTractionForce;
- M_Axle_N_2_0 := TractionAndBrakeUnitC.CurrTractionForce;
- MBrake_Axle_N_0_1 := TractionAndBrakeUnitA.CurrBrakeForce;
- MBrake_Axle_N_1_1 := TractionAndBrakeUnitB.CurrBrakeForce;
- MBrake_Axle_N_2_1 := TractionAndBrakeUnitC.CurrBrakeForce;
- Schienensounds;
- ZStellung;
- v_Axle_mps_0_0_abs := abs(v_Axle_mps_0_0);
- v_Axle_mps_0_1_abs := abs(v_Axle_mps_0_1);
- if abs(Standlicht - prev_standlicht) > 0.1 then
- begin
- SendMessageToChildSingle(Self, 1, 'LIGHT', Standlicht);
- SendMessageToChildSingle(Self, 2, 'LIGHT', Standlicht);
- SendMessageToChildSingle(Self, 3, 'LIGHT', Standlicht);
- SendMessageToChildSingle(Self, 4, 'LIGHT', Standlicht);
- SendMessageToChildSingle(Self, 5, 'LIGHT', Standlicht);
- SendMessageToChildSingle(Self, 6, 'LIGHT', Standlicht);
- prev_standlicht := Standlicht;
- end;
- end;
- procedure Initialize;
- begin
- PowerSupply_Initialize;
- Lights_Initialize;
- Doors_Initialize;
- AllTractionAndBrakeUnits_Initialize;
- AllCockpits_Initialize;
- Coupling_A_vis := false;
- Coupling_A_casecap := true;
- couplingOffsetY_0 := -0.59;
- Coupling_B_vis := false;
- Coupling_B_casecap := true;
- couplingOffsetY_1 := -0.59;
- Coupling_A_target := true;
- Coupling_B_target := true;
- AllCockpits_FirstRun;
- prev_standlicht := -1;
- //TestFunc := LinFuncNew;
- //LinFuncAddPair(TestFunc, 2, 6);
- //LinFuncAddPair(TestFunc, 6, 5);
- //LinFuncAddPair(TestFunc, 7, 8);
- //LinFuncAddPair(TestFunc, 8, 2);
- end;
- function WindowOpenClose(windowvariable: single; acb: byte): single;
- begin
- result := 1 - windowvariable;
- if (result > 0.5) then
- case acb of
- 0: Snd_A_WindowOpen := 1;
- 1: Snd_C_WindowOpen := 1;
- 2: Snd_B_WindowOpen := 1;
- end
- else
- case acb of
- 0: Snd_A_WindowClose := 1;
- 1: Snd_C_WindowClose := 1;
- 2: Snd_B_WindowClose := 1;
- end;
- end;
- procedure Windows_OnButton(id: string; value: boolean);
- begin
- if value then
- begin
- if id = 'A_OpenWindow_L1' then A_OpenWindow_L1 := WindowOpenClose(A_OpenWindow_L1, 0)
- else if id = 'A_OpenWindow_L2' then A_OpenWindow_L2 := WindowOpenClose(A_OpenWindow_L2, 0)
- else if id = 'A_OpenWindow_L3' then A_OpenWindow_L3 := WindowOpenClose(A_OpenWindow_L3, 0)
- else if id = 'A_OpenWindow_R1' then A_OpenWindow_R1 := WindowOpenClose(A_OpenWindow_R1, 0)
- else if id = 'A_OpenWindow_R2' then A_OpenWindow_R2 := WindowOpenClose(A_OpenWindow_R2, 0)
- end;
- end;
- procedure OnButton(id: string; value: boolean; cockpitIndex: integer);
- begin
- AllCockpits_OnButton(id, value, cockpitIndex);
- Kss_OnButton(id, value);
- Doors_OnButton(id, value);
- Windows_OnButton(id, value);
- if (id = 'CouplingAVisToggle') and value then
- begin
- if (CouplingState_0 = 2) then
- CouplingState_0 := 1
- else
- Coupling_A_target := not Coupling_A_target;
- end
- else if (id = 'CouplingBVisToggle') and value then
- begin
- if (CouplingState_1 = 2) then
- CouplingState_1 := 1
- else
- Coupling_B_target := not Coupling_B_target;
- end
- end;
- procedure OnFloatInput(id: string; value: single; cockpitIndex: integer);
- var
- bla1: single;
- bla2: string;
- begin
- AllCockpits_OnFloatInput(id, value, cockpitIndex);
- end;
- procedure ReceiveMessageFromChildInteger(slotindex: integer; id: string; value: integer);
- begin
- if id = 'PIS_TERMINUS_LISTINDEX' then
- SendMessageToChildInteger(Self, 1, 'PIS_TERMINUS_LISTINDEX', value)
- else if id = 'PIS_LINE' then
- SendMessageToChildInteger(Self, 1, 'PIS_LINE', value)
- else if id = 'PIS_SPECIALCHAR' then
- SendMessageToChildInteger(Self, 1, 'PIS_SPECIALCHAR', value)
- else if id = 'PIS_TERMINUS_SLAVE_TEX_ID' then
- begin
- SendMessageToChildInteger(Self, 2, 'PIS_TERMINUS_SLAVE_TEX_ID', value);
- SendMessageToChildInteger(Self, 3, 'PIS_TERMINUS_SLAVE_TEX_ID', value);
- SendMessageToChildInteger(Self, 4, 'PIS_TERMINUS_SLAVE_TEX_ID', value);
- SendMessageToChildInteger(Self, 5, 'PIS_TERMINUS_SLAVE_TEX_ID', value);
- SendMessageToChildInteger(Self, 6, 'PIS_TERMINUS_SLAVE_TEX_ID', value);
- end;
- end;
-
Kira, I understood that. I ask what to write, where it starts like this:
ok, I've probably completely misunderstood sorry for that
I think that 2) has something to do with the coupling, but as I said, I'm not so sure, so I'd rather be quiet. Maybe Julian or Marcel Kuhnt could say something more specific?
I am also sure that your third question will be answered automatically as soon as it is clear what these values will do.
-
If you have a single section car, you don't need the ZStellung mechanism. You can delete everything related to that. The animation of your car will be performed by LOTUS based on how you set up the animation in the Content Tool. See https://www.lotus-simulator.de…creating-bogies-and-cars/ .
-
Neu erstellte Beiträge unterliegen der Moderation und werden erst sichtbar, wenn sie durch einen Moderator geprüft und freigeschaltet wurden.
Die letzte Antwort auf dieses Thema liegt mehr als 60 Tage zurück. Das Thema ist womöglich bereits veraltet. Bitte erstellen Sie ggf. ein neues Thema.