ehem. OMSI - Forum

Dieses Forum wurde geschlossen. Das neue Forum befindet sich auf www.omnibussimulator.de/forum !
 
StartseiteStartseite  FAQFAQ  SuchenSuchen  MitgliederMitglieder  NutzergruppenNutzergruppen  AnmeldenAnmelden  LoginLogin  

Teilen | 
 

 The purpose of Timegap or Time delay funcations

Nach unten 
AutorNachricht
krtz07



Anzahl der Beiträge : 413
Anmeldedatum : 10.09.09
Alter : 33
Ort : Philadelphia PA

BeitragThema: The purpose of Timegap or Time delay funcations   Fr 8 Apr - 13:14

I know that there will be a script SDK that is in the works, but how exactly does one implement a timegap on an object or varible to give it a 4 second delay in while in act of moving the desired direction assigned to via trigger. How exactly does (L.S.timegap) works, or is there any function that delays the transition of an object?
Nach oben Nach unten
Benutzerprofil anzeigen http://www.philadelphiatransitvehicles.info
Rüdiger Hülsmann
Admin
avatar

Anzahl der Beiträge : 1204
Anmeldedatum : 25.04.09
Alter : 34
Ort : Potsdam-West, Berlin-Mariendorf

BeitragThema: Re: The purpose of Timegap or Time delay funcations   Fr 8 Apr - 14:10

(L.S.timegap) hands back the time [in s] passed between the last and the current frame. So you'll need to add the timegap to a delay variable in each frame like this:

(L.L.delay_variable) (L.L.target_delay) <
{if}
(L.L.delay_variable) (L.S.timegap) + (S.L.delay_variable)
{else}
perform the desired action after having waited for [target_delay] seconds.
{endif}
Nach oben Nach unten
Benutzerprofil anzeigen
krtz07



Anzahl der Beiträge : 413
Anmeldedatum : 10.09.09
Alter : 33
Ort : Philadelphia PA

BeitragThema: Re: The purpose of Timegap or Time delay funcations   Mi 13 Apr - 4:46

This is where I am at still no luck, just trying to reduce the rate of suspension down, but slow it down by a few seconds.. It is apart of Marpe's code, any help towards the right direction would be extremely greatful. Want the springfactor to go from 1 down to 0.6 in 5 seconds or anything defined...

Code:
1 (L.S.Timegap) 10 * + 0.6 min (S.L.Axle_Springfactor_0_R)

I know this does not work, but thought the correct code has to be somewhere close to it
Nach oben Nach unten
Benutzerprofil anzeigen http://www.philadelphiatransitvehicles.info
Rüdiger Hülsmann
Admin
avatar

Anzahl der Beiträge : 1204
Anmeldedatum : 25.04.09
Alter : 34
Ort : Potsdam-West, Berlin-Mariendorf

BeitragThema: Re: The purpose of Timegap or Time delay funcations   Mi 13 Apr - 11:27

No. As "timegap" only hands back the short time period between two frames, you'll need to cumulate the time in a certain way.

For example like this:
(L.L.Axle_Springfactor_0_R) (L.S.Timegap) 0.2 * + 0.6 min (S.L.Axle_Springfactor_0_R)

"Take the springfactor, add 0.2*Timegap, use the minimum between the current result and 0.6 and save it again as springfactor."
This will add a small portion of spring strength in each frame until the maximum value 0.6 is reached.

Whether the timegap value is added or subtracted must be controlled by an {if} switch, depending on the state of the bustop brake (on = lower, off = raise the bus)
Nach oben Nach unten
Benutzerprofil anzeigen
krtz07



Anzahl der Beiträge : 413
Anmeldedatum : 10.09.09
Alter : 33
Ort : Philadelphia PA

BeitragThema: Re: The purpose of Timegap or Time delay funcations   Fr 15 Apr - 4:29

Ok on some other project, i did work some magic with your first example,

Very early example of a speed governor -
{macro:speed_governer}

(L.L.Velocity) 64 >= (L.L.throttle) 0.01 >= &&
{if}
(L.L.engine_throttle_injection)
{if}

(L.L.Velocity) (F.L.governor) (S.L.engine_throttle_injection)

{endif}
{endif}




{end}


