The online racing simulator
[SOLVED] IS_MCI Packet Handling Issue - C#
Hello everybody...

I started using the InSim.NET library to compile an InSim app, for personal programming skills improvement. Basically, I added some packets successfully, as BTN, MSO, STA, BTC. Anyway, now I'm trying to include MCI packets to get user position on track. Follow the code I added already:

insim.Bind<IS_ISM>(HandlePacket);
insim.Bind<IS_NPL>(HandlePacket);
insim.Bind<IS_PLL>(HandlePacket);
insim.Bind<IS_LAP>(HandlePacket);
insim.Bind<IS_ISI>(HandlePacket);
insim.Bind<IS_SPX>(HandlePacket);
insim.Bind<IS_MSO>(MessageOut);
insim.Bind<IS_BTC>(ButtonClicked);
insim.Bind<IS_STA>(TrackInfo);

Flag call on init:

insim.Initialize(new InSimSettings {
Host = host,
Port = port,
Admin = admin,
IName = "^2Testserver",
Prefix = '!',
Flags = InSimDotNet.Packets.InSimFlags.ISF_MCI | InSimDotNet.Packets.InSimFlags.ISF_CON | InSimDotNet.Packets.InSimFlags.ISF_MSO_COLS | InSimDotNet.Packets.InSimFlags.ISF_OBH,
});

And packet handling itself:

void MultiCarInfo(InSim insim, IS_MCI mci)
{
foreach (CompCar car in mci.Info)
{
switch (TrackName)
{
case "BL1":
insim.Send("PACKET CHECK");
if (car.X != 2234)
{
insim.Send("POSITION CHECK");
}
break;
}
}
}

My intention is to get a message if player is not on "2234" (just a random number to test) X position. As you can see, I've linked Trackname to this action. I'm pretty sure Trackname is working, but to clear all possibilities, I already tested without this part of the code.

Any clue about? Thanks to all =)
..
Quote from cargame.nl :Yeah well.. The thing is that 2234 doesn't exist. Use something like x:10 y:588 for end of BL1 pitlane. (really the end of the pitlane that is).

I changed the code to this, decreasing position value, as you mentioned:

void MultiCarInfo(InSim insim, IS_MCI mci)
{
insim.Send("PACKET CHECK1");
foreach (CompCar car in mci.Info)
{
insim.Send("PACKET CHECK2");
if (car.X <= 12 && car.X >= 12 && car.Y >= 12 & car.Y <= 12)
{
insim.Send(car.PLID, "POSITION CHECK");
}
break;
}
}

Actually, any X and Y position should give me the message. Also, even before position comparison, I should have "PACKET CHECK 1 and 2" message. Am I right?. Also, removed trackname check, to be sure it's not interfering.

After this update, still not working.
I can see two possible problems here. You're not setting the "Interval" parameter in InSimSettings which might be why you aren't getting any IS_MCI packets. The overloaded InSim.Send() method call uses "\msg Some text" in the InSim.NET examples, try prefixing your strings with "\msg".
Quote from MadCatX :I can see two possible problems here. You're not setting the "Interval" parameter in InSimSettings which might be why you aren't getting any IS_MCI packets. The overloaded InSim.Send() method call uses "\msg Some text" in the InSim.NET examples, try prefixing your strings with "\msg".

Here we go! I missed to declare Interval. Almost all other issues with packets I've got, now ended.

Really thanks for that. Also, thanks to cargame.nl for assistance too.

FGED GREDG RDFGDR GSFDG