The online racing simulator
OutGauge ID bug?
(2 posts, started )
OutGauge ID bug?
Hello,

I think I have found a bug, or something is up with my code. In OutGaugePack the ID is always zero, when it should match the value set in cfg.txt on the line OutGauge ID.

Here is some example code which seems to prove it, unless someone can correct me.

import socket
import struct

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.settimeout(10.0)
sock.bind(('localhost', 30000))

while True:
data = sock.recv(1024)
if data:
# ID is optional so check the packet size.
if len(data) == 96:
# Unpack just the last int, which is the ID.
id = struct.unpack('i', data[92:])[0]
print 'ID:', id # Always zero.
else:
print 'No ID set'
else: break

sock.close()

Here are the results of running the code.

# cfg.txt settings
# OutGauge Mode 1
# OutGauge Delay 1
# OutGauge IP 127.0.0.1
# OutGauge Port 30000
# OutGauge ID 0

# Output (what I'd expect with no ID)
No ID set
No ID set
No ID set
No ID set
etc..

With the ID set.

# cfg.txt settings.
# OutGauge Mode 1
# OutGauge Delay 1
# OutGauge IP 127.0.0.1
# OutGauge Port 30000
# OutGauge ID 4

# Output (but wait, the ID should be 4?)
ID: 0
ID: 0
ID: 0
ID: 0
ID: 0
etc..

I have tested this a few times and always get these results. Please note that OutSim works correctly, the ID in OutSimPack matches that set in cfg.txt, so I don't think I'm going completely mad.
It would be nice if the ID was always included in OutSimPack and OutGaugePack, as having to check the size of the data to figure out if it been set seems kinda clunky. If it has not been set the ID could be 0, if it has it would be > 0. Just a thought.

OutGauge ID bug?
(2 posts, started )
FGED GREDG RDFGDR GSFDG