That actually works provided that the governor is defined in the consist file

I guess I can somehow rework that into the kneeling script?
Nach oben Nach unten
Benutzerprofil anzeigen http://www.philadelphiatransitvehicles.info
krtz07



Anzahl der Beiträge : 413
Anmeldedatum : 10.09.09
Alter : 33
Ort : Philadelphia PA

BeitragThema: Re: The purpose of Timegap or Time delay funcations   Di 7 Jun - 23:07

Rüdiger Hülsmann schrieb:
(L.S.timegap) hands back the time [in s] passed between the last and the current frame. So you'll need to add the timegap to a delay variable in each frame like this:

(L.L.delay_variable) (L.L.target_delay) <
{if}
(L.L.delay_variable) (L.S.timegap) + (S.L.delay_variable)
{else}
perform the desired action after having waited for [target_delay] seconds.
{endif}
I have another question, how exactly would I hold an gear in omsi for an x amount of seconds when it surpasses the set shift points. II have a form of kickdown in place on my transmission, but the way it currently works is I tell OMSI to limit upshift values to an XXXX drive axle rpm, then have another script that if the "kick-down" is enabled goven to the conditions which I have given the script it will be over the range. During the prior gear, it will stay into that gear until it reaches the max rpm. What I would want to do is create a new variable so that when transmission downshift above the specified range of the prior gear, it will hold the gear for an X amount of seconds. So basically I would like to add a new variable on the shift down script such as "hold_gear" set that equal to one. Then after XX amount of seconds pass, it will revert back to 0 again enabling the shifting.

thank you if you can help.. timegap is extremely differcult to figure out
Nach oben Nach unten
Benutzerprofil anzeigen http://www.philadelphiatransitvehicles.info
krtz07



Anzahl der Beiträge : 413
Anmeldedatum : 10.09.09
Alter : 33
Ort : Philadelphia PA

BeitragThema: Re: The purpose of Timegap or Time delay funcations   So 12 Jun - 21:43

Rüdiger Hülsmann schrieb:
(L.S.timegap) hands back the time [in s] passed between the last and the current frame. So you'll need to add the timegap to a delay variable in each frame like this:

(L.L.delay_variable) (L.L.target_delay) <
{if}
(L.L.delay_variable) (L.S.timegap) + (S.L.delay_variable)
{else}
perform the desired action after having waited for [target_delay] seconds.
{endif}

took me a while to figure out how exactly that works, but got something up!


Doing a mod like my transmission mod, really opens your mind to the whole scripting!! But now in my calculus class, I am writting some problems in reverse notation though
Shocked Shocked

Here's the result:

Code:

{macro:bremse_levelcontrol}

1 (S.L.Axle_Springfactor_0_L) (S.L.Axle_Springfactor_1_L)
(L.L.bremse_halte)
{if}
  (L.L.Axle_Springfactor_0_R) (L.S.Timegap) 0.15 * - 0.6 max (S.L.Axle_Springfactor_0_R)
  (L.L.Axle_Springfactor_0_R) 0.6 =
  {if}
  (L.L.Axle_Springfactor_1_R) (L.S.Timegap) 0.15 * - 0.6 max (S.L.Axle_Springfactor_1_R)
  {endif}
  {else}
  (L.L.Axle_Springfactor_1_R) (L.S.Timegap) 0.15 * + 1 min (S.L.Axle_Springfactor_1_R)

  (L.L.Axle_Springfactor_0_R) 1 =
  {if}
  (L.L.Axle_Springfactor_1_R) (L.S.Timegap) 0.15 * + 1 min (S.L.Axle_Springfactor_1_R)
  {endif}

{endif}


{end}

ofcourse it is not the final result, could make it so that if this mode is enabled, that level control is disabled during the time.
Nach oben Nach unten
Benutzerprofil anzeigen http://www.philadelphiatransitvehicles.info
Gesponserte Inhalte




BeitragThema: Re: The purpose of Timegap or Time delay funcations   

Nach oben Nach unten
 
The purpose of Timegap or Time delay funcations
Nach oben 
Seite 1 von 1

Befugnisse in diesem ForumSie können in diesem Forum nicht antworten
ehem. OMSI - Forum :: OMSI-Design (english) :: Script programming-
Gehe zu: