Results 1 to 7 of 7

Thread: Persistent variables

  1. #1
    Potential Tuner
    Join Date
    Apr 2015
    Posts
    6

    Persistent variables

    Are there plans to support persistent variables? I would like to have a static text that shows the max MPH (and many other variables) reached so far. I could define a maxSpeed variable in the background script and then test it and update it in the foreground script but since the background script variables are read-only, that won't work.

    Bob

  2. #2
    HPT Employee Weston@HPTuners's Avatar
    Join Date
    Jul 2014
    Location
    39.735034, -103.894459
    Posts
    868
    That should be a pretty simple thing to add, as an advanced feature. The reason that Enhanced display object variables are currently not persistent from one foreground script run to another is just for consistency... It always starts with whatever values were set by the background script, so that running the foreground script will always result in the same image for its given sample time. That way, weird things don't happen when you seek back and forth, but that should mostly be a non-issue when watching continuous playback or creating an output video.

    I'll look at adding a checkbox for this option in the upcoming RaceRender 3.1.6 release...

  3. #3
    Potential Tuner
    Join Date
    Apr 2015
    Posts
    6
    Quote Originally Posted by Weston@HPTuners View Post
    That should be a pretty simple thing to add, as an advanced feature. The reason that Enhanced display object variables are currently not persistent from one foreground script run to another is just for consistency... It always starts with whatever values were set by the background script, so that running the foreground script will always result in the same image for its given sample time. That way, weird things don't happen when you seek back and forth, but that should mostly be a non-issue when watching continuous playback or creating an output video.

    I'll look at adding a checkbox for this option in the upcoming RaceRender 3.1.6 release...
    Great! So a checkbox will cause all variables to be read-write rather than read-only?

    Or something like a volatile keyword when defining a variable would work well.

    if you set this in the background script:

    volatile maxSpeed=0;

    It can indicate that the variable can be updated in the foreground script.

    Either way it will be great for the script to remember it's state.

    Bob

  4. #4
    HPT Employee Weston@HPTuners's Avatar
    Join Date
    Jul 2014
    Location
    39.735034, -103.894459
    Posts
    868
    Correct, there will be a checkbox that will enable all variables to be read-write from either script. With the way this stuff works, these would automatically be reset any time that the background image is regenerated, which typically happens when you edit the display object. There will also be a reset if the frame being generated is for a time that is earlier than the previous frame, so that will keep things reasonably sane when you seek the preview backwards, or when you start creating a video output file.

    The main catch with this feature is that the preview for it may be somewhat less precise... The foreground script is run at an interval matching the current frame rate, and the data value is interpolated based on the current frame time, so output video files should hold a nice and consistent rate, but the preview playback could have some variance in it.

  5. #5
    Potential Tuner
    Join Date
    Apr 2015
    Posts
    6
    Holy crap that was fast. When you said 'upcoming release' I didn't it expect within the week!

    This is freakin' great! It took me all of 15 minutes to create a persistent G force text.

    Now that you have persistent variables, would you be able to expose the scripts for the built-in objects so they can be modified? I'd love to be able to put a static needle that shows highest speed or rpm on a speedometer or tach or modify the bar graphs to show the highest/lowest value bar.

    I tell you, this can be a serious game changer.

    I see you have functions such as 'GetCurLapNum' and the like. It would be amazing to have functions such as 'GetMetric('<metric>'). This way, in a script you can have a multi function object (similar to the lap times enhanced object) that shows the max speed, min accel X, max accel y, etc by doing queries like

    if getMetric('speed') > maxSpeed then drawNumber(maxSpeed......)
    if getMetric('accel X') > maxAccelX then drawNumber(maxAccelX.....)

    Is there a forum for user enhanced objects? I'd love to see what other people have come up with.

    Keep up the good work, your software is amazing!

    Bob

  6. #6
    HPT Employee Weston@HPTuners's Avatar
    Join Date
    Jul 2014
    Location
    39.735034, -103.894459
    Posts
    868
    The other built-in display objects are generated using a different approach, so there are not any underlying scripts in this sense. That allows for much more custom-tailored configuration interfaces, as well as faster and more efficient rendering, but it does require more development time to add or change features. As things continue to move forward, I do expect to gradually see more bridging of the gap between the two, so that we can really open up the options of what's possible even more...

    Is there a forum for user enhanced objects? I'd love to see what other people have come up with.
    We've recently moved over to this forum and don't have a specific place for sharing user-created objects at this time.

  7. #7
    Potential Tuner
    Join Date
    Apr 2015
    Posts
    6
    Quote Originally Posted by Weston@HPTuners View Post
    We've recently moved over to this forum and don't have a specific place for sharing user-created objects at this time.
    I'll keep an eye for it when you do. I have a 'MIN TEXT' object, a 'MAX TEXT' object and a 'MIN/MAX TEXT BOX'. I've also modified the slope speed to show a bar at the max speed along with the max speed number.


    enhanced_obj.png