The online racing simulator
How to get notified if traffic lights switch to green?
Hi,

I only get the ISP_STA for race start, but that's way too early.

Is there a certain request which can trigger the notification, which I overlooked in Insim 0.6R? I'm using latest InSimDotNet btw.
#2 - Racon
There isn't a way that I know of to get at it when it is actually happening (I believe that this is deliberate, in order to make it harder for someone to write a launch control program).

In my insims, I have a variable for the race start time which I set to 0 on race start, then update when the first player crosses split 1 to (current time - split time). So, we can get it, just not until the first split comes in. If anyone else knows a way to get it when it happens, I'm all ears Wink
Thanks Racon, that's what I feared of. I'll try to find an appropriate some workaround.

Cheers!
#4 - Racon
One (very clunky!) thought is to start the race yourself by taking over the lights with that new packet (UCO I think). It's something that's on my tinker-list, but it's a long way down and I've no free time at the moment Frown
Ah right.

What about that one:
After receiving raceStart event polling for raceTime as long as raceTime > 0 => that's green light. Is there a raceTime request which returns it in that way?
#6 - Racon
There is a request for racetime in hundredths of a second (one of the TINY request numbers), but I have a feeling that it goes from the time of the RST packet, ie, when you're all first placed on the grid, and is therefore up to a few seconds count already by the time the lights turn green.

(That's off the top of my head though, it's been a while since I've looked at this Wink )
it is possible to get it from game memory, nice 5 step "flag"
Yes, the time package counts delta to RST package, what a pity.

To use the info from memory is truly a really nice hack, but I do not see an easy way to retrieve it programatically and even not from a remotely running app at all. But great one! Big grin

The packages like split or lap time cannot be requested explicitely, else they could have been used.

Seems to be harder as expected...
I can see two ways to get something similar to what you want. First approach is using memory reading as Draggo suggested, and maybe send by a TCP packet to remote host. Depending of what you need, it can delay too much.

Second option is to manually control the lights using an InSim application, that trigger some bool var in the same moment you send the green light packet to host.

You can get the total time with IS_LAP packet:

struct IS_LAP // LAP time
{
byte Size; // 20
byte Type; // ISP_LAP
byte ReqI; // 0
byte PLID; // player's unique id

unsigned LTime; // lap time (ms)
unsigned ETime; // total time (ms)

word LapsDone; // laps completed
word Flags; // player flags

byte Sp0;
byte Penalty; // current penalty value (see below)
byte NumStops; // number of pit stops
byte Sp3;
};

I think ETime is what you want. If you get the time from any player on track during race start, and as soon it goes above 0ms, then you have a green light.

FGED GREDG RDFGDR GSFDG