1. Do you love cycling and/or running?
    Join the RaceDepartment community on Strava here.

Onyx Scripting Problems

Discussion in 'Racer Problems & Fixes' started by srtech, Apr 10, 2013.

  1. srtech


    I'm having trouble getting Onyx scripts to run within racer. Even the example hello world script found here:

    doesn't seem to execute or output anything when I call:
    run hello.oxs
    from the in game console.

    I can see in the debug log, that the script is found and being compiled, but I'm not getting output in the console.

    My ultimate goal is to be able to get telemetry data out over UDP, kinda like in the telemetry_to_udp.oxs file in the onyx examples directory, but figured I should be able to get hello world working first.

    Any suggestions or pointers on what could be going wrong? I'm running racer v 0.9rc5 on Windows8.


  2. boomer541


    If I remember correctly you have to put in the car or track "load oxs" or something like that.
    I found that onyx does have some bugs and is not fully implemented.
    Haven't tried using it for a while now, waiting for Ruud to fully implement.
  3. Mr Whippy

    Mr Whippy

    Yeah I think Onyx right now is still in an unfinished state. It's a novelty and a good indicator of what will eventually come but I wouldn't try lean on it to do something specific yet.

    However, I'm sure Racer currently has built in logging for many variables without using Onyx, so you could possibly use those?

    In Racer.ini check:


    And also see the other areas you can turn on under that log tree.


    suspension lengths and arb forces
    slip angles per wheel
    slip ratio per wheel
    tyre forces per wheel
    steering data
    throttle,brake and clutch
    yaw, pitch and roll
    velocity of car in world coords
    angular velocity of car
    linear accelerations of car
    engine rpm
    car position in world coords

    So not an exhaustive list of variables vs what you can do, but even Onyx in it's current state doesn't expose all the things you might want to see. Ie, I don't think there is any access to the aero readouts via Onyx right now, you'd have to calculate them out from known car.ini values and the car speed and pitch etc... not so elegant really :(

    It'll be good when Ruud finally finishes Onyx and exposes everything properly and we can finally unleash the power of Onyx and Racer...
    Both reading parameters AND editing them in real time will enable some very nice scripts. Hopefully Ruud will add some 3D LUTs too, so we can 'map' parameters elegantly.

    Ruud, it's over to you :D :D

  4. srtech


    Thanks for the info.

    Dave: I was thinking of using the log file as well, however I need to get at the data in real time (I'm trying to feed it into a computerized dashboard we're building as a school project). Playing with it, it appears that the data doesn't get written to the log file until after the race is finished. I tried to crank down the buffer size, but it won't even let me "tail" the file as the race is going.

  5. camsinny


    I played around with this not long ago. See below:

    rcar $car = get scriptowner car
    float $speed
    while 1
    $speed = get $car tachovelocity
    qdbg "Speed=" + $speed
    Not using onyx, but using qscript. reads out the speed.

    I think i tried using the system/variables but didn't really work - or that might be utilising it...I don't really know; it was a quick test. You should be able to modify it to your liking. Just make sure you enable the UDP out thing and it'll spit it out every physics tick IIRC (as long as it's in the physics folder.)
  6. Mr Whippy

    Mr Whippy

    Hehe, you get half the stuff you want in Onyx, then qscript does the other half... :D

    If you can get a blend of the two working then that will be nice. I'm sure you can call the Onyx system variables into qscript so maybe you can get those variables too.

    I'd just pester Ruud to finish Onyx... it seems generally finished really, I'm sure it's more on the home straight than anything else.

  7. Ruud

    RACER Developer

    Onyx is one of those things which is never entirely finished, even though the syntax evolves only slowly. It is more what you can *do* with Onyx that makes up the cake.

    Steven, did you try this in Racer v0.9.0RC6 (or RC7)? One thing I noted is that the tutorial didn't say the .oxs file should go into data/scripts/onyx.