Anzahl der Beiträge : 413 Anmeldedatum : 10.09.09 Alter : 39 Ort : Philadelphia PA
Thema: 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?
Rüdiger Hülsmann Admin
Anzahl der Beiträge : 1204 Anmeldedatum : 25.04.09 Alter : 40 Ort : Potsdam-West, Berlin-Mariendorf
Thema: 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}
krtz07
Anzahl der Beiträge : 413 Anmeldedatum : 10.09.09 Alter : 39 Ort : Philadelphia PA
Thema: 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
Rüdiger Hülsmann Admin
Anzahl der Beiträge : 1204 Anmeldedatum : 25.04.09 Alter : 40 Ort : Potsdam-West, Berlin-Mariendorf
Thema: 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)
krtz07
Anzahl der Beiträge : 413 Anmeldedatum : 10.09.09 Alter : 39 Ort : Philadelphia PA
Thema: 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}
That actually works provided that the governor is defined in the consist file
I guess I can somehow rework that into the kneeling script?
krtz07
Anzahl der Beiträge : 413 Anmeldedatum : 10.09.09 Alter : 39 Ort : Philadelphia PA
Thema: 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
krtz07
Anzahl der Beiträge : 413 Anmeldedatum : 10.09.09 Alter : 39 Ort : Philadelphia PA
Thema: 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