2019-03-20 snapshot (Updated)

Post anything about MX Simulator here. Please. I'm begging you.
User avatar
aeffertz
Posts: 3387
Joined: Sat Sep 06, 2014 7:01 am
Team: W.B.G
Location: Wiscansin

Re: 2019-03-20 snapshot (Updated)

Postby aeffertz » Thu Apr 11, 2019 2:18 am

jlv wrote:Changes:
  • Time reported to scripts is now adjusted for interpolation delay when spectating online.


Can this be adjusted at all? Still seems to be a second off.
Image

jlv
Site Admin
Posts: 13304
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: 2019-03-20 snapshot (Updated)

Postby jlv » Thu Apr 11, 2019 2:32 am

aeffertz wrote:
jlv wrote:Changes:
  • Time reported to scripts is now adjusted for interpolation delay when spectating online.


Can this be adjusted at all? Still seems to be a second off.

The gate drop or something else? It still does report the running order early. The times are correct but they'll arrive early.
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.

User avatar
aeffertz
Posts: 3387
Joined: Sat Sep 06, 2014 7:01 am
Team: W.B.G
Location: Wiscansin

Re: 2019-03-20 snapshot (Updated)

Postby aeffertz » Thu Apr 11, 2019 2:43 am

jlv wrote:
aeffertz wrote:
jlv wrote:Changes:
  • Time reported to scripts is now adjusted for interpolation delay when spectating online.


Can this be adjusted at all? Still seems to be a second off.

The gate drop or something else? It still does report the running order early. The times are correct but they'll arrive early.


Yeah, the gate drop sound is still ~ a second early.
Image

jlv
Site Admin
Posts: 13304
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: 2019-03-20 snapshot (Updated)

Postby jlv » Thu Apr 11, 2019 3:06 am

aeffertz wrote:Yeah, the gate drop sound is still ~ a second early.

Are you sure you're checking the time returned correctly? "mx.get_gate_drop_time" will return -1 until the time passes the gate drop time and return the gate drop time after that. With the time adjusted, it will stop returning -1 a second early relative to the adjusted time but the returned time should still be correct. So if you just check for -1 it won't work. You have to check that the value is positive, meaning it's valid, and that the current (adjusted) time is after the drop time. Something like this:

Code: Select all

/*
################################################################################
## Call g_gate_drop_handler on gate drop.
##
################################################################################
*/

var g_gate_drop_handler = function () { };

var g_gate_position_down = -1;
var g_gate_position_unknown = 0;
var g_gate_position_up = 1;

var g_gate_position = g_gate_position_unknown;

function gate_drop_frame_handler(seconds) {
        var gdt;

        gate_drop_frame_handler_prev(seconds);

        gdt = mx.get_gate_drop_time();

        if (gdt >= 0 && seconds > gdt) {
                if (g_gate_position == g_gate_position_up)
                        g_gate_drop_handler();
                g_gate_position = g_gate_position_down;
        } else
                g_gate_position = g_gate_position_up;
}

var gate_drop_frame_handler_prev = mx.frame_handler;
mx.frame_handler = gate_drop_frame_handler;

# Test handler
g_gate_drop_handler = function () { mx.message("Go!"); };
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.

User avatar
aeffertz
Posts: 3387
Joined: Sat Sep 06, 2014 7:01 am
Team: W.B.G
Location: Wiscansin

Re: 2019-03-20 snapshot (Updated)

Postby aeffertz » Thu Apr 11, 2019 3:11 am

Ahh, okay. Yeah, right now it's just checking for once it's greater than 0. I'll change that.
Image


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests