mxserver-2018-06-30-1412

Post anything about MX Simulator here. Please. I'm begging you.
User avatar
Wahlamt
Posts: 7033
Joined: Mon Sep 13, 2010 3:15 pm
Team: MLG Compton
Location: Sweden
Contact:

Re: mxserver-2018-06-30-1412

Postby Wahlamt » Tue Feb 05, 2019 12:45 pm

Since it's javascript, try " += " instead of " .= ". Let me know if it makes a difference.

User avatar
MxSimulatorMods
Posts: 52
Joined: Fri Aug 03, 2018 6:37 pm

Re: mxserver-2018-06-30-1412

Postby MxSimulatorMods » Tue Feb 05, 2019 4:50 pm

my leaderboard is coded in PHP not in javascript so "+=" is right.
Image

User avatar
MxSimulatorMods
Posts: 52
Joined: Fri Aug 03, 2018 6:37 pm

Re: mxserver-2018-06-30-1412

Postby MxSimulatorMods » Wed Feb 06, 2019 1:20 am

jlv wrote:tail -f log.txt | grep '^All ready!$' | (while read line; do echo "x/mypassword/customallreadycmd" >/dev/udp/127.0.0.1/19800; done)


I didn't find how add this line in my server (I'm on windows). I think it will be easier for me if you add a js hook for this event.
I also try to use 'forceplay UID' before restart but I have to restart a second time for server take account of these.
Image

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

Re: mxserver-2018-06-30-1412

Postby jlv » Wed Feb 06, 2019 2:17 am

MxSimulatorMods wrote:
jlv wrote:"starttime" is when the gate dropped in 1/128 second units. "date" is seconds since the beginning of time in 1970.


I konw that but the date have a bug. When I totally restart the server, the date is right and my leaderboard work correctly. But after few hours, the result date is not the same than real date. There is a gap between both.

I use this function to know when the start will begin in php :

Code: Select all


$h_debut 
= $race[date] + convertHumanGap($race[starttime]);

function ConvertHumanGap($time)
{
    if ( $time <= 0 ) return "";

    $time = $time / 128;

    $sec = floor($time);
    $ms = round(($time - $sec)*10);
    if ($sec<=99) {
    $time = "";
    $time .= "$sec.$ms";
    }
    else {
        $time=$sec;
    }
    return $time;
}
 

There is no bug in the "date" field unless you count the year 2038 rollover. It's the direct output of the C time() function. Here's the code:

fprintf(g_results_file, "date=%u\n", (unsigned int)time(NULL));

Your server might have a broken clock or you may have a bug somewhere else.

It's probably harmless but I don't see why you're adding the gate drop time to the date. It's always going to be 13-15 seconds which is not significant as far as dates go.

Also, your ConvertHumanGap() function will convert .99 to .10. You'll save yourself a lot of trouble by just using sprintf("%.1f", $time) instead.
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
MxSimulatorMods
Posts: 52
Joined: Fri Aug 03, 2018 6:37 pm

Re: mxserver-2018-06-30-1412

Postby MxSimulatorMods » Thu Feb 14, 2019 12:20 pm

jlv wrote:
MxSimulatorMods wrote:Is it possible to add hook when riders have finished to load the track after restart ?

I would like to send message if the rider is in spectator status after restart.
For now, I use "at +X" but if the rider take lot of time time to load the track, he didn't see the message.

No good way right now. This might work but it's definitely not pretty (and not tested either):

tail -f log.txt | grep '^All ready!$' | (while read line; do echo "x/mypassword/customallreadycmd" >/dev/udp/127.0.0.1/19800; done)

Probably would be a good idea to add an all ready hook.



Could you add this hook please ? It will be awesome for MxsRank !
Image

User avatar
MxSimulatorMods
Posts: 52
Joined: Fri Aug 03, 2018 6:37 pm

Re: mxserver-2018-06-30-1412

Postby MxSimulatorMods » Wed Feb 20, 2019 9:57 pm

JLV, is it possible?
Image

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

Re: mxserver-2018-06-30-1412

Postby jlv » Thu Feb 21, 2019 2:21 am

Yes. I want to finish some client side scripting stuff first.
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.


Return to “General Discussion”

Who is online

Users browsing this forum: Forax and 3 guests