Results 1 to 3 of 3

Thread: Need Chr() function in in Enhanced object scripts

  1. #1
    Potential Tuner
    Join Date
    Jul 2018
    Posts
    7

    Need Chr() function in in Enhanced object scripts

    Hi Racerender Dev team

    Is it at all possible to have a Chr() function available to convert Ascii code to text.
    I understand your challenges around enabling the ability to pass text rather than numbers in the data file. Currently I am successfully displaying some code words on screen, by passing a number in the data file, and then using an if/else statement converting that number to the appropriate text string. However that will only work with a limited subset of possible text strings. For this bit I only have about 20 possible strings so that makes a 20 deep if/else statement. This obviously comes with some overhead in processing time. To improve this I have set a persistent variable, and only process the if/else when the string needs to change from the previous frame.

    But for the next bit of my project I desperately need the ability to display much longer strings, as I require road names to be displayed on screen. If I was able to build up a very long number where every set of 2 digits is an ascii code, I could then decode this in the Advanced function script, by breaking the number into 2 character chunks, and use the Chr() function to build up a string.

    Admittedly breaking a large number into chunks is currently possible but a bit cumbersome, so any function you could provide to ease that would also be helpful. At the moment I have achieved it with something like below to convert a 4 digit number with 2 decimals. (1156.11 or 2055.12))

    nType = floor(DataValue/1000) #extract the thousands number
    nFeature = trunc(DataValue - nType*1000) #extract the 100s
    nExtention = trunc((DataValue-nFeature-(nType*1000))*10) #extract the 1st decimal number
    nExtention1 = (DataValue-nFeature-(nType*1000))*100 - (nExtention * 10) #extract the second decimal number

    Then with a if/else I build that back into a string.
    If nType is 1 then "BR", elseif nType is 2, "Tun"
    add the nFeature as a 3 char string,
    If nExtention is 1 then "A", elseif nExtention is 2, "B"
    If nExtention1 is 1 then "A", elseif nExtention1 is 2, "B"

    that allows me to display a variety of "Tun156AA" or "Br055AB" etc

    Any help you could offer would be much appreciated.

  2. #2
    HPT Employee Weston@HPTuners's Avatar
    Join Date
    Jul 2014
    Location
    39.735034, -103.894459
    Posts
    868
    Yes, we will have chr() and asc() functions available in our upcoming RaceRender 3.6.6 release. There are still a few other tasks left to do, but I'm hoping to have that released by the end of this month...

  3. #3
    Potential Tuner
    Join Date
    Jul 2018
    Posts
    7
    Awesome. thanks.
    One other addition that would be very handy. Currently you can mute an individual video in its settings screen, however there does not appear to be an option to mute all videos. Most of my projects comprise of 20+ individual GoPro videos, and it is very slow to have to go into each ones settings to mute. Could we have an option on the "Create Video" settings screen to mute all.

    thanks