I'm web developer and I create a web application to manage my MXS Server. My question is : How is manage results of server ? Does the file is modified in real time or is it edited to change each track ?
And an other question ? What is the "normallap" in the result file ? "Times" is the time accrued of each ckeckpoint ? And "normallap" is the number of checkpoints ?
The results file is opened and truncated when the race starts. The times are appended to the file as the server receives them. It's possible for them to show up out of order so your script needs to be prepared for that.
"firstlap" is the number of gates in the first lap (from the starting gate to the finish line). "normallap" is the number of gates for a regular lap (from the first gate after the finish to the finish).
Each line after "times:" is <slot> <gate count from 0> <time in 1/128 second units>.
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.
How I can save all results ? Because, if the result file is truncated when the race starts, I can't save a backup for the result for the precedent race.
I suppose that the algorythm which calculate results on the official website is not open source ?
if I understand correctly, the end of each race will run the script. So we can collect all the statistics of every race. Would it be possible to have a small example of the script? Should it be mandatory in PEARL or may it be done in PHP ?
You can use whatever scripting language you like as long as your OS can execute it. Here's the bash script I use for uploading results. All you really need is the curl command.
#!/bin/bash
name="$1"
results="$2"
password="$3"
if test -z "$name"
then
exit 1
fi
if ! test -f "$results"
then
exit 1
fi
if test -z "$password"
then
exit 1
fi
tmpresults=$(mktemp /tmp/results.XXXXXXXX)
cp -- "$results" $tmpresults
(
curl -s -F "name=$name" -F "password=$password" -F 'results=<'$tmpresults http://mxsimulator.com/uploadresults.php
rm $tmpresults
) >/dev/null &
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.
Based on the "sh: test.bat: command not found" error, I assume you're running Linux. The Windows bat files won't work on Linux. Try the shell script I posted.
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.
I'll assume you saved the script as "uploadresults.sh" in the same directory you run the server from. To execute the script it needs execute permission (use "chmod +x uploadresults.sh") and since the current directory isn't in your path by default you need to explicitly give the current directory in the pathname -
I am running linux, both servers are running on ccool4.me, not to worry I managed to fix it though. commented out the /dev/null to output errors and turns out the file it was posting to was 404'ing... So fixed that now.